diff --git a/resources/sql/autopatches/20150708.arcanistproject.sql b/resources/sql/autopatches/20150708.arcanistproject.sql new file mode 100644 index 0000000000..0dc4e5420f --- /dev/null +++ b/resources/sql/autopatches/20150708.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/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 8da3345ee0..ef6a45b5da 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -173,7 +173,6 @@ phutil_register_library_map(array( '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', @@ -2492,9 +2491,6 @@ phutil_register_library_map(array( 'PhabricatorRemarkupUIExample' => 'applications/uiexample/examples/PhabricatorRemarkupUIExample.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', @@ -3598,7 +3594,6 @@ phutil_register_library_map(array( ), 'AphrontWebpageResponse' => 'AphrontHTMLResponse', 'ArcanistConduitAPIMethod' => 'ConduitAPIMethod', - 'ArcanistProjectInfoConduitAPIMethod' => 'ArcanistConduitAPIMethod', 'AuditConduitAPIMethod' => 'ConduitAPIMethod', 'AuditQueryConduitAPIMethod' => 'AuditConduitAPIMethod', 'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability', @@ -6290,13 +6285,6 @@ phutil_register_library_map(array( 'PhabricatorProjectInterface', 'PhabricatorSpacesInterface', ), - '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 index c89bcf7845..0000000000 --- a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php +++ /dev/null @@ -1,74 +0,0 @@ - 'required string', - ); - } - - protected function defineReturnType() { - return 'nonempty dict'; - } - - protected function defineErrorTypes() { - return array( - 'ERR-BAD-ARCANIST-PROJECT' => pht('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/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php index 686f7cba83..4a5b749268 100644 --- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php @@ -39,7 +39,6 @@ final class DifferentialCreateDiffConduitAPIMethod 'sourceControlPath' => 'required string', 'sourceControlBaseRevision' => 'required string', 'creationMethod' => 'optional string', - 'arcanistProject' => 'deprecated', 'lintStatus' => 'required '.$status_const, 'unitStatus' => 'required '.$status_const, 'repositoryPHID' => 'optional phid', diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php index 26379f9f33..4a0e63d5a7 100644 --- a/src/applications/differential/storage/DifferentialDiff.php +++ b/src/applications/differential/storage/DifferentialDiff.php @@ -27,7 +27,6 @@ final class DifferentialDiff protected $branch; protected $bookmark; - protected $arcanistProjectPHID; protected $creationMethod; protected $repositoryUUID; @@ -58,7 +57,6 @@ final class DifferentialDiff 'lineCount' => 'uint32', 'branch' => 'text255?', 'bookmark' => 'text255?', - 'arcanistProjectPHID' => 'phid?', 'repositoryUUID' => 'text64?', // T6203/NULLABILITY diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index affa0c4d9a..84b77f0c48 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -30,7 +30,6 @@ final class DifferentialRevision extends DifferentialDAO protected $mailKey; protected $branchName; - protected $arcanistProjectPHID; protected $repositoryPHID; protected $viewPolicy = PhabricatorPolicies::POLICY_USER; protected $editPolicy = PhabricatorPolicies::POLICY_USER; @@ -87,7 +86,6 @@ final class DifferentialRevision extends DifferentialDAO 'lineCount' => 'uint32?', 'mailKey' => 'bytes40', 'branchName' => 'text255?', - 'arcanistProjectPHID' => 'phid?', 'repositoryPHID' => 'phid?', ), self::CONFIG_KEY_SCHEMA => array( diff --git a/src/applications/releeph/storage/ReleephProject.php b/src/applications/releeph/storage/ReleephProject.php index 4bb4f6cd15..cf5e179abf 100644 --- a/src/applications/releeph/storage/ReleephProject.php +++ b/src/applications/releeph/storage/ReleephProject.php @@ -18,7 +18,6 @@ final class ReleephProject extends ReleephDAO protected $repositoryPHID; protected $isActive; protected $createdByUserPHID; - protected $arcanistProjectID; protected $details = array(); @@ -34,7 +33,6 @@ final class ReleephProject extends ReleephDAO 'name' => 'text128', 'trunkBranch' => 'text255', 'isActive' => 'bool', - 'arcanistProjectID' => 'id?', ), self::CONFIG_KEY_SCHEMA => array( 'projectName' => array( diff --git a/src/applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php b/src/applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php deleted file mode 100644 index 7a71e86c73..0000000000 --- a/src/applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php +++ /dev/null @@ -1,35 +0,0 @@ -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 index 901f58cbdf..0000000000 --- a/src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php +++ /dev/null @@ -1,87 +0,0 @@ -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 index 96208747b0..d5b128292a 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -1169,12 +1169,6 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO $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 index a1ac747bbf..0000000000 --- a/src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php +++ /dev/null @@ -1,89 +0,0 @@ - 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(); - } - -}