Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15385551
D10339.id24889.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D10339.id24889.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
@@ -42,5 +42,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,
+ ),
+ 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;
+ }
+ }
}
+
+ private function getDaemonReferenceString() {
+ }
}
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
Mar 15 2025, 10:50 PM (7 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7686900
Default Alt Text
D10339.id24889.diff (3 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