mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32: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:
parent
980f22d97d
commit
0036670329
11 changed files with 10 additions and 310 deletions
10
resources/sql/autopatches/20150708.arcanistproject.sql
Normal file
10
resources/sql/autopatches/20150708.arcanistproject.sql
Normal 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;
|
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue