Page MenuHomePhabricator

D12899.id31249.diff
No OneTemporary

D12899.id31249.diff

diff --git a/resources/sql/autopatches/20150503.repositorysymbols.2.php b/resources/sql/autopatches/20150503.repositorysymbols.2.php
--- a/resources/sql/autopatches/20150503.repositorysymbols.2.php
+++ b/resources/sql/autopatches/20150503.repositorysymbols.2.php
@@ -1,26 +1,29 @@
<?php
-$projects = id(new PhabricatorRepositoryArcanistProjectQuery())
- ->setViewer(PhabricatorUser::getOmnipotentUser())
- ->needRepositories(true)
- ->execute();
-
$table = new PhabricatorRepositorySymbol();
$conn_w = $table->establishConnection('w');
+$projects = queryfx_all(
+ $conn_w,
+ 'SELECT * FROM %T',
+ 'repository_arcanistproject');
+
foreach ($projects as $project) {
- $repo = $project->getRepository();
+ $repo = id(new PhabricatorRepositoryQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->withIDs(array($project['repository']))
+ ->executeOne();
if (!$repo) {
continue;
}
- echo pht("Migrating symbols for '%s' project...\n", $project->getName());
+ echo pht("Migrating symbols for '%s' project...\n", $project['name']);
queryfx(
$conn_w,
'UPDATE %T SET repositoryPHID = %s WHERE arcanistProjectID = %d',
$table->getTableName(),
$repo->getPHID(),
- $project->getID());
+ $project['id']);
}
diff --git a/resources/sql/autopatches/20150518.arcanistproject.sql b/resources/sql/autopatches/20150518.arcanistproject.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150518.arcanistproject.sql
@@ -0,0 +1,10 @@
+ALTER TABLE {$NAMESPACE}_differential.differential_diff
+ DROP COLUMN arcanistProjectPHID;
+
+ALTER TABLE {$NAMESPACE}_differential.differential_revision
+ DROP COLUMN arcanistProjectPHID;
+
+ALTER TABLE {$NAMESPACE}_releeph.releeph_project
+ DROP COLUMN arcanistProjectID;
+
+DROP TABLE {$NAMESPACE}_repository.repository_arcanistproject;
diff --git a/resources/sql/patches/131.migraterevisionquery.php b/resources/sql/patches/131.migraterevisionquery.php
--- a/resources/sql/patches/131.migraterevisionquery.php
+++ b/resources/sql/patches/131.migraterevisionquery.php
@@ -18,14 +18,18 @@
}
$branch_name = $diff->getBranch();
- $arc_project_phid = $diff->getArcanistProjectPHID();
+ $arc_project_phid = queryfx(
+ $conn_w,
+ 'SELECT arcanistProjectPHID FROM %T WHERE id = %d',
+ id(new DifferentialDiff())->getTableName(),
+ $diff->getID());
queryfx(
$conn_w,
'UPDATE %T SET branchName = %s, arcanistProjectPHID = %s WHERE id = %d',
$table->getTableName(),
$branch_name,
- $arc_project_phid,
+ $arc_project_phid['arcanistProjectPHID'],
$revision->getID());
}
} while (count($revisions) == 1000);
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -172,7 +172,6 @@
'AphrontView' => 'view/AphrontView.php',
'AphrontWebpageResponse' => 'aphront/response/AphrontWebpageResponse.php',
'ArcanistConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistConduitAPIMethod.php',
- 'ArcanistProjectInfoConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php',
'AuditConduitAPIMethod' => 'applications/audit/conduit/AuditConduitAPIMethod.php',
'AuditQueryConduitAPIMethod' => 'applications/audit/conduit/AuditQueryConduitAPIMethod.php',
'AuthManageProvidersCapability' => 'applications/auth/capability/AuthManageProvidersCapability.php',
@@ -461,7 +460,6 @@
'DifferentialUpdateRevisionConduitAPIMethod' => 'applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php',
'DifferentialUpdateUnitResultsConduitAPIMethod' => 'applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php',
'DifferentialViewPolicyField' => 'applications/differential/customfield/DifferentialViewPolicyField.php',
- 'DiffusionArcanistProjectDatasource' => 'applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php',
'DiffusionAuditorDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorDatasource.php',
'DiffusionBranchQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php',
'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php',
@@ -2384,9 +2382,6 @@
'PhabricatorRepositoriesApplication' => 'applications/repository/application/PhabricatorRepositoriesApplication.php',
'PhabricatorRepositoriesSetupCheck' => 'applications/config/check/PhabricatorRepositoriesSetupCheck.php',
'PhabricatorRepository' => 'applications/repository/storage/PhabricatorRepository.php',
- 'PhabricatorRepositoryArcanistProject' => 'applications/repository/storage/PhabricatorRepositoryArcanistProject.php',
- 'PhabricatorRepositoryArcanistProjectPHIDType' => 'applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php',
- 'PhabricatorRepositoryArcanistProjectQuery' => 'applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php',
'PhabricatorRepositoryAuditRequest' => 'applications/repository/storage/PhabricatorRepositoryAuditRequest.php',
'PhabricatorRepositoryBranch' => 'applications/repository/storage/PhabricatorRepositoryBranch.php',
'PhabricatorRepositoryCommit' => 'applications/repository/storage/PhabricatorRepositoryCommit.php',
@@ -3419,7 +3414,6 @@
),
'AphrontWebpageResponse' => 'AphrontHTMLResponse',
'ArcanistConduitAPIMethod' => 'ConduitAPIMethod',
- 'ArcanistProjectInfoConduitAPIMethod' => 'ArcanistConduitAPIMethod',
'AuditConduitAPIMethod' => 'ConduitAPIMethod',
'AuditQueryConduitAPIMethod' => 'AuditConduitAPIMethod',
'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability',
@@ -3705,7 +3699,6 @@
'DifferentialUpdateRevisionConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialUpdateUnitResultsConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialViewPolicyField' => 'DifferentialCoreCustomField',
- 'DiffusionArcanistProjectDatasource' => 'PhabricatorTypeaheadDatasource',
'DiffusionAuditorDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'DiffusionBranchQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionBranchTableController' => 'DiffusionController',
@@ -5821,13 +5814,6 @@
'PhabricatorDestructibleInterface',
'PhabricatorProjectInterface',
),
- 'PhabricatorRepositoryArcanistProject' => array(
- 'PhabricatorRepositoryDAO',
- 'PhabricatorPolicyInterface',
- 'PhabricatorDestructibleInterface',
- ),
- 'PhabricatorRepositoryArcanistProjectPHIDType' => 'PhabricatorPHIDType',
- 'PhabricatorRepositoryArcanistProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorRepositoryAuditRequest' => array(
'PhabricatorRepositoryDAO',
'PhabricatorPolicyInterface',
diff --git a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php b/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php
deleted file mode 100644
--- a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-final class ArcanistProjectInfoConduitAPIMethod
- extends ArcanistConduitAPIMethod {
-
- public function getAPIMethodName() {
- return 'arcanist.projectinfo';
- }
-
- public function getMethodStatus() {
- return self::METHOD_STATUS_DEPRECATED;
- }
-
- public function getMethodDescription() {
- return 'Arcanist projects are deprecated.';
- }
-
- protected function defineParamTypes() {
- return array(
- 'name' => 'required string',
- );
- }
-
- protected function defineReturnType() {
- return 'nonempty dict';
- }
-
- protected function defineErrorTypes() {
- return array(
- 'ERR-BAD-ARCANIST-PROJECT' => 'No such project exists.',
- );
- }
-
- protected function execute(ConduitAPIRequest $request) {
- $name = $request->getValue('name');
-
- $project = id(new PhabricatorRepositoryArcanistProject())->loadOneWhere(
- 'name = %s',
- $name);
-
- if (!$project) {
- throw new ConduitException('ERR-BAD-ARCANIST-PROJECT');
- }
-
- $repository = null;
- if ($project->getRepositoryID()) {
- $repository = id(new PhabricatorRepositoryQuery())
- ->setViewer($request->getUser())
- ->withIDs(array($project->getRepositoryID()))
- ->executeOne();
- }
-
- $repository_phid = null;
- $tracked = false;
- $encoding = null;
- $dictionary = array();
- if ($repository) {
- $repository_phid = $repository->getPHID();
- $tracked = $repository->isTracked();
- $encoding = $repository->getDetail('encoding');
- $dictionary = $repository->toDictionary();
- }
-
- return array(
- 'name' => $project->getName(),
- 'phid' => $project->getPHID(),
- 'repositoryPHID' => $repository_phid,
- 'tracked' => $tracked,
- 'encoding' => $encoding,
- 'repository' => $dictionary,
- );
- }
-
-}
diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -27,7 +27,6 @@
protected $branch;
protected $bookmark;
- protected $arcanistProjectPHID;
protected $creationMethod;
protected $repositoryUUID;
@@ -37,7 +36,6 @@
private $unsavedChangesets = array();
private $changesets = self::ATTACHABLE;
- private $arcanistProject = self::ATTACHABLE;
private $revision = self::ATTACHABLE;
private $properties = array();
@@ -58,7 +56,6 @@
'lineCount' => 'uint32',
'branch' => 'text255?',
'bookmark' => 'text255?',
- 'arcanistProjectPHID' => 'phid?',
'repositoryUUID' => 'text64?',
// T6203/NULLABILITY
@@ -108,25 +105,6 @@
$this->getID());
}
- public function attachArcanistProject(
- PhabricatorRepositoryArcanistProject $project = null) {
- $this->arcanistProject = $project;
- return $this;
- }
-
- public function getArcanistProject() {
- return $this->assertAttached($this->arcanistProject);
- }
-
- public function getArcanistProjectName() {
- $name = '';
- if ($this->arcanistProject) {
- $project = $this->getArcanistProject();
- $name = $project->getName();
- }
- return $name;
- }
-
public function save() {
$this->openTransaction();
$ret = parent::save();
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -29,7 +29,6 @@
protected $mailKey;
protected $branchName;
- protected $arcanistProjectPHID;
protected $repositoryPHID;
protected $viewPolicy = PhabricatorPolicies::POLICY_USER;
protected $editPolicy = PhabricatorPolicies::POLICY_USER;
@@ -85,7 +84,6 @@
'lineCount' => 'uint32?',
'mailKey' => 'bytes40',
'branchName' => 'text255?',
- 'arcanistProjectPHID' => 'phid?',
'repositoryPHID' => 'phid?',
),
self::CONFIG_KEY_SCHEMA => array(
diff --git a/src/applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php b/src/applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php
deleted file mode 100644
--- a/src/applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-final class DiffusionArcanistProjectDatasource
- extends PhabricatorTypeaheadDatasource {
-
- public function isBrowsable() {
- // TODO: We should probably make this browsable, or maybe remove it.
- return false;
- }
-
- public function getBrowseTitle() {
- return pht('Browse Arcanist Projects');
- }
-
- public function getPlaceholderText() {
- return pht('Type an arcanist project name...');
- }
-
- public function getDatasourceApplicationClass() {
- return 'PhabricatorDiffusionApplication';
- }
-
- public function loadResults() {
- $viewer = $this->getViewer();
- $raw_query = $this->getRawQuery();
-
- $results = array();
-
- $arcprojs = id(new PhabricatorRepositoryArcanistProject())->loadAll();
- foreach ($arcprojs as $proj) {
- $results[] = id(new PhabricatorTypeaheadResult())
- ->setName($proj->getName())
- ->setPHID($proj->getPHID());
- }
-
- return $results;
- }
-
-}
diff --git a/src/applications/releeph/storage/ReleephProject.php b/src/applications/releeph/storage/ReleephProject.php
--- a/src/applications/releeph/storage/ReleephProject.php
+++ b/src/applications/releeph/storage/ReleephProject.php
@@ -18,12 +18,10 @@
protected $repositoryPHID;
protected $isActive;
protected $createdByUserPHID;
- protected $arcanistProjectID;
protected $details = array();
private $repository = self::ATTACHABLE;
- private $arcanistProject = self::ATTACHABLE;
protected function getConfiguration() {
return array(
@@ -67,16 +65,6 @@
return $this;
}
- public function getArcanistProject() {
- return $this->assertAttached($this->arcanistProject);
- }
-
- public function attachArcanistProject(
- PhabricatorRepositoryArcanistProject $arcanist_project = null) {
- $this->arcanistProject = $arcanist_project;
- return $this;
- }
-
public function getPushers() {
return $this->getDetail('pushers', array());
}
diff --git a/src/applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php b/src/applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php
deleted file mode 100644
--- a/src/applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-final class PhabricatorRepositoryArcanistProjectPHIDType
- extends PhabricatorPHIDType {
-
- const TYPECONST = 'APRJ';
-
- public function getTypeName() {
- return pht('Arcanist Project');
- }
-
- public function newObject() {
- return new PhabricatorRepositoryArcanistProject();
- }
-
- protected function buildQueryForObjects(
- PhabricatorObjectQuery $query,
- array $phids) {
-
- return id(new PhabricatorRepositoryArcanistProjectQuery())
- ->withPHIDs($phids);
- }
-
- public function loadHandles(
- PhabricatorHandleQuery $query,
- array $handles,
- array $objects) {
-
- foreach ($handles as $phid => $handle) {
- $project = $objects[$phid];
- $handle->setName($project->getName());
- }
- }
-
-}
diff --git a/src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php b/src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php
deleted file mode 100644
--- a/src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-
-final class PhabricatorRepositoryArcanistProjectQuery
- extends PhabricatorCursorPagedPolicyAwareQuery {
-
- private $ids;
- private $phids;
-
- private $needRepositories;
-
- public function withIDs(array $ids) {
- $this->ids = $ids;
- return $this;
- }
-
- public function withPHIDs(array $phids) {
- $this->phids = $phids;
- return $this;
- }
-
- public function needRepositories($need_repositories) {
- $this->needRepositories = $need_repositories;
- return $this;
- }
-
- protected function loadPage() {
- $table = new PhabricatorRepositoryArcanistProject();
- $conn_r = $table->establishConnection('r');
-
- $data = queryfx_all(
- $conn_r,
- 'SELECT * FROM %T %Q %Q %Q',
- $table->getTableName(),
- $this->buildWhereClause($conn_r),
- $this->buildOrderClause($conn_r),
- $this->buildLimitClause($conn_r));
-
- return $table->loadAllFromArray($data);
- }
-
- protected function willFilterPage(array $projects) {
- assert_instances_of($projects, 'PhabricatorRepositoryArcanistProject');
-
- if ($this->needRepositories) {
- $repository_ids = mpull($projects, 'getRepositoryID');
- $repositories = id(new PhabricatorRepositoryQuery())
- ->setViewer($this->getViewer())
- ->withIDs($repository_ids)
- ->execute();
- foreach ($projects as $project) {
- $repo = idx($repositories, $project->getRepositoryID());
- $project->attachRepository($repo);
- }
- }
-
- return $projects;
- }
-
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
- $where = array();
-
- if ($this->ids) {
- $where[] = qsprintf(
- $conn_r,
- 'id IN (%Ld)',
- $this->ids);
- }
-
- if ($this->phids) {
- $where[] = qsprintf(
- $conn_r,
- 'phid IN (%Ls)',
- $this->phids);
- }
-
- $where[] = $this->buildPagingClause($conn_r);
-
- return $this->formatWhereClause($where);
- }
-
-
- public function getQueryApplicationClass() {
- // TODO: Diffusion? Differential?
- return null;
- }
-
-}
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -1160,12 +1160,6 @@
$path->delete();
}
- $projects = id(new PhabricatorRepositoryArcanistProject())
- ->loadAllWhere('repositoryID = %d', $this->getID());
- foreach ($projects as $project) {
- $project->delete();
- }
-
queryfx(
$this->establishConnection('w'),
'DELETE FROM %T WHERE repositoryPHID = %s',
diff --git a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php b/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php
deleted file mode 100644
--- a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-final class PhabricatorRepositoryArcanistProject
- extends PhabricatorRepositoryDAO
- implements
- PhabricatorPolicyInterface,
- PhabricatorDestructibleInterface {
-
- protected $name;
- protected $repositoryID;
-
- private $repository = self::ATTACHABLE;
-
- protected function getConfiguration() {
- return array(
- self::CONFIG_AUX_PHID => true,
- self::CONFIG_TIMESTAMPS => false,
- self::CONFIG_COLUMN_SCHEMA => array(
- 'name' => 'text128',
- 'repositoryID' => 'id?',
- ),
- self::CONFIG_KEY_SCHEMA => array(
- 'key_phid' => null,
- 'phid' => array(
- 'columns' => array('phid'),
- 'unique' => true,
- ),
- 'name' => array(
- 'columns' => array('name'),
- 'unique' => true,
- ),
- ),
- ) + parent::getConfiguration();
- }
-
- public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(
- PhabricatorRepositoryArcanistProjectPHIDType::TYPECONST);
- }
-
- public function getRepository() {
- return $this->assertAttached($this->repository);
- }
-
- public function attachRepository(PhabricatorRepository $repository = null) {
- $this->repository = $repository;
- return $this;
- }
-
-
-
-/* -( PhabricatorPolicyInterface )----------------------------------------- */
-
- public function getCapabilities() {
- return array(
- PhabricatorPolicyCapability::CAN_VIEW,
- PhabricatorPolicyCapability::CAN_EDIT,
- );
- }
-
- public function getPolicy($capability) {
- switch ($capability) {
- case PhabricatorPolicyCapability::CAN_VIEW:
- return PhabricatorPolicies::POLICY_USER;
- case PhabricatorPolicyCapability::CAN_EDIT:
- return PhabricatorPolicies::POLICY_ADMIN;
- }
- }
-
- public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
- return false;
- }
-
- public function describeAutomaticCapability($capability) {
- return null;
- }
-
-
-/* -( PhabricatorDestructibleInterface )----------------------------------- */
-
- public function destroyObjectPermanently(
- PhabricatorDestructionEngine $engine) {
-
- $this->openTransaction();
- $this->delete();
- $this->saveTransaction();
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 22, 1:01 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6741829
Default Alt Text
D12899.id31249.diff (20 KB)

Event Timeline