Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/config/controller/PhabricatorConfigAllController.php b/src/applications/config/controller/PhabricatorConfigAllController.php
index 309304ed21..17bf65fd7b 100644
--- a/src/applications/config/controller/PhabricatorConfigAllController.php
+++ b/src/applications/config/controller/PhabricatorConfigAllController.php
@@ -1,135 +1,134 @@
<?php
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');
$db_values = mpull($db_values, null, 'getConfigKey');
$rows = array();
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
ksort($options);
foreach ($options as $option) {
$key = $option->getKey();
if ($option->getHidden()) {
$value = phutil_tag('em', array(), pht('Hidden'));
} else {
$value = PhabricatorEnv::getEnvConfig($key);
$value = PhabricatorConfigJSON::prettyPrintJSON($value);
}
$db_value = idx($db_values, $key);
$rows[] = array(
phutil_tag(
'a',
array(
'href' => $this->getApplicationURI('edit/'.$key.'/'),
),
$key),
$value,
$db_value && !$db_value->getIsDeleted() ? pht('Customized') : '',
);
}
$table = id(new AphrontTableView($rows))
->setColumnClasses(
array(
'',
'wide',
))
->setHeaders(
array(
pht('Key'),
pht('Value'),
pht('Customized'),
));
$title = pht('Current Settings');
$crumbs = $this
->buildApplicationCrumbs()
->addTextCrumb($title);
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Current Settings'));
$panel->setTable($table);
$versions = $this->loadVersions();
$version_property_list = id(new PHUIPropertyListView());
foreach ($versions as $version) {
list($name, $hash) = $version;
$version_property_list->addProperty($name, $hash);
}
$object_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Current Version'))
->addPropertyList($version_property_list);
$phabricator_root = dirname(phutil_get_library_root('phabricator'));
$version_path = $phabricator_root.'/conf/local/VERSION';
if (Filesystem::pathExists($version_path)) {
$version_from_file = Filesystem::readFile($version_path);
$version_property_list->addProperty(
pht('Local Version'),
$version_from_file);
}
$nav = $this->buildSideNavView();
$nav->selectFilter('all/');
$nav->setCrumbs($crumbs);
$nav->appendChild($object_box);
$nav->appendChild($panel);
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
}
private function loadVersions() {
$specs = array(
array(
'name' => pht('Phabricator Version'),
'root' => 'phabricator',
),
array(
'name' => pht('Arcanist Version'),
'root' => 'arcanist',
),
array(
'name' => pht('libphutil Version'),
'root' => 'phutil',
),
);
$futures = array();
foreach ($specs as $key => $spec) {
$root = dirname(phutil_get_library_root($spec['root']));
$futures[$key] = id(new ExecFuture('git log --format=%%H -n 1 --'))
->setCWD($root);
}
$results = array();
foreach ($futures as $key => $future) {
list($err, $stdout) = $future->resolve();
if (!$err) {
$name = trim($stdout);
} else {
$name = pht('Unknown');
}
$results[$key] = array($specs[$key]['name'], $name);
}
return array_select_keys($results, array_keys($specs));
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php b/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php
index 252d8a73de..22df5104e4 100644
--- a/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php
+++ b/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php
@@ -1,170 +1,169 @@
<?php
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();
$actual = $query->loadActualSchema();
$expect = $query->loadExpectedSchema();
$comp = $query->buildComparisonSchema($expect, $actual);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Database Issues'));
// Collect all open issues.
$issues = array();
foreach ($comp->getDatabases() as $database_name => $database) {
foreach ($database->getLocalIssues() as $issue) {
$issues[] = array(
$database_name,
null,
null,
null,
$issue,
);
}
foreach ($database->getTables() as $table_name => $table) {
foreach ($table->getLocalIssues() as $issue) {
$issues[] = array(
$database_name,
$table_name,
null,
null,
$issue,
);
}
foreach ($table->getColumns() as $column_name => $column) {
foreach ($column->getLocalIssues() as $issue) {
$issues[] = array(
$database_name,
$table_name,
'column',
$column_name,
$issue,
);
}
}
foreach ($table->getKeys() as $key_name => $key) {
foreach ($key->getLocalIssues() as $issue) {
$issues[] = array(
$database_name,
$table_name,
'key',
$key_name,
$issue,
);
}
}
}
}
// Sort all open issues so that the most severe issues appear first.
$order = array();
$counts = array();
foreach ($issues as $key => $issue) {
$const = $issue[4];
$status = PhabricatorConfigStorageSchema::getIssueStatus($const);
$severity = PhabricatorConfigStorageSchema::getStatusSeverity($status);
$order[$key] = sprintf(
'~%d~%s%s%s',
9 - $severity,
$issue[0],
$issue[1],
$issue[3]);
if (empty($counts[$status])) {
$counts[$status] = 0;
}
$counts[$status]++;
}
asort($order);
$issues = array_select_keys($issues, array_keys($order));
// Render the issues.
$rows = array();
foreach ($issues as $issue) {
$const = $issue[4];
$database_link = phutil_tag(
'a',
array(
'href' => $this->getApplicationURI('/database/'.$issue[0].'/'),
),
$issue[0]);
$rows[] = array(
$this->renderIcon(
PhabricatorConfigStorageSchema::getIssueStatus($const)),
$database_link,
$issue[1],
$issue[2],
$issue[3],
PhabricatorConfigStorageSchema::getIssueDescription($const),
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(
array(
null,
pht('Database'),
pht('Table'),
pht('Type'),
pht('Column/Key'),
pht('Issue'),
))
->setColumnClasses(
array(
null,
null,
null,
null,
null,
'wide',
));
$errors = array();
if (isset($counts[PhabricatorConfigStorageSchema::STATUS_FAIL])) {
$errors[] = pht(
'Detected %s serious issue(s) with the schemata.',
new PhutilNumber($counts[PhabricatorConfigStorageSchema::STATUS_FAIL]));
}
if (isset($counts[PhabricatorConfigStorageSchema::STATUS_WARN])) {
$errors[] = pht(
'Detected %s warning(s) with the schemata.',
new PhutilNumber($counts[PhabricatorConfigStorageSchema::STATUS_WARN]));
}
$title = pht('Database Issues');
$table_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderWithDocumentationLink($title))
->setFormErrors($errors)
->setTable($table);
$nav = $this->buildSideNavView();
$nav->selectFilter('dbissue/');
$nav->appendChild(
array(
$crumbs,
$table_box,
));
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigDatabaseStatusController.php b/src/applications/config/controller/PhabricatorConfigDatabaseStatusController.php
index f69e794fb8..d886e98d74 100644
--- a/src/applications/config/controller/PhabricatorConfigDatabaseStatusController.php
+++ b/src/applications/config/controller/PhabricatorConfigDatabaseStatusController.php
@@ -1,768 +1,764 @@
<?php
final class PhabricatorConfigDatabaseStatusController
extends PhabricatorConfigDatabaseController {
private $database;
private $table;
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();
$actual = $query->loadActualSchema();
$expect = $query->loadExpectedSchema();
$comp = $query->buildComparisonSchema($expect, $actual);
if ($this->column) {
return $this->renderColumn(
$comp,
$expect,
$actual,
$this->database,
$this->table,
$this->column);
} else if ($this->key) {
return $this->renderKey(
$comp,
$expect,
$actual,
$this->database,
$this->table,
$this->key);
} else if ($this->table) {
return $this->renderTable(
$comp,
$expect,
$actual,
$this->database,
$this->table);
} else if ($this->database) {
return $this->renderDatabase(
$comp,
$expect,
$actual,
$this->database);
} else {
return $this->renderServer(
$comp,
$expect,
$actual);
}
}
private function buildResponse($title, $body) {
$nav = $this->buildSideNavView();
$nav->selectFilter('database/');
$crumbs = $this->buildApplicationCrumbs();
if ($this->database) {
$crumbs->addTextCrumb(
pht('Database Status'),
$this->getApplicationURI('database/'));
if ($this->table) {
$crumbs->addTextCrumb(
$this->database,
$this->getApplicationURI('database/'.$this->database.'/'));
if ($this->column || $this->key) {
$crumbs->addTextCrumb(
$this->table,
$this->getApplicationURI(
'database/'.$this->database.'/'.$this->table.'/'));
if ($this->column) {
$crumbs->addTextCrumb($this->column);
} else {
$crumbs->addTextCrumb($this->key);
}
} else {
$crumbs->addTextCrumb($this->table);
}
} else {
$crumbs->addTextCrumb($this->database);
}
} else {
$crumbs->addTextCrumb(pht('Database Status'));
}
$nav->setCrumbs($crumbs);
$nav->appendChild($body);
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
}
private function renderServer(
PhabricatorConfigServerSchema $comp,
PhabricatorConfigServerSchema $expect,
PhabricatorConfigServerSchema $actual) {
$charset_issue = PhabricatorConfigStorageSchema::ISSUE_CHARSET;
$collation_issue = PhabricatorConfigStorageSchema::ISSUE_COLLATION;
$rows = array();
foreach ($comp->getDatabases() as $database_name => $database) {
$actual_database = $actual->getDatabase($database_name);
if ($actual_database) {
$charset = $actual_database->getCharacterSet();
$collation = $actual_database->getCollation();
} else {
$charset = null;
$collation = null;
}
$status = $database->getStatus();
$issues = $database->getIssues();
$rows[] = array(
$this->renderIcon($status),
phutil_tag(
'a',
array(
'href' => $this->getApplicationURI(
'/database/'.$database_name.'/'),
),
$database_name),
$this->renderAttr($charset, $database->hasIssue($charset_issue)),
$this->renderAttr($collation, $database->hasIssue($collation_issue)),
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(
array(
null,
pht('Database'),
pht('Charset'),
pht('Collation'),
))
->setColumnClasses(
array(
null,
'wide pri',
null,
null,
));
$title = pht('Database Status');
$properties = $this->buildProperties(
array(
),
$comp->getIssues());
$prop_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderWithDocumentationLink($title))
->addPropertyList($properties);
$table_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Databases'))
->setTable($table);
return $this->buildResponse($title, array($prop_box, $table_box));
}
private function renderDatabase(
PhabricatorConfigServerSchema $comp,
PhabricatorConfigServerSchema $expect,
PhabricatorConfigServerSchema $actual,
$database_name) {
$collation_issue = PhabricatorConfigStorageSchema::ISSUE_COLLATION;
$database = $comp->getDatabase($database_name);
if (!$database) {
return new Aphront404Response();
}
$rows = array();
foreach ($database->getTables() as $table_name => $table) {
$status = $table->getStatus();
$rows[] = array(
$this->renderIcon($status),
phutil_tag(
'a',
array(
'href' => $this->getApplicationURI(
'/database/'.$database_name.'/'.$table_name.'/'),
),
$table_name),
$this->renderAttr(
$table->getCollation(),
$table->hasIssue($collation_issue)),
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(
array(
null,
pht('Table'),
pht('Collation'),
))
->setColumnClasses(
array(
null,
'wide pri',
null,
));
$title = pht('Database: %s', $database_name);
$actual_database = $actual->getDatabase($database_name);
if ($actual_database) {
$actual_charset = $actual_database->getCharacterSet();
$actual_collation = $actual_database->getCollation();
} else {
$actual_charset = null;
$actual_collation = null;
}
$expect_database = $expect->getDatabase($database_name);
if ($expect_database) {
$expect_charset = $expect_database->getCharacterSet();
$expect_collation = $expect_database->getCollation();
} else {
$expect_charset = null;
$expect_collation = null;
}
$properties = $this->buildProperties(
array(
array(
pht('Character Set'),
$actual_charset,
),
array(
pht('Expected Character Set'),
$expect_charset,
),
array(
pht('Collation'),
$actual_collation,
),
array(
pht('Expected Collation'),
$expect_collation,
),
),
$database->getIssues());
$prop_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderWithDocumentationLink($title))
->addPropertyList($properties);
$table_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Database Status'))
->setTable($table);
return $this->buildResponse($title, array($prop_box, $table_box));
}
private function renderTable(
PhabricatorConfigServerSchema $comp,
PhabricatorConfigServerSchema $expect,
PhabricatorConfigServerSchema $actual,
$database_name,
$table_name) {
$type_issue = PhabricatorConfigStorageSchema::ISSUE_COLUMNTYPE;
$charset_issue = PhabricatorConfigStorageSchema::ISSUE_CHARSET;
$collation_issue = PhabricatorConfigStorageSchema::ISSUE_COLLATION;
$nullable_issue = PhabricatorConfigStorageSchema::ISSUE_NULLABLE;
$unique_issue = PhabricatorConfigStorageSchema::ISSUE_UNIQUE;
$columns_issue = PhabricatorConfigStorageSchema::ISSUE_KEYCOLUMNS;
$longkey_issue = PhabricatorConfigStorageSchema::ISSUE_LONGKEY;
$auto_issue = PhabricatorConfigStorageSchema::ISSUE_AUTOINCREMENT;
$database = $comp->getDatabase($database_name);
if (!$database) {
return new Aphront404Response();
}
$table = $database->getTable($table_name);
if (!$table) {
return new Aphront404Response();
}
$actual_database = $actual->getDatabase($database_name);
$actual_table = null;
if ($actual_database) {
$actual_table = $actual_database->getTable($table_name);
}
$expect_database = $expect->getDatabase($database_name);
$expect_table = null;
if ($expect_database) {
$expect_table = $expect_database->getTable($table_name);
}
$rows = array();
foreach ($table->getColumns() as $column_name => $column) {
$expect_column = null;
if ($expect_table) {
$expect_column = $expect_table->getColumn($column_name);
}
$status = $column->getStatus();
$data_type = null;
if ($expect_column) {
$data_type = $expect_column->getDataType();
}
$rows[] = array(
$this->renderIcon($status),
phutil_tag(
'a',
array(
'href' => $this->getApplicationURI(
'database/'.
$database_name.'/'.
$table_name.'/'.
'col/'.
$column_name.'/'),
),
$column_name),
$data_type,
$this->renderAttr(
$column->getColumnType(),
$column->hasIssue($type_issue)),
$this->renderAttr(
$this->renderBoolean($column->getNullable()),
$column->hasIssue($nullable_issue)),
$this->renderAttr(
$this->renderBoolean($column->getAutoIncrement()),
$column->hasIssue($auto_issue)),
$this->renderAttr(
$column->getCharacterSet(),
$column->hasIssue($charset_issue)),
$this->renderAttr(
$column->getCollation(),
$column->hasIssue($collation_issue)),
);
}
$table_view = id(new AphrontTableView($rows))
->setHeaders(
array(
null,
pht('Column'),
pht('Data Type'),
pht('Column Type'),
pht('Nullable'),
pht('Autoincrement'),
pht('Character Set'),
pht('Collation'),
))
->setColumnClasses(
array(
null,
'wide pri',
null,
null,
null,
null,
null,
));
$key_rows = array();
foreach ($table->getKeys() as $key_name => $key) {
$expect_key = null;
if ($expect_table) {
$expect_key = $expect_table->getKey($key_name);
}
$status = $key->getStatus();
$size = 0;
foreach ($key->getColumnNames() as $column_spec) {
list($column_name, $prefix) = $key->getKeyColumnAndPrefix($column_spec);
$column = $table->getColumn($column_name);
if (!$column) {
$size = 0;
break;
}
$size += $column->getKeyByteLength($prefix);
}
$size_formatted = null;
if ($size) {
$size_formatted = $this->renderAttr(
$size,
$key->hasIssue($longkey_issue));
}
$key_rows[] = array(
$this->renderIcon($status),
phutil_tag(
'a',
array(
'href' => $this->getApplicationURI(
'database/'.
$database_name.'/'.
$table_name.'/'.
'key/'.
$key_name.'/'),
),
$key_name),
$this->renderAttr(
implode(', ', $key->getColumnNames()),
$key->hasIssue($columns_issue)),
$this->renderAttr(
$this->renderBoolean($key->getUnique()),
$key->hasIssue($unique_issue)),
$size_formatted,
);
}
$keys_view = id(new AphrontTableView($key_rows))
->setHeaders(
array(
null,
pht('Key'),
pht('Columns'),
pht('Unique'),
pht('Size'),
))
->setColumnClasses(
array(
null,
'wide pri',
null,
null,
null,
));
$title = pht('Database: %s.%s', $database_name, $table_name);
if ($actual_table) {
$actual_collation = $actual_table->getCollation();
} else {
$actual_collation = null;
}
if ($expect_table) {
$expect_collation = $expect_table->getCollation();
} else {
$expect_collation = null;
}
$properties = $this->buildProperties(
array(
array(
pht('Collation'),
$actual_collation,
),
array(
pht('Expected Collation'),
$expect_collation,
),
),
$table->getIssues());
$prop_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderWithDocumentationLink($title))
->addPropertyList($properties);
$table_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Database'))
->setTable($table_view);
$key_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Keys'))
->setTable($keys_view);
return $this->buildResponse($title, array($prop_box, $table_box, $key_box));
}
private function renderColumn(
PhabricatorConfigServerSchema $comp,
PhabricatorConfigServerSchema $expect,
PhabricatorConfigServerSchema $actual,
$database_name,
$table_name,
$column_name) {
$database = $comp->getDatabase($database_name);
if (!$database) {
return new Aphront404Response();
}
$table = $database->getTable($table_name);
if (!$table) {
return new Aphront404Response();
}
$column = $table->getColumn($column_name);
if (!$column) {
return new Aphront404Response();
}
$actual_database = $actual->getDatabase($database_name);
$actual_table = null;
$actual_column = null;
if ($actual_database) {
$actual_table = $actual_database->getTable($table_name);
if ($actual_table) {
$actual_column = $actual_table->getColumn($column_name);
}
}
$expect_database = $expect->getDatabase($database_name);
$expect_table = null;
$expect_column = null;
if ($expect_database) {
$expect_table = $expect_database->getTable($table_name);
if ($expect_table) {
$expect_column = $expect_table->getColumn($column_name);
}
}
if ($actual_column) {
$actual_coltype = $actual_column->getColumnType();
$actual_charset = $actual_column->getCharacterSet();
$actual_collation = $actual_column->getCollation();
$actual_nullable = $actual_column->getNullable();
$actual_auto = $actual_column->getAutoIncrement();
} else {
$actual_coltype = null;
$actual_charset = null;
$actual_collation = null;
$actual_nullable = null;
$actual_auto = null;
}
if ($expect_column) {
$data_type = $expect_column->getDataType();
$expect_coltype = $expect_column->getColumnType();
$expect_charset = $expect_column->getCharacterSet();
$expect_collation = $expect_column->getCollation();
$expect_nullable = $expect_column->getNullable();
$expect_auto = $expect_column->getAutoIncrement();
} else {
$data_type = null;
$expect_coltype = null;
$expect_charset = null;
$expect_collation = null;
$expect_nullable = null;
$expect_auto = null;
}
$title = pht(
'Database Status: %s.%s.%s',
$database_name,
$table_name,
$column_name);
$properties = $this->buildProperties(
array(
array(
pht('Data Type'),
$data_type,
),
array(
pht('Column Type'),
$actual_coltype,
),
array(
pht('Expected Column Type'),
$expect_coltype,
),
array(
pht('Character Set'),
$actual_charset,
),
array(
pht('Expected Character Set'),
$expect_charset,
),
array(
pht('Collation'),
$actual_collation,
),
array(
pht('Expected Collation'),
$expect_collation,
),
array(
pht('Nullable'),
$this->renderBoolean($actual_nullable),
),
array(
pht('Expected Nullable'),
$this->renderBoolean($expect_nullable),
),
array(
pht('Autoincrement'),
$this->renderBoolean($actual_auto),
),
array(
pht('Expected Autoincrement'),
$this->renderBoolean($expect_auto),
),
),
$column->getIssues());
$box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderWithDocumentationLink($title))
->addPropertyList($properties);
return $this->buildResponse($title, $box);
}
private function renderKey(
PhabricatorConfigServerSchema $comp,
PhabricatorConfigServerSchema $expect,
PhabricatorConfigServerSchema $actual,
$database_name,
$table_name,
$key_name) {
$database = $comp->getDatabase($database_name);
if (!$database) {
return new Aphront404Response();
}
$table = $database->getTable($table_name);
if (!$table) {
return new Aphront404Response();
}
$key = $table->getKey($key_name);
if (!$key) {
return new Aphront404Response();
}
$actual_database = $actual->getDatabase($database_name);
$actual_table = null;
$actual_key = null;
if ($actual_database) {
$actual_table = $actual_database->getTable($table_name);
if ($actual_table) {
$actual_key = $actual_table->getKey($key_name);
}
}
$expect_database = $expect->getDatabase($database_name);
$expect_table = null;
$expect_key = null;
if ($expect_database) {
$expect_table = $expect_database->getTable($table_name);
if ($expect_table) {
$expect_key = $expect_table->getKey($key_name);
}
}
if ($actual_key) {
$actual_columns = $actual_key->getColumnNames();
$actual_unique = $actual_key->getUnique();
} else {
$actual_columns = array();
$actual_unique = null;
}
if ($expect_key) {
$expect_columns = $expect_key->getColumnNames();
$expect_unique = $expect_key->getUnique();
} else {
$expect_columns = array();
$expect_unique = null;
}
$title = pht(
'Database Status: %s.%s (%s)',
$database_name,
$table_name,
$key_name);
$properties = $this->buildProperties(
array(
array(
pht('Unique'),
$this->renderBoolean($actual_unique),
),
array(
pht('Expected Unique'),
$this->renderBoolean($expect_unique),
),
array(
pht('Columns'),
implode(', ', $actual_columns),
),
array(
pht('Expected Columns'),
implode(', ', $expect_columns),
),
),
$key->getIssues());
$box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderWithDocumentationLink($title))
->addPropertyList($properties);
return $this->buildResponse($title, $box);
}
private function buildProperties(array $properties, array $issues) {
$view = id(new PHUIPropertyListView())
->setUser($this->getRequest()->getUser());
foreach ($properties as $property) {
list($key, $value) = $property;
$view->addProperty($key, $value);
}
$status_view = new PHUIStatusListView();
if (!$issues) {
$status_view->addItem(
id(new PHUIStatusItemView())
->setIcon(PHUIStatusItemView::ICON_ACCEPT, 'green')
->setTarget(pht('No Schema Issues')));
} else {
foreach ($issues as $issue) {
$note = PhabricatorConfigStorageSchema::getIssueDescription($issue);
$status = PhabricatorConfigStorageSchema::getIssueStatus($issue);
switch ($status) {
case PhabricatorConfigStorageSchema::STATUS_WARN:
$icon = PHUIStatusItemView::ICON_WARNING;
$color = 'yellow';
break;
case PhabricatorConfigStorageSchema::STATUS_FAIL:
default:
$icon = PHUIStatusItemView::ICON_REJECT;
$color = 'red';
break;
}
$item = id(new PHUIStatusItemView())
->setTarget(PhabricatorConfigStorageSchema::getIssueName($issue))
->setIcon($icon, $color)
->setNote($note);
$status_view->addItem($item);
}
}
$view->addProperty(pht('Schema Status'), $status_view);
return $view;
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php
index f3360b3496..90547f41f7 100644
--- a/src/applications/config/controller/PhabricatorConfigEditController.php
+++ b/src/applications/config/controller/PhabricatorConfigEditController.php
@@ -1,541 +1,535 @@
<?php
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, '.
'or have existed in a previous version of Phabricator.');
}
// This may be a dead config entry, which existed in the past but no
// 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().'/');
}
$issue = $request->getStr('issue');
if ($issue) {
// If the user came here from an open setup issue, send them back.
$done_uri = $this->getApplicationURI('issue/'.$issue.'/');
} else {
$done_uri = $group_uri;
}
// Check if the config key is already stored in the database.
// Grab the value if it is.
$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());
}
$e_value = null;
$errors = array();
if ($request->isFormPost() && !$option->getLocked()) {
$result = $this->readRequest(
$option,
$request);
list($e_value, $value_errors, $display_value, $xaction) = $result;
$errors = array_merge($errors, $value_errors);
if (!$errors) {
$editor = id(new PhabricatorConfigEditor())
- ->setActor($user)
+ ->setActor($viewer)
->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request);
try {
$editor->applyTransactions($config_entry, array($xaction));
return id(new AphrontRedirectResponse())->setURI($done_uri);
} catch (PhabricatorConfigValidationException $ex) {
$e_value = pht('Invalid');
$errors[] = $ex->getMessage();
}
}
} else {
if ($config_entry->getIsDeleted()) {
$display_value = null;
} else {
$display_value = $this->getDisplayValue(
$option,
$config_entry,
$config_entry->getValue());
}
}
$form = new AphrontFormView();
$error_view = null;
if ($errors) {
$error_view = id(new PHUIInfoView())
->setErrors($errors);
} else if ($option->getHidden()) {
$msg = pht(
'This configuration is hidden and can not be edited or viewed from '.
'the web interface.');
$error_view = id(new PHUIInfoView())
->setTitle(pht('Configuration Hidden'))
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
->appendChild(phutil_tag('p', array(), $msg));
} else if ($option->getLocked()) {
$msg = $option->getLockedMessage();
$error_view = id(new PHUIInfoView())
->setTitle(pht('Configuration Locked'))
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->appendChild(phutil_tag('p', array(), $msg));
}
if ($option->getHidden()) {
$control = null;
} else {
$control = $this->renderControl(
$option,
$display_value,
$e_value);
}
$engine = new PhabricatorMarkupEngine();
- $engine->setViewer($user);
+ $engine->setViewer($viewer);
$engine->addObject($option, 'description');
$engine->process();
$description = phutil_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
$engine->getOutput($option, 'description'));
$form
- ->setUser($user)
+ ->setUser($viewer)
->addHiddenInput('issue', $request->getStr('issue'))
->appendChild(
id(new AphrontFormMarkupControl())
->setLabel(pht('Description'))
->setValue($description));
if ($group) {
$extra = $group->renderContextualDescription(
$option,
$request);
if ($extra !== null) {
$form->appendChild(
id(new AphrontFormMarkupControl())
->setValue($extra));
}
}
$form
->appendChild($control);
$submit_control = id(new AphrontFormSubmitControl())
->addCancelButton($done_uri);
if (!$option->getLocked()) {
$submit_control->setValue(pht('Save Config Entry'));
}
$form->appendChild($submit_control);
$examples = $this->renderExamples($option);
if ($examples) {
$form->appendChild(
id(new AphrontFormMarkupControl())
->setLabel(pht('Examples'))
->setValue($examples));
}
if (!$option->getHidden()) {
$form->appendChild(
id(new AphrontFormMarkupControl())
->setLabel(pht('Default'))
->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())
->setHeaderText($title)
->setForm($form);
if ($error_view) {
$form_box->setInfoView($error_view);
}
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Config'), $this->getApplicationURI());
if ($group) {
$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,
new PhabricatorConfigTransactionQuery());
$timeline->setShouldTerminate(true);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
$timeline,
),
array(
'title' => $title,
));
}
private function readRequest(
PhabricatorConfigOption $option,
AphrontRequest $request) {
$xaction = new PhabricatorConfigTransaction();
$xaction->setTransactionType(PhabricatorConfigTransaction::TYPE_EDIT);
$e_value = null;
$errors = array();
$value = $request->getStr('value');
if (!strlen($value)) {
$value = null;
$xaction->setNewValue(
array(
'deleted' => true,
'value' => null,
));
return array($e_value, $errors, $value, $xaction);
}
if ($option->isCustomType()) {
$info = $option->getCustomObject()->readRequest($option, $request);
list($e_value, $errors, $set_value, $value) = $info;
} else {
$type = $option->getType();
$set_value = null;
switch ($type) {
case 'int':
if (preg_match('/^-?[0-9]+$/', trim($value))) {
$set_value = (int)$value;
} else {
$e_value = pht('Invalid');
$errors[] = pht('Value must be an integer.');
}
break;
case 'string':
case 'enum':
$set_value = (string)$value;
break;
case 'list<string>':
case 'list<regex>':
$set_value = phutil_split_lines(
$request->getStr('value'),
$retain_endings = false);
foreach ($set_value as $key => $v) {
if (!strlen($v)) {
unset($set_value[$key]);
}
}
$set_value = array_values($set_value);
break;
case 'set':
$set_value = array_fill_keys($request->getStrList('value'), true);
break;
case 'bool':
switch ($value) {
case 'true':
$set_value = true;
break;
case 'false':
$set_value = false;
break;
default:
$e_value = pht('Invalid');
$errors[] = pht('Value must be boolean, "true" or "false".');
break;
}
break;
case 'class':
if (!class_exists($value)) {
$e_value = pht('Invalid');
$errors[] = pht('Class does not exist.');
} else {
$base = $option->getBaseClass();
if (!is_subclass_of($value, $base)) {
$e_value = pht('Invalid');
$errors[] = pht('Class is not of valid type.');
} else {
$set_value = $value;
}
}
break;
default:
$json = json_decode($value, true);
if ($json === null && strtolower($value) != 'null') {
$e_value = pht('Invalid');
$errors[] = pht(
'The given value must be valid JSON. This means, among '.
'other things, that you must wrap strings in double-quotes.');
} else {
$set_value = $json;
}
break;
}
}
if (!$errors) {
$xaction->setNewValue(
array(
'deleted' => false,
'value' => $set_value,
));
} else {
$xaction = null;
}
return array($e_value, $errors, $value, $xaction);
}
private function getDisplayValue(
PhabricatorConfigOption $option,
PhabricatorConfigEntry $entry,
$value) {
if ($option->isCustomType()) {
return $option->getCustomObject()->getDisplayValue(
$option,
$entry,
$value);
} else {
$type = $option->getType();
switch ($type) {
case 'int':
case 'string':
case 'enum':
case 'class':
return $value;
case 'bool':
return $value ? 'true' : 'false';
case 'list<string>':
case 'list<regex>':
return implode("\n", nonempty($value, array()));
case 'set':
return implode("\n", nonempty(array_keys($value), array()));
default:
return PhabricatorConfigJSON::prettyPrintJSON($value);
}
}
}
private function renderControl(
PhabricatorConfigOption $option,
$display_value,
$e_value) {
if ($option->isCustomType()) {
$control = $option->getCustomObject()->renderControl(
$option,
$display_value,
$e_value);
} else {
$type = $option->getType();
switch ($type) {
case 'int':
case 'string':
$control = id(new AphrontFormTextControl());
break;
case 'bool':
$control = id(new AphrontFormSelectControl())
->setOptions(
array(
'' => pht('(Use Default)'),
'true' => idx($option->getBoolOptions(), 0),
'false' => idx($option->getBoolOptions(), 1),
));
break;
case 'enum':
$options = array_mergev(
array(
array('' => pht('(Use Default)')),
$option->getEnumOptions(),
));
$control = id(new AphrontFormSelectControl())
->setOptions($options);
break;
case 'class':
$symbols = id(new PhutilSymbolLoader())
->setType('class')
->setAncestorClass($option->getBaseClass())
->setConcreteOnly(true)
->selectSymbolsWithoutLoading();
$names = ipull($symbols, 'name', 'name');
asort($names);
$names = array(
'' => pht('(Use Default)'),
) + $names;
$control = id(new AphrontFormSelectControl())
->setOptions($names);
break;
case 'list<string>':
case 'list<regex>':
$control = id(new AphrontFormTextAreaControl())
->setCaption(pht('Separate values with newlines.'));
break;
case 'set':
$control = id(new AphrontFormTextAreaControl())
->setCaption(pht('Separate values with newlines or commas.'));
break;
default:
$control = id(new AphrontFormTextAreaControl())
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
->setCustomClass('PhabricatorMonospaced')
->setCaption(pht('Enter value in JSON.'));
break;
}
$control
->setLabel(pht('Value'))
->setError($e_value)
->setValue($display_value)
->setName('value');
}
if ($option->getLocked()) {
$control->setDisabled(true);
}
return $control;
}
private function renderExamples(PhabricatorConfigOption $option) {
$examples = $option->getExamples();
if (!$examples) {
return null;
}
$table = array();
$table[] = phutil_tag('tr', array('class' => 'column-labels'), array(
phutil_tag('th', array(), pht('Example')),
phutil_tag('th', array(), pht('Value')),
));
foreach ($examples as $example) {
list($value, $description) = $example;
if ($value === null) {
$value = phutil_tag('em', array(), pht('(empty)'));
} else {
if (is_array($value)) {
$value = implode("\n", $value);
}
}
$table[] = phutil_tag('tr', array(), array(
phutil_tag('th', array(), $description),
phutil_tag('td', array(), $value),
));
}
require_celerity_resource('config-options-css');
return phutil_tag(
'table',
array(
'class' => 'config-option-table',
),
$table);
}
private function renderDefaults(
PhabricatorConfigOption $option,
PhabricatorConfigEntry $entry) {
$stack = PhabricatorEnv::getConfigSourceStack();
$stack = $stack->getStack();
$table = array();
$table[] = phutil_tag('tr', array('class' => 'column-labels'), array(
phutil_tag('th', array(), pht('Source')),
phutil_tag('th', array(), pht('Value')),
));
foreach ($stack as $key => $source) {
$value = $source->getKeys(
array(
$option->getKey(),
));
if (!array_key_exists($option->getKey(), $value)) {
$value = phutil_tag('em', array(), pht('(empty)'));
} else {
$value = $this->getDisplayValue(
$option,
$entry,
$value[$option->getKey()]);
}
$table[] = phutil_tag('tr', array('class' => 'column-labels'), array(
phutil_tag('th', array(), $source->getName()),
phutil_tag('td', array(), $value),
));
}
require_celerity_resource('config-options-css');
return phutil_tag(
'table',
array(
'class' => 'config-option-table',
),
$table);
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigGroupController.php b/src/applications/config/controller/PhabricatorConfigGroupController.php
index b9dffd9a08..4569491427 100644
--- a/src/applications/config/controller/PhabricatorConfigGroupController.php
+++ b/src/applications/config/controller/PhabricatorConfigGroupController.php
@@ -1,108 +1,102 @@
<?php
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();
}
$title = pht('%s Configuration', $options->getName());
$list = $this->buildOptionList($options->getOptions());
$box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setObjectList($list);
$crumbs = $this
->buildApplicationCrumbs()
->addTextCrumb(pht('Config'), $this->getApplicationURI())
->addTextCrumb($options->getName(), $this->getApplicationURI());
return $this->buildApplicationPage(
array(
$crumbs,
$box,
),
array(
'title' => $title,
));
}
private function buildOptionList(array $options) {
assert_instances_of($options, 'PhabricatorConfigOption');
require_celerity_resource('config-options-css');
$db_values = array();
if ($options) {
$db_values = id(new PhabricatorConfigEntry())->loadAllWhere(
'configKey IN (%Ls) AND namespace = %s',
mpull($options, 'getKey'),
'default');
$db_values = mpull($db_values, null, 'getConfigKey');
}
$engine = id(new PhabricatorMarkupEngine())
->setViewer($this->getRequest()->getUser());
foreach ($options as $option) {
$engine->addObject($option, 'summary');
}
$engine->process();
$list = new PHUIObjectItemListView();
foreach ($options as $option) {
$summary = $engine->getOutput($option, 'summary');
$item = id(new PHUIObjectItemView())
->setHeader($option->getKey())
->setHref('/config/edit/'.$option->getKey().'/')
->addAttribute($summary);
if (!$option->getHidden()) {
$current_value = PhabricatorEnv::getEnvConfig($option->getKey());
$current_value = PhabricatorConfigJSON::prettyPrintJSON(
$current_value);
$current_value = phutil_tag(
'div',
array(
'class' => 'config-options-current-value',
),
array(
phutil_tag('span', array(), pht('Current Value:')),
' '.$current_value,
));
$item->appendChild($current_value);
}
$db_value = idx($db_values, $option->getKey());
if ($db_value && !$db_value->getIsDeleted()) {
$item->addIcon('edit', pht('Customized'));
}
if ($option->getHidden()) {
$item->addIcon('unpublish', pht('Hidden'));
} else if ($option->getLocked()) {
$item->addIcon('lock', pht('Locked'));
}
$list->addItem($item);
}
return $list;
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigHistoryController.php b/src/applications/config/controller/PhabricatorConfigHistoryController.php
index acb1d3c297..d86fb79878 100644
--- a/src/applications/config/controller/PhabricatorConfigHistoryController.php
+++ b/src/applications/config/controller/PhabricatorConfigHistoryController.php
@@ -1,52 +1,52 @@
<?php
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();
$object = new PhabricatorConfigEntry();
$xaction = $object->getApplicationTransactionTemplate();
$view = $xaction->getApplicationTransactionViewObject();
$timeline = $view
- ->setUser($user)
+ ->setUser($viewer)
->setTransactions($xactions)
->setRenderAsFeed(true)
->setObjectPHID(PhabricatorPHIDConstants::PHID_VOID);
$timeline->setShouldTerminate(true);
$object->willRenderTimeline($timeline, $this->getRequest());
$title = pht('Settings History');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true);
$crumbs->addTextCrumb('Config', $this->getApplicationURI());
$crumbs->addTextCrumb($title, '/config/history/');
$nav = $this->buildSideNavView();
$nav->selectFilter('history/');
$nav->setCrumbs($crumbs);
$nav->appendChild($timeline);
return $this->buildApplicationPage(
array(
$nav,
),
array(
'title' => $title,
));
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigIgnoreController.php b/src/applications/config/controller/PhabricatorConfigIgnoreController.php
index ba634dec1a..80a859c147 100644
--- a/src/applications/config/controller/PhabricatorConfigIgnoreController.php
+++ b/src/applications/config/controller/PhabricatorConfigIgnoreController.php
@@ -1,68 +1,63 @@
<?php
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())
->setUser($request->getUser())
->setTitle($title)
->appendChild($body)
->addSubmitButton($submit_title)
->addCancelButton($issue_uri);
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(
$this->getRequest()->getUser(),
$config_entry,
$list,
PhabricatorContentSource::newFromRequest($this->getRequest()));
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigIssueListController.php b/src/applications/config/controller/PhabricatorConfigIssueListController.php
index d1d19860b9..89b8ea7cd6 100644
--- a/src/applications/config/controller/PhabricatorConfigIssueListController.php
+++ b/src/applications/config/controller/PhabricatorConfigIssueListController.php
@@ -1,114 +1,113 @@
<?php
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/');
$issues = PhabricatorSetupCheck::runAllChecks();
PhabricatorSetupCheck::setOpenSetupIssueKeys(
PhabricatorSetupCheck::getUnignoredIssueKeys($issues));
$important = $this->buildIssueList(
$issues, PhabricatorSetupCheck::GROUP_IMPORTANT);
$php = $this->buildIssueList(
$issues, PhabricatorSetupCheck::GROUP_PHP);
$mysql = $this->buildIssueList(
$issues, PhabricatorSetupCheck::GROUP_MYSQL);
$other = $this->buildIssueList(
$issues, PhabricatorSetupCheck::GROUP_OTHER);
$setup_issues = array();
if ($important) {
$setup_issues[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Important Setup Issues'))
->setColor(PHUIObjectBoxView::COLOR_RED)
->setObjectList($important);
}
if ($php) {
$setup_issues[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('PHP Setup Issues'))
->setObjectList($php);
}
if ($mysql) {
$setup_issues[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('MySQL Setup Issues'))
->setObjectList($mysql);
}
if ($other) {
$setup_issues[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Other Setup Issues'))
->setObjectList($other);
}
if (empty($setup_issues)) {
$setup_issues[] = id(new PHUIInfoView())
->setTitle(pht('No Issues'))
->appendChild(
pht('Your install has no current setup issues to resolve.'))
->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
}
$nav->appendChild($setup_issues);
$title = pht('Setup Issues');
$crumbs = $this
->buildApplicationCrumbs($nav)
->addTextCrumb(pht('Setup'), $this->getApplicationURI('issue/'));
$nav->setCrumbs($crumbs);
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
}
private function buildIssueList(array $issues, $group) {
assert_instances_of($issues, 'PhabricatorSetupIssue');
$list = new PHUIObjectItemListView();
$ignored_items = array();
$items = 0;
foreach ($issues as $issue) {
if ($issue->getGroup() == $group) {
$items++;
$href = $this->getApplicationURI('/issue/'.$issue->getIssueKey().'/');
$item = id(new PHUIObjectItemView())
->setHeader($issue->getName())
->setHref($href)
->addAttribute($issue->getSummary());
if (!$issue->getIsIgnored()) {
$item->setStatusIcon('fa-warning yellow');
$list->addItem($item);
} else {
$item->addIcon('fa-eye-slash', pht('Ignored'));
$item->setDisabled(true);
$item->setStatusIcon('fa-warning grey');
$ignored_items[] = $item;
}
}
}
foreach ($ignored_items as $item) {
$list->addItem($item);
}
if ($items == 0) {
return null;
} else {
return $list;
}
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigIssueViewController.php b/src/applications/config/controller/PhabricatorConfigIssueViewController.php
index a2beb8ae76..e8d6e188a4 100644
--- a/src/applications/config/controller/PhabricatorConfigIssueViewController.php
+++ b/src/applications/config/controller/PhabricatorConfigIssueViewController.php
@@ -1,71 +1,65 @@
<?php
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'))
->appendChild(pht('This setup issue has been resolved. '))
->appendChild(
phutil_tag(
'a',
array(
'href' => $this->getApplicationURI('issue/'),
),
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();
}
$crumbs = $this
->buildApplicationCrumbs()
->setBorder(true)
->addTextCrumb(pht('Setup Issues'), $this->getApplicationURI('issue/'))
->addTextCrumb($title, $request->getRequestURI());
return $this->buildApplicationPage(
array(
$crumbs,
$content,
),
array(
'title' => $title,
));
}
private function renderIssue(PhabricatorSetupIssue $issue) {
require_celerity_resource('setup-issue-css');
$view = new PhabricatorSetupIssueView();
$view->setIssue($issue);
$container = phutil_tag(
'div',
array(
'class' => 'setup-issue-background',
),
$view->render());
return $container;
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigListController.php b/src/applications/config/controller/PhabricatorConfigListController.php
index 4da4f2ac01..6a1823ecda 100644
--- a/src/applications/config/controller/PhabricatorConfigListController.php
+++ b/src/applications/config/controller/PhabricatorConfigListController.php
@@ -1,65 +1,64 @@
<?php
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('/');
$groups = PhabricatorApplicationConfigOptions::loadAll();
$core_list = $this->buildConfigOptionsList($groups, 'core');
$apps_list = $this->buildConfigOptionsList($groups, 'apps');
$title = pht('Phabricator Configuration');
$core = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setObjectList($core_list);
$apps = id(new PHUIObjectBoxView())
->setHeaderText(pht('Applications Configuration'))
->setObjectList($apps_list);
$nav->appendChild(
array(
$core,
$apps,
));
$crumbs = $this
->buildApplicationCrumbs()
->addTextCrumb(pht('Config'), $this->getApplicationURI());
$nav->setCrumbs($crumbs);
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
}
private function buildConfigOptionsList(array $groups, $type) {
assert_instances_of($groups, 'PhabricatorApplicationConfigOptions');
$list = new PHUIObjectItemListView();
$groups = msort($groups, 'getName');
foreach ($groups as $group) {
if ($group->getGroup() == $type) {
$item = id(new PHUIObjectItemView())
->setHeader($group->getName())
->setHref('/config/group/'.$group->getKey().'/')
->addAttribute($group->getDescription())
->setFontIcon($group->getFontIcon());
$list->addItem($item);
}
}
return $list;
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigWelcomeController.php b/src/applications/config/controller/PhabricatorConfigWelcomeController.php
index 11132af08b..37442c2375 100644
--- a/src/applications/config/controller/PhabricatorConfigWelcomeController.php
+++ b/src/applications/config/controller/PhabricatorConfigWelcomeController.php
@@ -1,422 +1,421 @@
<?php
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/');
$title = pht('Welcome');
$crumbs = $this
->buildApplicationCrumbs()
->addTextCrumb(pht('Welcome'));
$nav->setCrumbs($crumbs);
$nav->appendChild($this->buildWelcomeScreen($request));
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
}
public function buildWelcomeScreen(AphrontRequest $request) {
$viewer = $request->getUser();
$this->requireResource('config-welcome-css');
$content = pht(
"=== Install Phabricator ===\n\n".
"You have successfully installed Phabricator. This screen will guide ".
"you through configuration and orientation. ".
"These steps are optional, and you can go through them in any order. ".
"If you want to get back to this screen later on, you can find it in ".
"the **Config** application under **Welcome Screen**.");
$setup = array();
$setup[] = $this->newItem(
$request,
'fa-check-square-o green',
$content);
$issues_resolved = !PhabricatorSetupCheck::getOpenSetupIssueKeys();
$setup_href = PhabricatorEnv::getURI('/config/issue/');
if ($issues_resolved) {
$content = pht(
"=== Resolve Setup Issues ===\n\n".
"You've resolved (or ignored) all outstanding setup issues. ".
"You can review issues in the **Config** application, under ".
"**[[ %s | Setup Issues ]]**.",
$setup_href);
$icon = 'fa-check-square-o green';
} else {
$content = pht(
"=== Resolve Setup Issues ===\n\n".
"You have some unresolved setup issues to take care of. Click ".
"the link in the yellow banner at the top of the screen to see ".
"them, or find them in the **Config** application under ".
"**[[ %s | Setup Issues ]]**. ".
"Although most setup issues should be resolved, sometimes an issue ".
"is not applicable to an install. ".
"If you don't intend to fix a setup issue (or don't want to fix ".
"it for now), you can use the \"Ignore\" action to mark it as ".
"something you don't plan to deal with.",
$setup_href);
$icon = 'fa-warning red';
}
$setup[] = $this->newItem(
$request,
$icon,
$content);
$configs = id(new PhabricatorAuthProviderConfigQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->execute();
$auth_href = PhabricatorEnv::getURI('/auth/');
$have_auth = (bool)$configs;
if ($have_auth) {
$content = pht(
"=== Login and Registration ===\n\n".
"You've configured at least one authentication provider, so users ".
"can register or log in. ".
"To configure more providers or adjust settings, use the ".
"**[[ %s | Auth Application ]]**.",
$auth_href);
$icon = 'fa-check-square-o green';
} else {
$content = pht(
"=== Login and Registration ===\n\n".
"You haven't configured any authentication providers yet. ".
"Authentication providers allow users to register accounts and ".
"log in to Phabricator. You can configure Phabricator to accept ".
"credentials like username and password, LDAP, or Google OAuth. ".
"You can configure authentication using the ".
"**[[ %s | Auth Application ]]**.",
$auth_href);
$icon = 'fa-warning red';
}
$setup[] = $this->newItem(
$request,
$icon,
$content);
$config_href = PhabricatorEnv::getURI('/config/');
// Just load any config value at all; if one exists the install has figured
// out how to configure things.
$have_config = (bool)id(new PhabricatorConfigEntry())->loadAllWhere(
'1 = 1 LIMIT 1');
if ($have_config) {
$content = pht(
"=== Configure Phabricator Settings ===\n\n".
"You've configured at least one setting from the web interface. ".
"To configure more settings later, use the ".
"**[[ %s | Config Application ]]**.",
$config_href);
$icon = 'fa-check-square-o green';
} else {
$content = pht(
"=== Configure Phabricator Settings ===\n\n".
'Many aspects of Phabricator are configurable. To explore and '.
'adjust settings, use the **[[ %s | Config Application ]]**.',
$config_href);
$icon = 'fa-info-circle';
}
$setup[] = $this->newItem(
$request,
$icon,
$content);
$settings_href = PhabricatorEnv::getURI('/settings/');
$prefs = $viewer->loadPreferences()->getPreferences();
$have_settings = !empty($prefs);
if ($have_settings) {
$content = pht(
"=== Adjust Account Settings ===\n\n".
"You've adjusted at least one setting on your account. ".
"To make more adjustments, visit the ".
"**[[ %s | Settings Application ]]**.",
$settings_href);
$icon = 'fa-check-square-o green';
} else {
$content = pht(
"=== Adjust Account Settings ===\n\n".
'You can configure settings for your account by clicking the '.
'wrench icon in the main menu bar, or visiting the '.
'**[[ %s | Settings Application ]]** directly.',
$settings_href);
$icon = 'fa-info-circle';
}
$setup[] = $this->newItem(
$request,
$icon,
$content);
$dashboard_href = PhabricatorEnv::getURI('/dashboard/');
$have_dashboard = (bool)PhabricatorDashboardInstall::getDashboard(
$viewer,
PhabricatorHomeApplication::DASHBOARD_DEFAULT,
'PhabricatorHomeApplication');
if ($have_dashboard) {
$content = pht(
"=== Customize Home Page ===\n\n".
"You've installed a default dashboard to replace this welcome screen ".
"on the home page. ".
"You can still visit the welcome screen here at any time if you ".
"have steps you want to complete later, or if you feel lonely. ".
"If you've changed your mind about the dashboard you installed, ".
"you can install a different default dashboard with the ".
"**[[ %s | Dashboards Application ]]**.",
$dashboard_href);
$icon = 'fa-check-square-o green';
} else {
$content = pht(
"=== Customize Home Page ===\n\n".
"When you're done setting things up, you can create a custom ".
"dashboard and install it. Your dashboard will replace this ".
"welcome screen on the Phabricator home page. ".
"Dashboards can show users the information that's most important to ".
"your organization. You can configure them to display things like: ".
"a custom welcome message, a feed of recent activity, or a list of ".
"open tasks, waiting reviews, recent commits, and so on. ".
"After you install a default dashboard, it will replace this page. ".
"You can find this page later by visiting the **Config** ".
"application, under **Welcome Page**. ".
"To get started building a dashboard, use the ".
"**[[ %s | Dashboards Application ]]**. ",
$dashboard_href);
$icon = 'fa-info-circle';
}
$setup[] = $this->newItem(
$request,
$icon,
$content);
$apps_href = PhabricatorEnv::getURI('/applications/');
$content = pht(
"=== Explore Applications ===\n\n".
"Phabricator is a large suite of applications that work together to ".
"help you develop software, manage tasks, and communicate. A few of ".
"the most commonly used applications are pinned to the left navigation ".
"bar by default.\n\n".
"To explore all of the Phabricator applications, adjust settings, or ".
"uninstall applications you don't plan to use, visit the ".
"**[[ %s | Applications Application ]]**. You can also click the ".
"**Applications** button in the left navigation menu, or search for an ".
"application by name in the main menu bar. ",
$apps_href);
$explore = array();
$explore[] = $this->newItem(
$request,
'fa-globe',
$content);
$support_href = PhabricatorEnv::getDoclink('Give Feedback! Get Support!');
$content = pht(
"=== Need Help with Setup? ===\n\n".
'Having trouble getting something set up? See '.
'**[[ %s | Give Feedback! Get Support! ]]** for ways to get in touch '.
'to get answers to questions, report bugs, and request features.',
$support_href);
$explore[] = $this->newItem(
$request,
'fa-life-ring',
$content);
$differential_uri = PhabricatorEnv::getURI('/differential/');
$differential_create_uri = PhabricatorEnv::getURI(
'/differential/diff/create/');
$differential_all_uri = PhabricatorEnv::getURI('/differential/query/all/');
$differential_user_guide = PhabricatorEnv::getDoclink(
'Differential User Guide');
$differential_vs_uri = PhabricatorEnv::getDoclink(
'User Guide: Review vs Audit');
$quick = array();
$quick[] = $this->newItem(
$request,
'fa-gear',
pht(
"=== Quick Start: Code Review ===\n\n".
"Review code with **[[ %s | Differential ]]**. ".
"Engineers can use Differential to share, review, and approve ".
"changes to source code. ".
"To get started with code review:\n\n".
" - **[[ %s | Create a Revision ]]** //(Copy and paste a diff from ".
" the command line into the web UI to quickly get a feel for ".
" review.)//\n".
" - **[[ %s | View All Revisions ]]**\n\n".
"For more information, see these articles in the documentation:\n\n".
" - **[[ %s | Differential User Guide ]]**, for a general overview ".
" of Differential.\n".
" - **[[ %s | User Guide: Review vs Audit ]]**, for a discussion ".
" of different code review workflows.",
$differential_uri,
$differential_create_uri,
$differential_all_uri,
$differential_user_guide,
$differential_vs_uri));
$maniphest_uri = PhabricatorEnv::getURI('/maniphest/');
$maniphest_create_uri = PhabricatorEnv::getURI('/maniphest/task/create/');
$maniphest_all_uri = PhabricatorEnv::getURI('/maniphest/query/all/');
$quick[] = $this->newItem(
$request,
'fa-anchor',
pht(
"=== Quick Start: Bugs and Tasks ===\n\n".
"Track bugs and tasks in Phabricator with ".
"**[[ %s | Maniphest ]]**. ".
"Users in all roles can use Maniphest to manage current and ".
"planned work and to track bugs and issues. ".
"To get started with bugs and tasks:\n\n".
" - **[[ %s | Create a Task ]]**\n".
" - **[[ %s | View All Tasks ]]**\n",
$maniphest_uri,
$maniphest_create_uri,
$maniphest_all_uri));
$pholio_uri = PhabricatorEnv::getURI('/pholio/');
$pholio_create_uri = PhabricatorEnv::getURI('/pholio/new/');
$pholio_all_uri = PhabricatorEnv::getURI('/pholio/query/all/');
$quick[] = $this->newItem(
$request,
'fa-camera-retro',
pht(
"=== Quick Start: Design Review ===\n\n".
"Review proposed designs with **[[ %s | Pholio ]]**. ".
"Designers can use Pholio to share images of what they're working on ".
"and show off things they've made. ".
"To get started with design review:\n\n".
" - **[[ %s | Create a Mock ]]**\n".
" - **[[ %s | View All Mocks ]]**",
$pholio_uri,
$pholio_create_uri,
$pholio_all_uri));
$diffusion_uri = PhabricatorEnv::getURI('/diffusion/');
$diffusion_create_uri = PhabricatorEnv::getURI('/diffusion/create/');
$diffusion_all_uri = PhabricatorEnv::getURI('/diffusion/query/all/');
$diffusion_user_guide = PhabricatorEnv::getDoclink('Diffusion User Guide');
$diffusion_setup_guide = PhabricatorEnv::getDoclink(
'Diffusion User Guide: Repository Hosting');
$quick[] = $this->newItem(
$request,
'fa-code',
pht(
"=== Quick Start: Repositories ===\n\n".
"Manage and browse source code repositories with ".
"**[[ %s | Diffusion ]]**. ".
"Engineers can use Diffusion to browse and audit source code. ".
"You can configure Phabricator to host repositories, or have it ".
"track existing repositories hosted elsewhere (like GitHub, ".
"Bitbucket, or an internal server). ".
"To get started with repositories:\n\n".
" - **[[ %s | Create a New Repository ]]**\n".
" - **[[ %s | View All Repositories ]]**\n\n".
"For more information, see these articles in the documentation:\n\n".
" - **[[ %s | Diffusion User Guide ]]**, for a general overview of ".
" Diffusion.\n".
" - **[[ %s | Diffusion User Guide: Repository Hosting ]]**, ".
" for instructions on configuring repository hosting.\n\n".
"Phabricator supports Git, Mercurial and Subversion.",
$diffusion_uri,
$diffusion_create_uri,
$diffusion_all_uri,
$diffusion_user_guide,
$diffusion_setup_guide));
$header = id(new PHUIHeaderView())
->setHeader(pht('Welcome to Phabricator'));
$setup_header = PhabricatorMarkupEngine::renderOneObject(
id(new PhabricatorMarkupOneOff())
->setContent(pht('=Setup and Configuration')),
'default',
$viewer);
$explore_header = PhabricatorMarkupEngine::renderOneObject(
id(new PhabricatorMarkupOneOff())
->setContent(pht('=Explore Phabricator')),
'default',
$viewer);
$quick_header = PhabricatorMarkupEngine::renderOneObject(
id(new PhabricatorMarkupOneOff())
->setContent(pht('=Quick Start Guides')),
'default',
$viewer);
return id(new PHUIDocumentView())
->setHeader($header)
->setFluid(true)
->appendChild($setup_header)
->appendChild($setup)
->appendChild($explore_header)
->appendChild($explore)
->appendChild($quick_header)
->appendChild($quick);
}
private function newItem(AphrontRequest $request, $icon, $content) {
$viewer = $request->getUser();
$icon = id(new PHUIIconView())
->setIconFont($icon.' fa-2x');
$content = PhabricatorMarkupEngine::renderOneObject(
id(new PhabricatorMarkupOneOff())->setContent($content),
'default',
$viewer);
$icon = phutil_tag(
'div',
array(
'class' => 'config-welcome-icon',
),
$icon);
$content = phutil_tag(
'div',
array(
'class' => 'config-welcome-content',
),
$content);
$view = phutil_tag(
'div',
array(
'class' => 'config-welcome-box grouped',
),
array(
$icon,
$content,
));
return $view;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jun 10, 6:38 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140737
Default Alt Text
(79 KB)

Event Timeline