1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Remove "arcanist project" controllers

Summary: Ref T7603. Ref T7604. There is no need for these controllers anymore as the "Arcanist Project" data is not used anywhere. Depends on D12894 and D12898.

Test Plan: Went to `/repository/project/edit/2/` and got a 404.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7603, T7604

Differential Revision: https://secure.phabricator.com/D12897
This commit is contained in:
Joshua Spence 2015-05-26 07:11:46 +10:00
parent 52767e54da
commit 6e5e6a1a8c
5 changed files with 0 additions and 198 deletions

View file

@ -2387,8 +2387,6 @@ phutil_register_library_map(array(
'PhabricatorRepositoriesSetupCheck' => 'applications/config/check/PhabricatorRepositoriesSetupCheck.php',
'PhabricatorRepository' => 'applications/repository/storage/PhabricatorRepository.php',
'PhabricatorRepositoryArcanistProject' => 'applications/repository/storage/PhabricatorRepositoryArcanistProject.php',
'PhabricatorRepositoryArcanistProjectDeleteController' => 'applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php',
'PhabricatorRepositoryArcanistProjectEditController' => 'applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php',
'PhabricatorRepositoryArcanistProjectPHIDType' => 'applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php',
'PhabricatorRepositoryArcanistProjectQuery' => 'applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php',
'PhabricatorRepositoryAuditRequest' => 'applications/repository/storage/PhabricatorRepositoryAuditRequest.php',
@ -5832,8 +5830,6 @@ phutil_register_library_map(array(
'PhabricatorPolicyInterface',
'PhabricatorDestructibleInterface',
),
'PhabricatorRepositoryArcanistProjectDeleteController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryArcanistProjectEditController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryArcanistProjectPHIDType' => 'PhabricatorPHIDType',
'PhabricatorRepositoryArcanistProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorRepositoryAuditRequest' => array(

View file

@ -30,10 +30,6 @@ final class PhabricatorRepositoriesApplication extends PhabricatorApplication {
return array(
'/repository/' => array(
'' => 'PhabricatorRepositoryListController',
'project/edit/(?P<id>[1-9]\d*)/'
=> 'PhabricatorRepositoryArcanistProjectEditController',
'project/delete/(?P<id>[1-9]\d*)/'
=> 'PhabricatorRepositoryArcanistProjectDeleteController',
),
);
}

View file

@ -1,42 +0,0 @@
<?php
final class PhabricatorRepositoryArcanistProjectDeleteController
extends PhabricatorRepositoryController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$arc_project =
id(new PhabricatorRepositoryArcanistProject())->load($this->id);
if (!$arc_project) {
return new Aphront404Response();
}
$request = $this->getRequest();
if ($request->isDialogFormPost()) {
$arc_project->delete();
return id(new AphrontRedirectResponse())->setURI('/repository/');
}
$dialog = new AphrontDialogView();
$dialog
->setUser($request->getUser())
->setTitle(pht('Really delete this arcanist project?'))
->appendChild(
pht(
'Really delete the "%s" arcanist project? '.
'This operation can not be undone.',
$arc_project->getName()))
->setSubmitURI('/repository/project/delete/'.$this->id.'/')
->addSubmitButton(pht('Delete Arcanist Project'))
->addCancelButton('/repository/');
return id(new AphrontDialogResponse())->setDialog($dialog);
}
}

View file

@ -1,85 +0,0 @@
<?php
final class PhabricatorRepositoryArcanistProjectEditController
extends PhabricatorRepositoryController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$project = id(new PhabricatorRepositoryArcanistProject())->load($this->id);
if (!$project) {
return new Aphront404Response();
}
$repositories = id(new PhabricatorRepositoryQuery())
->setViewer($user)
->execute();
$repos = array(
0 => 'None',
);
foreach ($repositories as $repository) {
$callsign = $repository->getCallsign();
$name = $repository->getname();
$repos[$repository->getID()] = "r{$callsign} ({$name})";
}
// note "None" will still be first thanks to 'r' prefix
asort($repos);
if ($request->isFormPost()) {
$repo_id = $request->getInt('repository', 0);
if (isset($repos[$repo_id])) {
$project->setRepositoryID($repo_id);
$project->save();
return id(new AphrontRedirectResponse())
->setURI('/repository/');
}
}
$form = id(new AphrontFormView())
->setUser($user)
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Name'))
->setValue($project->getName()))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('PHID')
->setValue($project->getPHID()))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Repository'))
->setOptions($repos)
->setName('repository')
->setValue($project->getRepositoryID()))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton('/repository/')
->setValue(pht('Save')));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Edit Arcanist Project'));
$panel->setForm($form);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Edit Project'));
return $this->buildApplicationPage(
array(
$crumbs,
$panel,
),
array(
'title' => pht('Edit Project'),
));
}
}

View file

@ -85,68 +85,6 @@ final class PhabricatorRepositoryListController
$panel->setHeader($header);
$panel->appendChild($table);
$projects = id(new PhabricatorRepositoryArcanistProject())->loadAll();
$rows = array();
foreach ($projects as $project) {
$repo = idx($repos, $project->getRepositoryID());
if ($repo) {
$repo_name = $repo->getName();
} else {
$repo_name = '-';
}
$rows[] = array(
$project->getName(),
$repo_name,
phutil_tag(
'a',
array(
'href' => '/repository/project/edit/'.$project->getID().'/',
'class' => 'button grey small',
),
pht('Edit')),
javelin_tag(
'a',
array(
'href' => '/repository/project/delete/'.$project->getID().'/',
'class' => 'button grey small',
'sigil' => 'workflow',
),
pht('Delete')),
);
}
$project_table = new AphrontTableView($rows);
$project_table->setNoDataString(pht('No Arcanist Projects'));
$project_table->setHeaders(
array(
pht('Project ID'),
pht('Repository'),
'',
'',
));
$project_table->setColumnClasses(
array(
'',
'wide',
'action',
'action',
));
$project_table->setColumnVisibility(
array(
true,
true,
$is_admin,
$is_admin,
));
$project_panel = new PHUIObjectBoxView();
$project_panel->setHeaderText(pht('Arcanist Projects'));
$project_panel->appendChild($project_table);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Repository List'));
@ -154,7 +92,6 @@ final class PhabricatorRepositoryListController
array(
$crumbs,
$panel,
$project_panel,
),
array(
'title' => pht('Repository List'),