Differential D13839 Diff 33428 src/applications/meta/controller/PhabricatorApplicationUninstallController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/meta/controller/PhabricatorApplicationUninstallController.php
<?php | <?php | ||||
final class PhabricatorApplicationUninstallController | final class PhabricatorApplicationUninstallController | ||||
extends PhabricatorApplicationsController { | extends PhabricatorApplicationsController { | ||||
private $application; | private $application; | ||||
private $action; | private $action; | ||||
public function willProcessRequest(array $data) { | public function handleRequest(AphrontRequest $request) { | ||||
$this->application = $data['application']; | $viewer = $request->getViewer(); | ||||
$this->action = $data['action']; | $this->action = $request->getURIData('action'); | ||||
} | $this->application = $request->getURIData('application'); | ||||
public function processRequest() { | |||||
$request = $this->getRequest(); | |||||
$user = $request->getUser(); | |||||
$selected = id(new PhabricatorApplicationQuery()) | $selected = id(new PhabricatorApplicationQuery()) | ||||
->setViewer($user) | ->setViewer($viewer) | ||||
->withClasses(array($this->application)) | ->withClasses(array($this->application)) | ||||
->requireCapabilities( | ->requireCapabilities( | ||||
array( | array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
)) | )) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$selected) { | if (!$selected) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
} | } | ||||
$view_uri = $this->getApplicationURI('view/'.$this->application); | $view_uri = $this->getApplicationURI('view/'.$this->application); | ||||
$prototypes_enabled = PhabricatorEnv::getEnvConfig( | $prototypes_enabled = PhabricatorEnv::getEnvConfig( | ||||
'phabricator.show-prototypes'); | 'phabricator.show-prototypes'); | ||||
$dialog = id(new AphrontDialogView()) | $dialog = id(new AphrontDialogView()) | ||||
->setUser($user) | ->setUser($viewer) | ||||
->addCancelButton($view_uri); | ->addCancelButton($view_uri); | ||||
if ($selected->isPrototype() && !$prototypes_enabled) { | if ($selected->isPrototype() && !$prototypes_enabled) { | ||||
$dialog | $dialog | ||||
->setTitle(pht('Prototypes Not Enabled')) | ->setTitle(pht('Prototypes Not Enabled')) | ||||
->appendChild( | ->appendChild( | ||||
pht( | pht( | ||||
'To manage prototypes, enable them by setting %s in your '. | 'To manage prototypes, enable them by setting %s in your '. | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | public function manageApplication() { | ||||
if (isset($uninstalled[$this->application])) { | if (isset($uninstalled[$this->application])) { | ||||
unset($list[$this->application]); | unset($list[$this->application]); | ||||
} else { | } else { | ||||
$list[$this->application] = true; | $list[$this->application] = true; | ||||
} | } | ||||
PhabricatorConfigEditor::storeNewValue( | PhabricatorConfigEditor::storeNewValue( | ||||
$this->getRequest()->getUser(), | $this->getViewer(), | ||||
$config_entry, | $config_entry, | ||||
$list, | $list, | ||||
PhabricatorContentSource::newFromRequest($this->getRequest())); | PhabricatorContentSource::newFromRequest($this->getRequest())); | ||||
} | } | ||||
} | } |