2011-05-05 21:53:39 +02:00
|
|
|
<?php
|
|
|
|
|
2013-10-29 20:26:07 +01:00
|
|
|
final class DiffusionRepositoryEditDeleteController
|
|
|
|
extends DiffusionRepositoryEditController {
|
2011-05-05 21:53:39 +02:00
|
|
|
|
|
|
|
public function processRequest() {
|
2013-10-29 20:26:07 +01:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$viewer = $request->getUser();
|
|
|
|
$drequest = $this->diffusionRequest;
|
|
|
|
$repository = $drequest->getRepository();
|
2011-05-05 21:53:39 +02:00
|
|
|
|
2013-09-26 01:54:48 +02:00
|
|
|
$repository = id(new PhabricatorRepositoryQuery())
|
|
|
|
->setViewer($viewer)
|
2013-10-29 20:26:07 +01:00
|
|
|
->requireCapabilities(
|
|
|
|
array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT,
|
|
|
|
))
|
|
|
|
->withIDs(array($repository->getID()))
|
2013-09-26 01:54:48 +02:00
|
|
|
->executeOne();
|
2011-05-05 21:53:39 +02:00
|
|
|
if (!$repository) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
2013-10-29 20:26:07 +01:00
|
|
|
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
2011-05-05 21:53:39 +02:00
|
|
|
|
|
|
|
$dialog = new AphrontDialogView();
|
2013-10-29 20:26:07 +01:00
|
|
|
$text_1 = pht(
|
|
|
|
'If you really want to delete the repository, run this command from '.
|
|
|
|
'the command line:');
|
|
|
|
$command = csprintf(
|
2014-06-03 02:11:58 +02:00
|
|
|
'phabricator/ $ ./bin/remove destroy %s',
|
2013-10-29 20:26:07 +01:00
|
|
|
$repository->getCallsign());
|
2012-10-26 01:23:41 +02:00
|
|
|
$text_2 = pht('Repositories touch many objects and as such deletes are '.
|
|
|
|
'prohibitively expensive to run from the web UI.');
|
2013-01-25 14:50:50 +01:00
|
|
|
$body = phutil_tag(
|
2012-10-26 01:23:41 +02:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-remarkup',
|
|
|
|
),
|
2013-01-25 14:50:50 +01:00
|
|
|
array(
|
|
|
|
phutil_tag('p', array(), $text_1),
|
|
|
|
phutil_tag('p', array(),
|
|
|
|
phutil_tag('tt', array(), $command)),
|
|
|
|
phutil_tag('p', array(), $text_2),
|
|
|
|
));
|
|
|
|
|
2013-10-29 20:26:07 +01:00
|
|
|
$dialog = id(new AphrontDialogView())
|
2011-05-05 21:53:39 +02:00
|
|
|
->setUser($request->getUser())
|
2012-10-26 01:23:41 +02:00
|
|
|
->setTitle(pht('Really want to delete the repository?'))
|
|
|
|
->appendChild($body)
|
2013-10-29 20:26:07 +01:00
|
|
|
->addCancelButton($edit_uri, pht('Okay'));
|
2011-05-05 21:53:39 +02:00
|
|
|
|
|
|
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
|
|
}
|
2013-10-29 20:26:07 +01:00
|
|
|
|
|
|
|
|
2011-05-05 21:53:39 +02:00
|
|
|
}
|