Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/check/PhabricatorSetupCheckDaemons.php
| Show All 37 Lines | if (!$task_daemon) { | ||||
| $this->newIssue('daemons.not-running') | $this->newIssue('daemons.not-running') | ||||
| ->setShortName(pht('Daemons Not Running')) | ->setShortName(pht('Daemons Not Running')) | ||||
| ->setName(pht('Phabricator Daemons Are Not Running')) | ->setName(pht('Phabricator Daemons Are Not Running')) | ||||
| ->setSummary($summary) | ->setSummary($summary) | ||||
| ->setMessage($message) | ->setMessage($message) | ||||
| ->addCommand('phabricator/ $ ./bin/phd start'); | ->addCommand('phabricator/ $ ./bin/phd start'); | ||||
| } | } | ||||
| $phd_user = PhabricatorEnv::getEnvConfig('phd.user'); | |||||
| $environment_hash = PhabricatorEnv::calculateEnvironmentHash(); | $environment_hash = PhabricatorEnv::calculateEnvironmentHash(); | ||||
| $all_daemons = id(new PhabricatorDaemonLogQuery()) | $all_daemons = id(new PhabricatorDaemonLogQuery()) | ||||
| ->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer(PhabricatorUser::getOmnipotentUser()) | ||||
| ->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE) | ->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE) | ||||
| ->execute(); | ->execute(); | ||||
| foreach ($all_daemons as $daemon) { | foreach ($all_daemons as $daemon) { | ||||
| if ($phd_user) { | |||||
| if ($daemon->getRunningAsUser() != $phd_user) { | |||||
| $doc_href = PhabricatorEnv::getDocLink( | |||||
| 'Managing Daemons with phd'); | |||||
| $summary = pht( | |||||
| 'At least one daemon is currently running as a different '. | |||||
| 'user than configured in the Phabricator phd.user setting'); | |||||
| $message = pht( | |||||
| 'A daemon is running as user %s while the Phabricator config '. | |||||
| 'specifies phd.user to be %s.'. | |||||
| "\n\n". | |||||
| 'Either adjust phd.user to match %s or start '. | |||||
| 'the daemons as the correct user. '. | |||||
| "\n\n". | |||||
| 'phd Daemons will try to '. | |||||
| 'use sudo to start as the configured user. '. | |||||
| 'Make sure that the user who starts phd has the correct '. | |||||
| 'sudo permissions to start phd daemons as %s', | |||||
| phutil_tag('tt', array(), $daemon->getRunningAsUser()), | |||||
| phutil_tag('tt', array(), $phd_user), | |||||
| phutil_tag('tt', array(), $daemon->getRunningAsUser()), | |||||
| phutil_tag('tt', array(), $phd_user)); | |||||
| $this->newIssue('daemons.run-as-different-user') | |||||
| ->setName(pht('Daemons are running as the wrong user')) | |||||
| ->setSummary($summary) | |||||
| ->setMessage($message) | |||||
| ->addCommand('phabricator/ $ ./bin/phd restart'); | |||||
| } | |||||
| } | |||||
| if ($daemon->getEnvHash() != $environment_hash) { | if ($daemon->getEnvHash() != $environment_hash) { | ||||
| $doc_href = PhabricatorEnv::getDocLink( | $doc_href = PhabricatorEnv::getDocLink( | ||||
| 'Managing Daemons with phd'); | 'Managing Daemons with phd'); | ||||
| $summary = pht( | $summary = pht( | ||||
| 'At least one daemon is currently running with different '. | 'At least one daemon is currently running with different '. | ||||
| 'configuration than the Phabricator web application.'); | 'configuration than the Phabricator web application.'); | ||||
| ▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines | |||||