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 databases connection information and MySQL are ".
32 "correctly configured.",
35 $issue = id(new self())
36 ->setIssueKey('mysql.connect')
37 ->setName(pht('Can Not Connect to MySQL'))
38 ->setMessage($message)
39 ->setIsFatal($is_fatal)
40 ->addRelatedPhabricatorConfig('mysql.host')
41 ->addRelatedPhabricatorConfig('mysql.port')
42 ->addRelatedPhabricatorConfig('mysql.user')
43 ->addRelatedPhabricatorConfig('mysql.pass');
45 if (PhabricatorEnv
::getEnvConfig('cluster.databases')) {
46 $issue->addRelatedPhabricatorConfig('cluster.databases');
52 public function addCommand($command) {
53 $this->commands
[] = $command;
57 public function getCommands() {
58 return $this->commands
;
61 public function setShortName($short_name) {
62 $this->shortName
= $short_name;
66 public function getShortName() {
67 if ($this->shortName
=== null) {
68 return $this->getName();
70 return $this->shortName
;
73 public function setDatabaseRef(PhabricatorDatabaseRef
$database_ref) {
74 $this->databaseRef
= $database_ref;
78 public function getDatabaseRef() {
79 return $this->databaseRef
;
82 public function setGroup($group) {
83 $this->group
= $group;
87 public function getGroup() {
91 return PhabricatorSetupCheck
::GROUP_OTHER
;
95 public function setName($name) {
100 public function getName() {
104 public function setSummary($summary) {
105 $this->summary
= $summary;
109 public function getSummary() {
110 if ($this->summary
=== null) {
111 return $this->getMessage();
113 return $this->summary
;
116 public function setIssueKey($issue_key) {
117 $this->issueKey
= $issue_key;
121 public function getIssueKey() {
122 return $this->issueKey
;
125 public function setIsFatal($is_fatal) {
126 $this->isFatal
= $is_fatal;
130 public function getIsFatal() {
131 return $this->isFatal
;
134 public function addPHPConfig($php_config) {
135 $this->phpConfig
[] = $php_config;
140 * Set an explicit value to display when showing the user PHP configuration
143 * If Phabricator has changed a value by the time a config issue is raised,
144 * you can provide the original value here so the UI makes sense. For example,
145 * we alter `memory_limit` during startup, so if the original value is not
146 * provided it will look like it is always set to `-1`.
148 * @param string PHP configuration option to provide a value for.
149 * @param string Explicit value to show in the UI.
152 public function addPHPConfigOriginalValue($php_config, $value) {
153 $this->originalPHPConfigValues
[$php_config] = $value;
157 public function getPHPConfigOriginalValue($php_config, $default = null) {
158 return idx($this->originalPHPConfigValues
, $php_config, $default);
161 public function getPHPConfig() {
162 return $this->phpConfig
;
165 public function addMySQLConfig($mysql_config) {
166 $this->mysqlConfig
[] = $mysql_config;
170 public function getMySQLConfig() {
171 return $this->mysqlConfig
;
174 public function addPhabricatorConfig($phabricator_config) {
175 $this->phabricatorConfig
[] = $phabricator_config;
179 public function getPhabricatorConfig() {
180 return $this->phabricatorConfig
;
183 public function addRelatedPhabricatorConfig($phabricator_config) {
184 $this->relatedPhabricatorConfig
[] = $phabricator_config;
188 public function getRelatedPhabricatorConfig() {
189 return $this->relatedPhabricatorConfig
;
192 public function addPHPExtension($php_extension) {
193 $this->phpExtensions
[] = $php_extension;
197 public function getPHPExtensions() {
198 return $this->phpExtensions
;
201 public function setMessage($message) {
202 $this->message
= $message;
206 public function getMessage() {
207 return $this->message
;
210 public function setIsIgnored($is_ignored) {
211 $this->isIgnored
= $is_ignored;
215 public function getIsIgnored() {
216 return $this->isIgnored
;
219 public function addLink($href, $name) {
220 $this->links
[] = array(
227 public function getLinks() {