@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<?php
2
3final class PhabricatorSetupEngine
4 extends Phobject {
5
6 private $issues;
7
8 public function getIssues() {
9 if ($this->issues === null) {
10 throw new PhutilInvalidStateException('execute');
11 }
12
13 return $this->issues;
14 }
15
16 public function getUnresolvedIssues() {
17 $issues = $this->getIssues();
18 $issues = mpull($issues, null, 'getIssueKey');
19
20 $unresolved_keys = PhabricatorSetupCheck::getUnignoredIssueKeys($issues);
21
22 return array_select_keys($issues, $unresolved_keys);
23 }
24
25 public function execute() {
26 $issues = PhabricatorSetupCheck::runNormalChecks();
27
28 $fatal_issue = null;
29 foreach ($issues as $issue) {
30 if ($issue->getIsFatal()) {
31 $fatal_issue = $issue;
32 break;
33 }
34 }
35
36 if ($fatal_issue) {
37 // If we've discovered a fatal, we reset any in-flight state to push
38 // web hosts out of service.
39
40 // This can happen if Phabricator starts during a disaster and some
41 // databases can not be reached. We allow Phabricator to start up in
42 // this situation, since it may still be able to usefully serve requests
43 // without risk to data.
44
45 // However, if databases later become reachable and we learn that they
46 // are fatally misconfigured, we want to tear the world down again
47 // because data may be at risk.
48 PhabricatorSetupCheck::resetSetupState();
49
50 return PhabricatorSetupCheck::newIssueResponse($fatal_issue);
51 }
52
53 $issue_keys = PhabricatorSetupCheck::getUnignoredIssueKeys($issues);
54
55 PhabricatorSetupCheck::setOpenSetupIssueKeys(
56 $issue_keys,
57 $update_database = true);
58
59 $this->issues = $issues;
60
61 return null;
62 }
63
64}