3 final class PhabricatorSetupIssue
extends Phobject
{
14 private $isIgnored = false;
15 private $phpExtensions = array();
16 private $phabricatorConfig = array();
17 private $relatedPhabricatorConfig = array();
18 private $phpConfig = array();
19 private $commands = array();
20 private $mysqlConfig = array();
21 private $originalPHPConfigValues = array();
24 public static function newDatabaseConnectionIssue(
29 "Unable to connect to MySQL!\n\n".
31 "Make sure Phabricator and MySQL are correctly configured.",
34 $issue = id(new self())
35 ->setIssueKey('mysql.connect')
36 ->setName(pht('Can Not Connect to MySQL'))
37 ->setMessage($message)
38 ->setIsFatal($is_fatal)
39 ->addRelatedPhabricatorConfig('mysql.host')
40 ->addRelatedPhabricatorConfig('mysql.port')
41 ->addRelatedPhabricatorConfig('mysql.user')
42 ->addRelatedPhabricatorConfig('mysql.pass');
44 if (PhabricatorEnv
::getEnvConfig('cluster.databases')) {
45 $issue->addRelatedPhabricatorConfig('cluster.databases');
51 public function addCommand($command) {
52 $this->commands
[] = $command;
56 public function getCommands() {
57 return $this->commands
;
60 public function setShortName($short_name) {
61 $this->shortName
= $short_name;
65 public function getShortName() {
66 if ($this->shortName
=== null) {
67 return $this->getName();
69 return $this->shortName
;
72 public function setDatabaseRef(PhabricatorDatabaseRef
$database_ref) {
73 $this->databaseRef
= $database_ref;
77 public function getDatabaseRef() {
78 return $this->databaseRef
;
81 public function setGroup($group) {
82 $this->group
= $group;
86 public function getGroup() {
90 return PhabricatorSetupCheck
::GROUP_OTHER
;
94 public function setName($name) {
99 public function getName() {
103 public function setSummary($summary) {
104 $this->summary
= $summary;
108 public function getSummary() {
109 if ($this->summary
=== null) {
110 return $this->getMessage();
112 return $this->summary
;
115 public function setIssueKey($issue_key) {
116 $this->issueKey
= $issue_key;
120 public function getIssueKey() {
121 return $this->issueKey
;
124 public function setIsFatal($is_fatal) {
125 $this->isFatal
= $is_fatal;
129 public function getIsFatal() {
130 return $this->isFatal
;
133 public function addPHPConfig($php_config) {
134 $this->phpConfig
[] = $php_config;
139 * Set an explicit value to display when showing the user PHP configuration
142 * If Phabricator has changed a value by the time a config issue is raised,
143 * you can provide the original value here so the UI makes sense. For example,
144 * we alter `memory_limit` during startup, so if the original value is not
145 * provided it will look like it is always set to `-1`.
147 * @param string PHP configuration option to provide a value for.
148 * @param string Explicit value to show in the UI.
151 public function addPHPConfigOriginalValue($php_config, $value) {
152 $this->originalPHPConfigValues
[$php_config] = $value;
156 public function getPHPConfigOriginalValue($php_config, $default = null) {
157 return idx($this->originalPHPConfigValues
, $php_config, $default);
160 public function getPHPConfig() {
161 return $this->phpConfig
;
164 public function addMySQLConfig($mysql_config) {
165 $this->mysqlConfig
[] = $mysql_config;
169 public function getMySQLConfig() {
170 return $this->mysqlConfig
;
173 public function addPhabricatorConfig($phabricator_config) {
174 $this->phabricatorConfig
[] = $phabricator_config;
178 public function getPhabricatorConfig() {
179 return $this->phabricatorConfig
;
182 public function addRelatedPhabricatorConfig($phabricator_config) {
183 $this->relatedPhabricatorConfig
[] = $phabricator_config;
187 public function getRelatedPhabricatorConfig() {
188 return $this->relatedPhabricatorConfig
;
191 public function addPHPExtension($php_extension) {
192 $this->phpExtensions
[] = $php_extension;
196 public function getPHPExtensions() {
197 return $this->phpExtensions
;
200 public function setMessage($message) {
201 $this->message
= $message;
205 public function getMessage() {
206 return $this->message
;
209 public function setIsIgnored($is_ignored) {
210 $this->isIgnored
= $is_ignored;
214 public function getIsIgnored() {
215 return $this->isIgnored
;
218 public function addLink($href, $name) {
219 $this->links
[] = array(
226 public function getLinks() {