@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+75 -6
+2
src/__phutil_library_map__.php
··· 2200 2200 'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php', 2201 2201 'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php', 2202 2202 'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php', 2203 + 'PhabricatorConfigSetupCheckModule' => 'applications/config/module/PhabricatorConfigSetupCheckModule.php', 2203 2204 'PhabricatorConfigSiteModule' => 'applications/config/module/PhabricatorConfigSiteModule.php', 2204 2205 'PhabricatorConfigSiteSource' => 'infrastructure/env/PhabricatorConfigSiteSource.php', 2205 2206 'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php', ··· 6953 6954 'PhabricatorConfigSchemaQuery' => 'Phobject', 6954 6955 'PhabricatorConfigSchemaSpec' => 'Phobject', 6955 6956 'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema', 6957 + 'PhabricatorConfigSetupCheckModule' => 'PhabricatorConfigModule', 6956 6958 'PhabricatorConfigSiteModule' => 'PhabricatorConfigModule', 6957 6959 'PhabricatorConfigSiteSource' => 'PhabricatorConfigProxySource', 6958 6960 'PhabricatorConfigSource' => 'Phobject',
+1 -1
src/applications/config/check/PhabricatorDatabaseSetupCheck.php
··· 8 8 9 9 public function getExecutionOrder() { 10 10 // This must run after basic PHP checks, but before most other checks. 11 - return 0.5; 11 + return 500; 12 12 } 13 13 14 14 protected function executeChecks() {
+2 -2
src/applications/config/check/PhabricatorExtensionsSetupCheck.php
··· 6 6 return self::GROUP_PHP; 7 7 } 8 8 9 - public function getExecutionOrder() { 10 - return 0; 9 + public function isPreflightCheck() { 10 + return true; 11 11 } 12 12 13 13 protected function executeChecks() {
+2 -2
src/applications/config/check/PhabricatorPHPConfigSetupCheck.php
··· 6 6 return self::GROUP_PHP; 7 7 } 8 8 9 - public function getExecutionOrder() { 10 - return 0; 9 + public function isPreflightCheck() { 10 + return true; 11 11 } 12 12 13 13 protected function executeChecks() {
+19 -1
src/applications/config/check/PhabricatorSetupCheck.php
··· 12 12 const GROUP_IMPORTANT = 'important'; 13 13 14 14 public function getExecutionOrder() { 15 - return 1; 15 + if ($this->isPreflightCheck()) { 16 + return 0; 17 + } else { 18 + return 1000; 19 + } 20 + } 21 + 22 + /** 23 + * Should this check execute before we load configuration? 24 + * 25 + * The majority of checks (particularly, those checks which examine 26 + * configuration) should run in the normal setup phase, after configuration 27 + * loads. However, a small set of critical checks (mostly, tests for PHP 28 + * setup and extensions) need to run before we can load configuration. 29 + * 30 + * @return bool True to execute before configuration is loaded. 31 + */ 32 + public function isPreflightCheck() { 33 + return false; 16 34 } 17 35 18 36 final protected function newIssue($key) {
+49
src/applications/config/module/PhabricatorConfigSetupCheckModule.php
··· 1 + <?php 2 + 3 + final class PhabricatorConfigSetupCheckModule 4 + extends PhabricatorConfigModule { 5 + 6 + public function getModuleKey() { 7 + return 'setup'; 8 + } 9 + 10 + public function getModuleName() { 11 + return pht('Setup Checks'); 12 + } 13 + 14 + public function renderModuleStatus(AphrontRequest $request) { 15 + $viewer = $request->getViewer(); 16 + 17 + $checks = PhabricatorSetupCheck::loadAllChecks(); 18 + 19 + $rows = array(); 20 + foreach ($checks as $key => $check) { 21 + if ($check->isPreflightCheck()) { 22 + $icon = id(new PHUIIconView())->setIcon('fa-plane blue'); 23 + } else { 24 + $icon = id(new PHUIIconView())->setIcon('fa-times grey'); 25 + } 26 + 27 + $rows[] = array( 28 + $check->getExecutionOrder(), 29 + $icon, 30 + get_class($check), 31 + ); 32 + } 33 + 34 + return id(new AphrontTableView($rows)) 35 + ->setHeaders( 36 + array( 37 + pht('Order'), 38 + pht('Preflight'), 39 + pht('Class'), 40 + )) 41 + ->setColumnClasses( 42 + array( 43 + null, 44 + null, 45 + 'pri wide', 46 + )); 47 + } 48 + 49 + }