[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diffusion/controller/ -> DiffusionRepositoryEditDeleteController.php (source)

   1  <?php
   2  
   3  final class DiffusionRepositoryEditDeleteController
   4    extends DiffusionRepositoryEditController {
   5  
   6    public function processRequest() {
   7      $request = $this->getRequest();
   8      $viewer = $request->getUser();
   9      $drequest = $this->diffusionRequest;
  10      $repository = $drequest->getRepository();
  11  
  12      $repository = id(new PhabricatorRepositoryQuery())
  13        ->setViewer($viewer)
  14        ->requireCapabilities(
  15          array(
  16            PhabricatorPolicyCapability::CAN_VIEW,
  17            PhabricatorPolicyCapability::CAN_EDIT,
  18          ))
  19        ->withIDs(array($repository->getID()))
  20        ->executeOne();
  21      if (!$repository) {
  22        return new Aphront404Response();
  23      }
  24  
  25      $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
  26  
  27      $dialog = new AphrontDialogView();
  28      $text_1 = pht(
  29        'If you really want to delete the repository, run this command from '.
  30        'the command line:');
  31      $command = csprintf(
  32        'phabricator/ $ ./bin/remove destroy %R',
  33        $repository->getMonogram());
  34      $text_2 = pht('Repositories touch many objects and as such deletes are '.
  35                    'prohibitively expensive to run from the web UI.');
  36      $body = phutil_tag(
  37        'div',
  38        array(
  39          'class' => 'phabricator-remarkup',
  40        ),
  41        array(
  42          phutil_tag('p', array(), $text_1),
  43          phutil_tag('p', array(),
  44            phutil_tag('tt', array(), $command)),
  45          phutil_tag('p', array(), $text_2),
  46        ));
  47  
  48      $dialog = id(new AphrontDialogView())
  49        ->setUser($request->getUser())
  50        ->setTitle(pht('Really want to delete the repository?'))
  51        ->appendChild($body)
  52        ->addCancelButton($edit_uri, pht('Okay'));
  53  
  54      return id(new AphrontDialogResponse())->setDialog($dialog);
  55    }
  56  
  57  
  58  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1