Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14058754
D14446.id34938.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
D14446.id34938.diff
View Options
diff --git a/resources/sql/autopatches/20151110.daemonenvhash.sql b/resources/sql/autopatches/20151110.daemonenvhash.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20151110.daemonenvhash.sql
@@ -0,0 +1,5 @@
+ALTER TABLE {$NAMESPACE}_daemon.daemon_log
+ DROP COLUMN envHash;
+
+ALTER TABLE {$NAMESPACE}_daemon.daemon_log
+ DROP COLUMN envInfo;
diff --git a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
--- a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
+++ b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
@@ -91,107 +91,6 @@
->addCommand('phabricator/ $ ./bin/phd restart');
}
}
-
- if ($daemon->getEnvHash() != $environment_hash) {
- $doc_href = PhabricatorEnv::getDocLink(
- 'Managing Daemons with phd');
-
- $summary = pht(
- 'At least one daemon is currently running with different '.
- 'configuration than the Phabricator web application.');
-
- $list_section = null;
- $env_info = $daemon->getEnvInfo();
- if ($env_info) {
- $issues = PhabricatorEnv::compareEnvironmentInfo(
- PhabricatorEnv::calculateEnvironmentInfo(),
- $env_info);
-
- if ($issues) {
- foreach ($issues as $key => $issue) {
- $issues[$key] = phutil_tag('li', array(), $issue);
- }
-
- $list_section = array(
- pht(
- 'The configurations differ in the following %s way(s):',
- phutil_count($issues)),
- phutil_tag(
- 'ul',
- array(),
- $issues),
- );
- }
- }
-
-
- $message = pht(
- 'At least one daemon is currently running with a different '.
- 'configuration (config checksum %s) than the web application '.
- '(config checksum %s).'.
- "\n\n%s".
- 'This usually means that you have just made a configuration change '.
- 'from the web UI, but have not yet restarted the daemons. You '.
- 'need to restart the daemons after making configuration changes '.
- 'so they will pick up the new values: until you do, they will '.
- 'continue operating with the old settings.'.
- "\n\n".
- '(If you plan to make more changes, you can restart the daemons '.
- 'once after you finish making all of your changes.)'.
- "\n\n".
- 'Use %s to restart daemons. You can find a list of running daemons '.
- 'in the %s, which will also help you identify which daemon (or '.
- 'daemons) have divergent configuration. For more information about '.
- 'managing the daemons, see %s in the documentation.'.
- "\n\n".
- 'This can also happen if you use the %s environmental variable to '.
- 'choose a configuration file, but the daemons run with a different '.
- 'value than the web application. If restarting the daemons does '.
- 'not resolve this issue and you use %s to select configuration, '.
- 'check that it is set consistently.'.
- "\n\n".
- 'A third possible cause is that you run several machines, and '.
- 'the %s configuration file differs between them. This file is '.
- 'updated when you edit configuration from the CLI with %s. If '.
- 'restarting the daemons does not resolve this issue and you '.
- 'run multiple machines, check that all machines have identical '.
- '%s configuration files.'.
- "\n\n".
- 'This issue is not severe, but usually indicates that something '.
- 'is not configured the way you expect, and may cause the daemons '.
- 'to exhibit different behavior than the web application does.',
-
- phutil_tag('tt', array(), substr($daemon->getEnvHash(), 0, 12)),
- phutil_tag('tt', array(), substr($environment_hash, 0, 12)),
- $list_section,
- phutil_tag('tt', array(), 'bin/phd restart'),
- phutil_tag(
- 'a',
- array(
- 'href' => '/daemon/',
- 'target' => '_blank',
- ),
- pht('Daemon Console')),
- phutil_tag(
- 'a',
- array(
- 'href' => $doc_href,
- 'target' => '_blank',
- ),
- pht('Managing Daemons with phd')),
- phutil_tag('tt', array(), 'PHABRICATOR_ENV'),
- phutil_tag('tt', array(), 'PHABRICATOR_ENV'),
- phutil_tag('tt', array(), 'phabricator/conf/local/local.json'),
- phutil_tag('tt', array(), 'bin/config'),
- phutil_tag('tt', array(), 'phabricator/conf/local/local.json'));
-
- $this->newIssue('daemons.need-restarting')
- ->setName(pht('Daemons and Web Have Different Config'))
- ->setSummary($summary)
- ->setMessage($message)
- ->addCommand('phabricator/ $ ./bin/phd restart');
- break;
- }
}
}
diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php
--- a/src/applications/config/controller/PhabricatorConfigEditController.php
+++ b/src/applications/config/controller/PhabricatorConfigEditController.php
@@ -73,7 +73,6 @@
$errors = array_merge($errors, $value_errors);
if (!$errors) {
-
$editor = id(new PhabricatorConfigEditor())
->setActor($viewer)
->setContinueOnNoEffect(true)
diff --git a/src/applications/config/editor/PhabricatorConfigEditor.php b/src/applications/config/editor/PhabricatorConfigEditor.php
--- a/src/applications/config/editor/PhabricatorConfigEditor.php
+++ b/src/applications/config/editor/PhabricatorConfigEditor.php
@@ -110,27 +110,48 @@
protected function didApplyTransactions(array $xactions) {
// Force all the setup checks to run on the next page load.
PhabricatorSetupCheck::deleteSetupCheckCache();
- }
- public static function storeNewValue(
- PhabricatorUser $user,
- PhabricatorConfigEntry $config_entry,
- $value,
- PhabricatorContentSource $source) {
+ static $updating_config_hash = false;
+ if (!$updating_config_hash) {
+ $updating_config_hash = true;
+ $this->updateConfigHash();
+ $updating_config_hash = false;
+ }
+ }
+
+ public function updateConfigHash() {
$xaction = id(new PhabricatorConfigTransaction())
->setTransactionType(PhabricatorConfigTransaction::TYPE_EDIT)
->setNewValue(
array(
- 'deleted' => false,
- 'value' => $value,
+ 'deleted' => false,
+ 'value' => PhabricatorEnv::calculateEnvironmentHash(),
));
+ $this->applyTransactions(
+ PhabricatorConfigEntry::loadConfigEntry('config.hash'),
+ array($xaction));
+ }
+
+ public static function storeNewValue(
+ PhabricatorUser $user,
+ PhabricatorConfigEntry $config_entry,
+ $value,
+ PhabricatorContentSource $source) {
+
$editor = id(new PhabricatorConfigEditor())
->setActor($user)
->setContinueOnNoEffect(true)
->setContentSource($source);
+ $xaction = id(new PhabricatorConfigTransaction())
+ ->setTransactionType(PhabricatorConfigTransaction::TYPE_EDIT)
+ ->setNewValue(
+ array(
+ 'deleted' => false,
+ 'value' => $value,
+ ));
$editor->applyTransactions($config_entry, array($xaction));
}
diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php
--- a/src/applications/config/option/PhabricatorCoreConfigOptions.php
+++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php
@@ -197,6 +197,9 @@
$this->newOption('test.value', 'wild', null)
->setLocked(true)
->setDescription(pht('Unit test value.')),
+ $this->newOption('config.hash', 'string', null)
+ ->setLocked(true)
+ ->setDescription(pht('TODO.')),
$this->newOption('phabricator.uninstalled-applications', 'set', array())
->setLocked(true)
->setLockedMessage(pht(
diff --git a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
--- a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
+++ b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
@@ -59,13 +59,6 @@
$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);
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
@@ -42,8 +42,6 @@
->setHost(php_uname('n'))
->setPID(getmypid())
->setRunningAsUser($current_user['name'])
- ->setEnvHash(PhabricatorEnv::calculateEnvironmentHash())
- ->setEnvInfo(PhabricatorEnv::calculateEnvironmentInfo())
->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
@@ -17,8 +17,6 @@
protected $runningAsUser;
protected $argv;
protected $explicitArgv = array();
- protected $envHash;
- protected $envInfo;
protected $status;
protected function getConfiguration() {
@@ -26,14 +24,12 @@
self::CONFIG_SERIALIZATION => array(
'argv' => self::SERIALIZATION_JSON,
'explicitArgv' => self::SERIALIZATION_JSON,
- 'envInfo' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'daemon' => 'text255',
'host' => 'text255',
'pid' => 'uint32',
'runningAsUser' => 'text255?',
- 'envHash' => 'bytes40',
'status' => 'text8',
'daemonID' => 'text64',
),
diff --git a/src/applications/daemon/view/PhabricatorDaemonLogListView.php b/src/applications/daemon/view/PhabricatorDaemonLogListView.php
--- a/src/applications/daemon/view/PhabricatorDaemonLogListView.php
+++ b/src/applications/daemon/view/PhabricatorDaemonLogListView.php
@@ -33,15 +33,8 @@
$status = $log->getStatus();
switch ($status) {
case PhabricatorDaemonLog::STATUS_RUNNING:
- if ($env_hash != $log->getEnvHash()) {
- $item->setStatusIcon('fa-warning yellow');
- $item->addAttribute(pht(
- 'This daemon is running with an out of date configuration and '.
- 'should be restarted.'));
- } else {
- $item->setStatusIcon('fa-rocket green');
- $item->addAttribute(pht('This daemon is running.'));
- }
+ $item->setStatusIcon('fa-rocket green');
+ $item->addAttribute(pht('This daemon is running.'));
break;
case PhabricatorDaemonLog::STATUS_DEAD:
$item->setStatusIcon('fa-warning red');
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
@@ -374,6 +374,8 @@
sort($keys);
$skip_keys = self::getEnvConfig('phd.variant-config');
+ $skip_keys[] = 'config.hash';
+
return array_diff($keys, $skip_keys);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 2:29 PM (3 h, 48 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6763403
Default Alt Text
D14446.id34938.diff (11 KB)
Attached To
Mode
D14446: Remove daemon envHash and envInfo
Attached
Detach File
Event Timeline
Log In to Comment