2011-05-05 12:53:39 -07:00
|
|
|
<?php
|
|
|
|
|
|
2012-03-09 15:46:25 -08:00
|
|
|
final class PhabricatorRepositoryDeleteController
|
2011-05-05 12:53:39 -07:00
|
|
|
extends PhabricatorRepositoryController {
|
|
|
|
|
|
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
|
$this->id = $data['id'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
|
|
|
|
|
$repository = id(new PhabricatorRepository())->load($this->id);
|
|
|
|
|
if (!$repository) {
|
|
|
|
|
return new Aphront404Response();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
|
|
|
|
|
if ($request->isDialogFormPost()) {
|
|
|
|
|
return id(new AphrontRedirectResponse())->setURI('/repository/');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$dialog = new AphrontDialogView();
|
2012-10-25 16:23:41 -07:00
|
|
|
$text_1 = pht('If you really want to delete the repository, you must run:');
|
|
|
|
|
$command = 'bin/repository delete '.
|
|
|
|
|
phutil_escape_html($repository->getCallsign());
|
|
|
|
|
$text_2 = pht('Repositories touch many objects and as such deletes are '.
|
|
|
|
|
'prohibitively expensive to run from the web UI.');
|
|
|
|
|
$body = phutil_render_tag(
|
|
|
|
|
'div',
|
|
|
|
|
array(
|
|
|
|
|
'class' => 'phabricator-remarkup',
|
|
|
|
|
),
|
|
|
|
|
'<p>'.$text_1.'</p><p><tt>'.$command.'</tt></p><p>'.$text_2.'</p>');
|
2011-05-05 12:53:39 -07:00
|
|
|
$dialog
|
|
|
|
|
->setUser($request->getUser())
|
2012-10-25 16:23:41 -07:00
|
|
|
->setTitle(pht('Really want to delete the repository?'))
|
|
|
|
|
->appendChild($body)
|
2011-05-05 12:53:39 -07:00
|
|
|
->setSubmitURI('/repository/delete/'.$this->id.'/')
|
2012-10-25 16:23:41 -07:00
|
|
|
->addSubmitButton(pht('Okay'));
|
2011-05-05 12:53:39 -07:00
|
|
|
|
|
|
|
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
|
|
|
}
|
|
|
|
|
}
|