1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Remove remaining arcanist project code

Summary: Fixes T7604. This is the big scary change which drops the "arcanist project" fields from the database permanently.

Test Plan:
`grep`ped for the following to ensure that I had found all remaining references:

  - `/arcanistProject/i`
  - `/arcanist_project/i`
  - `/projectName/i`
  - `/project_name/i`
  - `/project_id/i`

WARNING: Wait at least one month before landing this.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7604

Differential Revision: https://secure.phabricator.com/D12899
This commit is contained in:
Joshua Spence 2015-07-08 19:36:42 +10:00
parent 980f22d97d
commit 0036670329
11 changed files with 10 additions and 310 deletions

View file

@ -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;

View file

@ -173,7 +173,6 @@ phutil_register_library_map(array(
'AphrontView' => 'view/AphrontView.php', 'AphrontView' => 'view/AphrontView.php',
'AphrontWebpageResponse' => 'aphront/response/AphrontWebpageResponse.php', 'AphrontWebpageResponse' => 'aphront/response/AphrontWebpageResponse.php',
'ArcanistConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistConduitAPIMethod.php', 'ArcanistConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistConduitAPIMethod.php',
'ArcanistProjectInfoConduitAPIMethod' => 'applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php',
'AuditConduitAPIMethod' => 'applications/audit/conduit/AuditConduitAPIMethod.php', 'AuditConduitAPIMethod' => 'applications/audit/conduit/AuditConduitAPIMethod.php',
'AuditQueryConduitAPIMethod' => 'applications/audit/conduit/AuditQueryConduitAPIMethod.php', 'AuditQueryConduitAPIMethod' => 'applications/audit/conduit/AuditQueryConduitAPIMethod.php',
'AuthManageProvidersCapability' => 'applications/auth/capability/AuthManageProvidersCapability.php', 'AuthManageProvidersCapability' => 'applications/auth/capability/AuthManageProvidersCapability.php',
@ -2492,9 +2491,6 @@ phutil_register_library_map(array(
'PhabricatorRemarkupUIExample' => 'applications/uiexample/examples/PhabricatorRemarkupUIExample.php', 'PhabricatorRemarkupUIExample' => 'applications/uiexample/examples/PhabricatorRemarkupUIExample.php',
'PhabricatorRepositoriesSetupCheck' => 'applications/config/check/PhabricatorRepositoriesSetupCheck.php', 'PhabricatorRepositoriesSetupCheck' => 'applications/config/check/PhabricatorRepositoriesSetupCheck.php',
'PhabricatorRepository' => 'applications/repository/storage/PhabricatorRepository.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', 'PhabricatorRepositoryAuditRequest' => 'applications/repository/storage/PhabricatorRepositoryAuditRequest.php',
'PhabricatorRepositoryBranch' => 'applications/repository/storage/PhabricatorRepositoryBranch.php', 'PhabricatorRepositoryBranch' => 'applications/repository/storage/PhabricatorRepositoryBranch.php',
'PhabricatorRepositoryCommit' => 'applications/repository/storage/PhabricatorRepositoryCommit.php', 'PhabricatorRepositoryCommit' => 'applications/repository/storage/PhabricatorRepositoryCommit.php',
@ -3598,7 +3594,6 @@ phutil_register_library_map(array(
), ),
'AphrontWebpageResponse' => 'AphrontHTMLResponse', 'AphrontWebpageResponse' => 'AphrontHTMLResponse',
'ArcanistConduitAPIMethod' => 'ConduitAPIMethod', 'ArcanistConduitAPIMethod' => 'ConduitAPIMethod',
'ArcanistProjectInfoConduitAPIMethod' => 'ArcanistConduitAPIMethod',
'AuditConduitAPIMethod' => 'ConduitAPIMethod', 'AuditConduitAPIMethod' => 'ConduitAPIMethod',
'AuditQueryConduitAPIMethod' => 'AuditConduitAPIMethod', 'AuditQueryConduitAPIMethod' => 'AuditConduitAPIMethod',
'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability', 'AuthManageProvidersCapability' => 'PhabricatorPolicyCapability',
@ -6290,13 +6285,6 @@ phutil_register_library_map(array(
'PhabricatorProjectInterface', 'PhabricatorProjectInterface',
'PhabricatorSpacesInterface', 'PhabricatorSpacesInterface',
), ),
'PhabricatorRepositoryArcanistProject' => array(
'PhabricatorRepositoryDAO',
'PhabricatorPolicyInterface',
'PhabricatorDestructibleInterface',
),
'PhabricatorRepositoryArcanistProjectPHIDType' => 'PhabricatorPHIDType',
'PhabricatorRepositoryArcanistProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorRepositoryAuditRequest' => array( 'PhabricatorRepositoryAuditRequest' => array(
'PhabricatorRepositoryDAO', 'PhabricatorRepositoryDAO',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',

View file

@ -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 pht('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' => 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,
);
}
}

View file

@ -39,7 +39,6 @@ final class DifferentialCreateDiffConduitAPIMethod
'sourceControlPath' => 'required string', 'sourceControlPath' => 'required string',
'sourceControlBaseRevision' => 'required string', 'sourceControlBaseRevision' => 'required string',
'creationMethod' => 'optional string', 'creationMethod' => 'optional string',
'arcanistProject' => 'deprecated',
'lintStatus' => 'required '.$status_const, 'lintStatus' => 'required '.$status_const,
'unitStatus' => 'required '.$status_const, 'unitStatus' => 'required '.$status_const,
'repositoryPHID' => 'optional phid', 'repositoryPHID' => 'optional phid',

View file

@ -27,7 +27,6 @@ final class DifferentialDiff
protected $branch; protected $branch;
protected $bookmark; protected $bookmark;
protected $arcanistProjectPHID;
protected $creationMethod; protected $creationMethod;
protected $repositoryUUID; protected $repositoryUUID;
@ -58,7 +57,6 @@ final class DifferentialDiff
'lineCount' => 'uint32', 'lineCount' => 'uint32',
'branch' => 'text255?', 'branch' => 'text255?',
'bookmark' => 'text255?', 'bookmark' => 'text255?',
'arcanistProjectPHID' => 'phid?',
'repositoryUUID' => 'text64?', 'repositoryUUID' => 'text64?',
// T6203/NULLABILITY // T6203/NULLABILITY

View file

@ -30,7 +30,6 @@ final class DifferentialRevision extends DifferentialDAO
protected $mailKey; protected $mailKey;
protected $branchName; protected $branchName;
protected $arcanistProjectPHID;
protected $repositoryPHID; protected $repositoryPHID;
protected $viewPolicy = PhabricatorPolicies::POLICY_USER; protected $viewPolicy = PhabricatorPolicies::POLICY_USER;
protected $editPolicy = PhabricatorPolicies::POLICY_USER; protected $editPolicy = PhabricatorPolicies::POLICY_USER;
@ -87,7 +86,6 @@ final class DifferentialRevision extends DifferentialDAO
'lineCount' => 'uint32?', 'lineCount' => 'uint32?',
'mailKey' => 'bytes40', 'mailKey' => 'bytes40',
'branchName' => 'text255?', 'branchName' => 'text255?',
'arcanistProjectPHID' => 'phid?',
'repositoryPHID' => 'phid?', 'repositoryPHID' => 'phid?',
), ),
self::CONFIG_KEY_SCHEMA => array( self::CONFIG_KEY_SCHEMA => array(

View file

@ -18,7 +18,6 @@ final class ReleephProject extends ReleephDAO
protected $repositoryPHID; protected $repositoryPHID;
protected $isActive; protected $isActive;
protected $createdByUserPHID; protected $createdByUserPHID;
protected $arcanistProjectID;
protected $details = array(); protected $details = array();
@ -34,7 +33,6 @@ final class ReleephProject extends ReleephDAO
'name' => 'text128', 'name' => 'text128',
'trunkBranch' => 'text255', 'trunkBranch' => 'text255',
'isActive' => 'bool', 'isActive' => 'bool',
'arcanistProjectID' => 'id?',
), ),
self::CONFIG_KEY_SCHEMA => array( self::CONFIG_KEY_SCHEMA => array(
'projectName' => array( 'projectName' => array(

View file

@ -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());
}
}
}

View file

@ -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;
}
}

View file

@ -1169,12 +1169,6 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
$path->delete(); $path->delete();
} }
$projects = id(new PhabricatorRepositoryArcanistProject())
->loadAllWhere('repositoryID = %d', $this->getID());
foreach ($projects as $project) {
$project->delete();
}
queryfx( queryfx(
$this->establishConnection('w'), $this->establishConnection('w'),
'DELETE FROM %T WHERE repositoryPHID = %s', 'DELETE FROM %T WHERE repositoryPHID = %s',

View file

@ -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();
}
}