mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 07:20:57 +01:00
Split setup checks into "preflight" and "normal" checks
Summary: Ref T11589. Currently, initialization order is a bit tangled: we load configuration from the database, then later test if we can connect to the database. Instead, I'm going to do: preflight checks ("PHP Version OK?", "Extensions installed?"), then configuration, then normal setup checks. To prepare for this, flag core checks as "preflight" and add a setup panel to visually confirm that I didn't miss anything. Test Plan: {F1803210} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11589 Differential Revision: https://secure.phabricator.com/D16499
This commit is contained in:
parent
7eee5c5f6f
commit
b1932f1f56
6 changed files with 75 additions and 6 deletions
|
@ -2200,6 +2200,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php',
|
'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php',
|
||||||
'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php',
|
'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php',
|
||||||
'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php',
|
'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php',
|
||||||
|
'PhabricatorConfigSetupCheckModule' => 'applications/config/module/PhabricatorConfigSetupCheckModule.php',
|
||||||
'PhabricatorConfigSiteModule' => 'applications/config/module/PhabricatorConfigSiteModule.php',
|
'PhabricatorConfigSiteModule' => 'applications/config/module/PhabricatorConfigSiteModule.php',
|
||||||
'PhabricatorConfigSiteSource' => 'infrastructure/env/PhabricatorConfigSiteSource.php',
|
'PhabricatorConfigSiteSource' => 'infrastructure/env/PhabricatorConfigSiteSource.php',
|
||||||
'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php',
|
'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php',
|
||||||
|
@ -6953,6 +6954,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorConfigSchemaQuery' => 'Phobject',
|
'PhabricatorConfigSchemaQuery' => 'Phobject',
|
||||||
'PhabricatorConfigSchemaSpec' => 'Phobject',
|
'PhabricatorConfigSchemaSpec' => 'Phobject',
|
||||||
'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema',
|
'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema',
|
||||||
|
'PhabricatorConfigSetupCheckModule' => 'PhabricatorConfigModule',
|
||||||
'PhabricatorConfigSiteModule' => 'PhabricatorConfigModule',
|
'PhabricatorConfigSiteModule' => 'PhabricatorConfigModule',
|
||||||
'PhabricatorConfigSiteSource' => 'PhabricatorConfigProxySource',
|
'PhabricatorConfigSiteSource' => 'PhabricatorConfigProxySource',
|
||||||
'PhabricatorConfigSource' => 'Phobject',
|
'PhabricatorConfigSource' => 'Phobject',
|
||||||
|
|
|
@ -8,7 +8,7 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
|
||||||
|
|
||||||
public function getExecutionOrder() {
|
public function getExecutionOrder() {
|
||||||
// This must run after basic PHP checks, but before most other checks.
|
// This must run after basic PHP checks, but before most other checks.
|
||||||
return 0.5;
|
return 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function executeChecks() {
|
protected function executeChecks() {
|
||||||
|
|
|
@ -6,8 +6,8 @@ final class PhabricatorExtensionsSetupCheck extends PhabricatorSetupCheck {
|
||||||
return self::GROUP_PHP;
|
return self::GROUP_PHP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExecutionOrder() {
|
public function isPreflightCheck() {
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function executeChecks() {
|
protected function executeChecks() {
|
||||||
|
|
|
@ -6,8 +6,8 @@ final class PhabricatorPHPConfigSetupCheck extends PhabricatorSetupCheck {
|
||||||
return self::GROUP_PHP;
|
return self::GROUP_PHP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExecutionOrder() {
|
public function isPreflightCheck() {
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function executeChecks() {
|
protected function executeChecks() {
|
||||||
|
|
|
@ -12,7 +12,25 @@ abstract class PhabricatorSetupCheck extends Phobject {
|
||||||
const GROUP_IMPORTANT = 'important';
|
const GROUP_IMPORTANT = 'important';
|
||||||
|
|
||||||
public function getExecutionOrder() {
|
public function getExecutionOrder() {
|
||||||
return 1;
|
if ($this->isPreflightCheck()) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should this check execute before we load configuration?
|
||||||
|
*
|
||||||
|
* The majority of checks (particularly, those checks which examine
|
||||||
|
* configuration) should run in the normal setup phase, after configuration
|
||||||
|
* loads. However, a small set of critical checks (mostly, tests for PHP
|
||||||
|
* setup and extensions) need to run before we can load configuration.
|
||||||
|
*
|
||||||
|
* @return bool True to execute before configuration is loaded.
|
||||||
|
*/
|
||||||
|
public function isPreflightCheck() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected function newIssue($key) {
|
final protected function newIssue($key) {
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorConfigSetupCheckModule
|
||||||
|
extends PhabricatorConfigModule {
|
||||||
|
|
||||||
|
public function getModuleKey() {
|
||||||
|
return 'setup';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModuleName() {
|
||||||
|
return pht('Setup Checks');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderModuleStatus(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
|
|
||||||
|
$checks = PhabricatorSetupCheck::loadAllChecks();
|
||||||
|
|
||||||
|
$rows = array();
|
||||||
|
foreach ($checks as $key => $check) {
|
||||||
|
if ($check->isPreflightCheck()) {
|
||||||
|
$icon = id(new PHUIIconView())->setIcon('fa-plane blue');
|
||||||
|
} else {
|
||||||
|
$icon = id(new PHUIIconView())->setIcon('fa-times grey');
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array(
|
||||||
|
$check->getExecutionOrder(),
|
||||||
|
$icon,
|
||||||
|
get_class($check),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return id(new AphrontTableView($rows))
|
||||||
|
->setHeaders(
|
||||||
|
array(
|
||||||
|
pht('Order'),
|
||||||
|
pht('Preflight'),
|
||||||
|
pht('Class'),
|
||||||
|
))
|
||||||
|
->setColumnClasses(
|
||||||
|
array(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
'pri wide',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue