mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Daemons - add status of environment to daemon console, etc
Summary: Shows the UI everywhere. Also asort() the keys before calculating the environment hash as that is probably an issue for someone at some point we just don't need to have. Ref T5968. Test Plan: Viewed the setup check and saw a link to the daemon console. Viewed the daemon console and saw the various stale config daemons. Clicked a daemon and saw a "stale config" header icon where expected. Restarted daemons and all of this went away. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5968 Differential Revision: https://secure.phabricator.com/D10367
This commit is contained in:
parent
0988ddbf2f
commit
c2874945c8
4 changed files with 28 additions and 3 deletions
|
@ -62,8 +62,15 @@ final class PhabricatorSetupCheckDaemons extends PhabricatorSetupCheck {
|
||||||
'configuration. If you are making multiple configuration changes, '.
|
'configuration. If you are making multiple configuration changes, '.
|
||||||
'you only need to restart the daemons once after the last change.'.
|
'you only need to restart the daemons once after the last change.'.
|
||||||
"\n\n".
|
"\n\n".
|
||||||
'Use %s to restart daemons. See %s for more information.',
|
'Use %s to restart daemons. See the %s or %s for more information.',
|
||||||
phutil_tag('tt', array(), 'bin/phd restart'),
|
phutil_tag('tt', array(), 'bin/phd restart'),
|
||||||
|
phutil_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '/daemon/',
|
||||||
|
'target' => '_blank'
|
||||||
|
),
|
||||||
|
pht('Daemon Console')),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -64,6 +64,14 @@ final class PhabricatorDaemonLogViewController
|
||||||
}
|
}
|
||||||
|
|
||||||
$header->addTag($tag);
|
$header->addTag($tag);
|
||||||
|
$env_hash = PhabricatorEnv::calculateEnvironmentHash();
|
||||||
|
if ($log->getEnvHash() != $env_hash) {
|
||||||
|
$tag = id(new PHUITagView())
|
||||||
|
->setType(PHUITagView::TYPE_STATE)
|
||||||
|
->setBackgroundColor(PHUITagView::COLOR_YELLOW)
|
||||||
|
->setName(pht('Stale Config'));
|
||||||
|
$header->addTag($tag);
|
||||||
|
}
|
||||||
|
|
||||||
$properties = $this->buildPropertyListView($log);
|
$properties = $this->buildPropertyListView($log);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ final class PhabricatorDaemonLogListView extends AphrontView {
|
||||||
throw new Exception('Call setUser() before rendering!');
|
throw new Exception('Call setUser() before rendering!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$env_hash = PhabricatorEnv::calculateEnvironmentHash();
|
||||||
$list = new PHUIObjectItemListView();
|
$list = new PHUIObjectItemListView();
|
||||||
foreach ($this->daemonLogs as $log) {
|
foreach ($this->daemonLogs as $log) {
|
||||||
$id = $log->getID();
|
$id = $log->getID();
|
||||||
|
@ -31,8 +32,15 @@ final class PhabricatorDaemonLogListView extends AphrontView {
|
||||||
$status = $log->getStatus();
|
$status = $log->getStatus();
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
case PhabricatorDaemonLog::STATUS_RUNNING:
|
case PhabricatorDaemonLog::STATUS_RUNNING:
|
||||||
|
if ($env_hash != $log->getEnvHash()) {
|
||||||
|
$item->setBarColor('yellow');
|
||||||
|
$item->addAttribute(pht(
|
||||||
|
'This daemon is running with an out of date configuration and '.
|
||||||
|
'should be restarted.'));
|
||||||
|
} else {
|
||||||
$item->setBarColor('green');
|
$item->setBarColor('green');
|
||||||
$item->addAttribute(pht('This daemon is running.'));
|
$item->addAttribute(pht('This daemon is running.'));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PhabricatorDaemonLog::STATUS_DEAD:
|
case PhabricatorDaemonLog::STATUS_DEAD:
|
||||||
$item->setBarColor('red');
|
$item->setBarColor('red');
|
||||||
|
|
2
src/infrastructure/env/PhabricatorEnv.php
vendored
2
src/infrastructure/env/PhabricatorEnv.php
vendored
|
@ -223,6 +223,8 @@ final class PhabricatorEnv {
|
||||||
|
|
||||||
public static function calculateEnvironmentHash() {
|
public static function calculateEnvironmentHash() {
|
||||||
$keys = array_keys(self::getAllConfigKeys());
|
$keys = array_keys(self::getAllConfigKeys());
|
||||||
|
asort($keys);
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$values[$key] = self::getEnvConfigIfExists($key);
|
$values[$key] = self::getEnvConfigIfExists($key);
|
||||||
|
|
Loading…
Reference in a new issue