mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 22:40:55 +01:00
Update Config app for handleRequest
Summary: Update all found callsites in Config. Test Plan: Check setup issues, databases, edit a value, remove a warning, everything I could click on. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T8628 Differential Revision: https://secure.phabricator.com/D13727
This commit is contained in:
parent
6fb43305be
commit
564aa2c4ba
11 changed files with 58 additions and 90 deletions
|
@ -3,9 +3,8 @@
|
|||
final class PhabricatorConfigAllController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$db_values = id(new PhabricatorConfigEntry())
|
||||
->loadAllWhere('namespace = %s', 'default');
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
final class PhabricatorConfigDatabaseIssueController
|
||||
extends PhabricatorConfigDatabaseController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$query = $this->buildSchemaQuery();
|
||||
|
||||
|
|
|
@ -8,16 +8,12 @@ final class PhabricatorConfigDatabaseStatusController
|
|||
private $column;
|
||||
private $key;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->database = idx($data, 'database');
|
||||
$this->table = idx($data, 'table');
|
||||
$this->column = idx($data, 'column');
|
||||
$this->key = idx($data, 'key');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$this->database = $request->getURIData('database');
|
||||
$this->table = $request->getURIData('table');
|
||||
$this->column = $request->getURIData('column');
|
||||
$this->key = $request->getURIData('key');
|
||||
|
||||
$query = $this->buildSchemaQuery();
|
||||
|
||||
|
|
|
@ -3,25 +3,19 @@
|
|||
final class PhabricatorConfigEditController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
private $key;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->key = $data['key'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$key = $request->getURIData('key');
|
||||
|
||||
|
||||
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
|
||||
if (empty($options[$this->key])) {
|
||||
if (empty($options[$key])) {
|
||||
$ancient = PhabricatorExtraConfigSetupCheck::getAncientConfig();
|
||||
if (isset($ancient[$this->key])) {
|
||||
if (isset($ancient[$key])) {
|
||||
$desc = pht(
|
||||
"This configuration has been removed. You can safely delete ".
|
||||
"it.\n\n%s",
|
||||
$ancient[$this->key]);
|
||||
$ancient[$key]);
|
||||
} else {
|
||||
$desc = pht(
|
||||
'This configuration option is unknown. It may be misspelled, '.
|
||||
|
@ -32,14 +26,14 @@ final class PhabricatorConfigEditController
|
|||
// longer exists. Allow it to be edited so it can be reviewed and
|
||||
// deleted.
|
||||
$option = id(new PhabricatorConfigOption())
|
||||
->setKey($this->key)
|
||||
->setKey($key)
|
||||
->setType('wild')
|
||||
->setDefault(null)
|
||||
->setDescription($desc);
|
||||
$group = null;
|
||||
$group_uri = $this->getApplicationURI();
|
||||
} else {
|
||||
$option = $options[$this->key];
|
||||
$option = $options[$key];
|
||||
$group = $option->getGroup();
|
||||
$group_uri = $this->getApplicationURI('group/'.$group->getKey().'/');
|
||||
}
|
||||
|
@ -57,11 +51,11 @@ final class PhabricatorConfigEditController
|
|||
$config_entry = id(new PhabricatorConfigEntry())
|
||||
->loadOneWhere(
|
||||
'configKey = %s AND namespace = %s',
|
||||
$this->key,
|
||||
$key,
|
||||
'default');
|
||||
if (!$config_entry) {
|
||||
$config_entry = id(new PhabricatorConfigEntry())
|
||||
->setConfigKey($this->key)
|
||||
->setConfigKey($key)
|
||||
->setNamespace('default')
|
||||
->setIsDeleted(true);
|
||||
$config_entry->setPHID($config_entry->generatePHID());
|
||||
|
@ -81,7 +75,7 @@ final class PhabricatorConfigEditController
|
|||
if (!$errors) {
|
||||
|
||||
$editor = id(new PhabricatorConfigEditor())
|
||||
->setActor($user)
|
||||
->setActor($viewer)
|
||||
->setContinueOnNoEffect(true)
|
||||
->setContentSourceFromRequest($request);
|
||||
|
||||
|
@ -138,7 +132,7 @@ final class PhabricatorConfigEditController
|
|||
}
|
||||
|
||||
$engine = new PhabricatorMarkupEngine();
|
||||
$engine->setViewer($user);
|
||||
$engine->setViewer($viewer);
|
||||
$engine->addObject($option, 'description');
|
||||
$engine->process();
|
||||
$description = phutil_tag(
|
||||
|
@ -149,7 +143,7 @@ final class PhabricatorConfigEditController
|
|||
$engine->getOutput($option, 'description'));
|
||||
|
||||
$form
|
||||
->setUser($user)
|
||||
->setUser($viewer)
|
||||
->addHiddenInput('issue', $request->getStr('issue'))
|
||||
->appendChild(
|
||||
id(new AphrontFormMarkupControl())
|
||||
|
@ -194,7 +188,7 @@ final class PhabricatorConfigEditController
|
|||
->setValue($this->renderDefaults($option, $config_entry)));
|
||||
}
|
||||
|
||||
$title = pht('Edit %s', $this->key);
|
||||
$title = pht('Edit %s', $key);
|
||||
$short = pht('Edit');
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
|
@ -212,7 +206,7 @@ final class PhabricatorConfigEditController
|
|||
$crumbs->addTextCrumb($group->getName(), $group_uri);
|
||||
}
|
||||
|
||||
$crumbs->addTextCrumb($this->key, '/config/edit/'.$this->key);
|
||||
$crumbs->addTextCrumb($key, '/config/edit/'.$key);
|
||||
|
||||
$timeline = $this->buildTransactionTimeline(
|
||||
$config_entry,
|
||||
|
|
|
@ -3,18 +3,12 @@
|
|||
final class PhabricatorConfigGroupController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
private $groupKey;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->groupKey = $data['key'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$group_key = $request->getURIData('key');
|
||||
|
||||
$groups = PhabricatorApplicationConfigOptions::loadAll();
|
||||
$options = idx($groups, $this->groupKey);
|
||||
$options = idx($groups, $group_key);
|
||||
if (!$options) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
final class PhabricatorConfigHistoryController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$id = $request->getURIData('id');
|
||||
|
||||
$xactions = id(new PhabricatorConfigTransactionQuery())
|
||||
->setViewer($user)
|
||||
->setViewer($viewer)
|
||||
->needComments(true)
|
||||
->execute();
|
||||
|
||||
|
@ -19,7 +19,7 @@ final class PhabricatorConfigHistoryController
|
|||
$view = $xaction->getApplicationTransactionViewObject();
|
||||
|
||||
$timeline = $view
|
||||
->setUser($user)
|
||||
->setUser($viewer)
|
||||
->setTransactions($xactions)
|
||||
->setRenderAsFeed(true)
|
||||
->setObjectPHID(PhabricatorPHIDConstants::PHID_VOID);
|
||||
|
|
|
@ -3,38 +3,33 @@
|
|||
final class PhabricatorConfigIgnoreController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
private $verb;
|
||||
private $issue;
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$issue = $request->getURIData('key');
|
||||
$verb = $request->getURIData('verb');
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->verb = $data['verb'];
|
||||
$this->issue = $data['key'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$issue_uri = $this->getApplicationURI('issue/'.$this->issue.'/');
|
||||
$issue_uri = $this->getApplicationURI('issue/'.$issue.'/');
|
||||
|
||||
if ($request->isDialogFormPost()) {
|
||||
$this->manageApplication();
|
||||
$this->manageApplication($issue);
|
||||
return id(new AphrontRedirectResponse())->setURI($issue_uri);
|
||||
}
|
||||
|
||||
if ($this->verb == 'ignore') {
|
||||
if ($verb == 'ignore') {
|
||||
$title = pht('Really ignore this setup issue?');
|
||||
$submit_title = pht('Ignore');
|
||||
$body = pht(
|
||||
"You can ignore an issue if you don't want to fix it, or plan to ".
|
||||
"fix it later. Ignored issues won't appear on every page but will ".
|
||||
"still be shown in the list of open issues.");
|
||||
} else if ($this->verb == 'unignore') {
|
||||
} else if ($verb == 'unignore') {
|
||||
$title = pht('Unignore this setup issue?');
|
||||
$submit_title = pht('Unignore');
|
||||
$body = pht(
|
||||
'This issue will no longer be suppressed, and will return to its '.
|
||||
'rightful place as a global setup warning.');
|
||||
} else {
|
||||
throw new Exception(pht('Unrecognized verb: %s', $this->verb));
|
||||
throw new Exception(pht('Unrecognized verb: %s', $verb));
|
||||
}
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
|
@ -47,15 +42,15 @@ final class PhabricatorConfigIgnoreController
|
|||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
||||
public function manageApplication() {
|
||||
public function manageApplication($issue) {
|
||||
$key = 'config.ignore-issues';
|
||||
$config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
|
||||
$list = $config_entry->getValue();
|
||||
|
||||
if (isset($list[$this->issue])) {
|
||||
unset($list[$this->issue]);
|
||||
if (isset($list[$issue])) {
|
||||
unset($list[$issue]);
|
||||
} else {
|
||||
$list[$this->issue] = true;
|
||||
$list[$issue] = true;
|
||||
}
|
||||
|
||||
PhabricatorConfigEditor::storeNewValue(
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
final class PhabricatorConfigIssueListController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('issue/');
|
||||
|
|
|
@ -3,21 +3,15 @@
|
|||
final class PhabricatorConfigIssueViewController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
private $issueKey;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->issueKey = $data['key'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
$issue_key = $request->getURIData('key');
|
||||
|
||||
$issues = PhabricatorSetupCheck::runAllChecks();
|
||||
PhabricatorSetupCheck::setOpenSetupIssueKeys(
|
||||
PhabricatorSetupCheck::getUnignoredIssueKeys($issues));
|
||||
|
||||
if (empty($issues[$this->issueKey])) {
|
||||
if (empty($issues[$issue_key])) {
|
||||
$content = id(new PHUIInfoView())
|
||||
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
||||
->setTitle(pht('Issue Resolved'))
|
||||
|
@ -31,7 +25,7 @@ final class PhabricatorConfigIssueViewController
|
|||
pht('Return to Open Issue List')));
|
||||
$title = pht('Resolved Issue');
|
||||
} else {
|
||||
$issue = $issues[$this->issueKey];
|
||||
$issue = $issues[$issue_key];
|
||||
$content = $this->renderIssue($issue);
|
||||
$title = $issue->getShortName();
|
||||
}
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
final class PhabricatorConfigListController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('/');
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
final class PhabricatorConfigWelcomeController
|
||||
extends PhabricatorConfigController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('welcome/');
|
||||
|
|
Loading…
Reference in a new issue