Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15482011
D10339.id24892.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D10339.id24892.diff
View Options
diff --git a/resources/sql/autopatches/20140822.daemonenvhash.sql b/resources/sql/autopatches/20140822.daemonenvhash.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20140822.daemonenvhash.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_daemon.daemon_log
+ ADD COLUMN `envHash` CHAR(40) NOT NULL DEFAULT '' AFTER `dateModified`;
diff --git a/src/applications/config/check/PhabricatorSetupCheckDaemons.php b/src/applications/config/check/PhabricatorSetupCheckDaemons.php
--- a/src/applications/config/check/PhabricatorSetupCheckDaemons.php
+++ b/src/applications/config/check/PhabricatorSetupCheckDaemons.php
@@ -31,6 +31,7 @@
'a',
array(
'href' => $doc_href,
+ 'target' => '_blank'
),
pht('Managing Daemons with phd')));
@@ -42,5 +43,44 @@
->addCommand('phabricator/ $ ./bin/phd start');
}
+ $environment_hash = PhabricatorEnv::calculateEnvironmentHash();
+ $all_daemons = id(new PhabricatorDaemonLogQuery())
+ ->setViewer(PhabricatorUser::getOmnipotentUser())
+ ->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE)
+ ->execute();
+ foreach ($all_daemons as $daemon) {
+ if ($daemon->getEnvHash() != $environment_hash) {
+ $doc_href = PhabricatorEnv::getDocLink(
+ 'Managing Daemons with phd');
+
+ $summary = pht(
+ 'You should restart the daemons. Their configuration is out of '.
+ 'date.');
+
+ $message = pht(
+ 'The Phabricator daemons are running with an out of date '.
+ 'configuration. If you are making multiple configuration changes, '.
+ 'you only need to restart the daemons once after the last change.'.
+ "\n\n".
+ 'Use %s to restart daemons. See %s for more information.',
+ phutil_tag('tt', array(), 'bin/phd restart'),
+ phutil_tag(
+ 'a',
+ array(
+ 'href' => $doc_href,
+ 'target' => '_blank'
+ ),
+ pht('Managing Daemons with phd')));
+
+ $this->newIssue('daemons.need-restarting')
+ ->setShortName(pht('Daemons Need Restarting'))
+ ->setName(pht('Phabricator Daemons Need Restarting'))
+ ->setSummary($summary)
+ ->setMessage($message)
+ ->addCommand('phabricator/ $ ./bin/phd restart');
+ break;
+ }
+ }
}
+
}
diff --git a/src/applications/daemon/event/PhabricatorDaemonEventListener.php b/src/applications/daemon/event/PhabricatorDaemonEventListener.php
--- a/src/applications/daemon/event/PhabricatorDaemonEventListener.php
+++ b/src/applications/daemon/event/PhabricatorDaemonEventListener.php
@@ -39,6 +39,7 @@
->setDaemon($event->getValue('daemonClass'))
->setHost(php_uname('n'))
->setPID(getmypid())
+ ->setEnvHash(PhabricatorEnv::calculateEnvironmentHash())
->setStatus(PhabricatorDaemonLog::STATUS_RUNNING)
->setArgv($event->getValue('argv'))
->setExplicitArgv($event->getValue('explicitArgv'))
diff --git a/src/applications/daemon/storage/PhabricatorDaemonLog.php b/src/applications/daemon/storage/PhabricatorDaemonLog.php
--- a/src/applications/daemon/storage/PhabricatorDaemonLog.php
+++ b/src/applications/daemon/storage/PhabricatorDaemonLog.php
@@ -15,6 +15,7 @@
protected $pid;
protected $argv;
protected $explicitArgv = array();
+ protected $envHash;
protected $status;
public function getConfiguration() {
diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php
--- a/src/infrastructure/env/PhabricatorEnv.php
+++ b/src/infrastructure/env/PhabricatorEnv.php
@@ -221,6 +221,15 @@
return $env;
}
+ public static function calculateEnvironmentHash() {
+ $keys = array_keys(self::getAllConfigKeys());
+ $values = array();
+ foreach ($keys as $key) {
+ $values[$key] = self::getEnvConfigIfExists($key);
+ }
+ return PhabricatorHash::digest(json_encode($values));
+ }
+
/* -( Reading Configuration )---------------------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 10, 1:58 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7706287
Default Alt Text
D10339.id24892.diff (4 KB)
Attached To
Mode
D10339: Daemons - add a config check for out of date daemon environment
Attached
Detach File
Event Timeline
Log In to Comment