mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 18:52:42 +01:00
(stable) 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
6725f3719d
commit
89c0e47a60
6 changed files with 75 additions and 6 deletions
|
@ -2200,6 +2200,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php',
|
||||
'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php',
|
||||
'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php',
|
||||
'PhabricatorConfigSetupCheckModule' => 'applications/config/module/PhabricatorConfigSetupCheckModule.php',
|
||||
'PhabricatorConfigSiteModule' => 'applications/config/module/PhabricatorConfigSiteModule.php',
|
||||
'PhabricatorConfigSiteSource' => 'infrastructure/env/PhabricatorConfigSiteSource.php',
|
||||
'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php',
|
||||
|
@ -6954,6 +6955,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorConfigSchemaQuery' => 'Phobject',
|
||||
'PhabricatorConfigSchemaSpec' => 'Phobject',
|
||||
'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema',
|
||||
'PhabricatorConfigSetupCheckModule' => 'PhabricatorConfigModule',
|
||||
'PhabricatorConfigSiteModule' => 'PhabricatorConfigModule',
|
||||
'PhabricatorConfigSiteSource' => 'PhabricatorConfigProxySource',
|
||||
'PhabricatorConfigSource' => 'Phobject',
|
||||
|
|
|
@ -8,7 +8,7 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
|
|||
|
||||
public function getExecutionOrder() {
|
||||
// This must run after basic PHP checks, but before most other checks.
|
||||
return 0.5;
|
||||
return 500;
|
||||
}
|
||||
|
||||
protected function executeChecks() {
|
||||
|
|
|
@ -6,8 +6,8 @@ final class PhabricatorExtensionsSetupCheck extends PhabricatorSetupCheck {
|
|||
return self::GROUP_PHP;
|
||||
}
|
||||
|
||||
public function getExecutionOrder() {
|
||||
return 0;
|
||||
public function isPreflightCheck() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function executeChecks() {
|
||||
|
|
|
@ -6,8 +6,8 @@ final class PhabricatorPHPConfigSetupCheck extends PhabricatorSetupCheck {
|
|||
return self::GROUP_PHP;
|
||||
}
|
||||
|
||||
public function getExecutionOrder() {
|
||||
return 0;
|
||||
public function isPreflightCheck() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function executeChecks() {
|
||||
|
|
|
@ -12,7 +12,25 @@ abstract class PhabricatorSetupCheck extends Phobject {
|
|||
const GROUP_IMPORTANT = 'important';
|
||||
|
||||
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) {
|
||||
|
|
|
@ -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