From 3cd0001d8b95897d5efafa0c391a9e870fd35471 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 11 Dec 2016 07:15:32 -0800 Subject: [PATCH] (stable) Fix two cache issues (global settings; initial setup) Summary: - Fixes T11995. This got moved but I missed renaming this callsite. - Fixes T11993. If you have valid credentials, but haven't run `storage upgrade` yet, we can hit this exception during setup. Just ignore it instead. Test Plan: - Saved global settings, no more fatal. - Changed `storage-namespace` to junk, loaded web UI with valid database credentials. {F2106358} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11993, T11995 Differential Revision: https://secure.phabricator.com/D17024 --- src/applications/config/check/PhabricatorSetupCheck.php | 8 ++------ .../settings/editor/PhabricatorUserPreferencesEditor.php | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php index 0d9101efe3..e0574b7636 100644 --- a/src/applications/config/check/PhabricatorSetupCheck.php +++ b/src/applications/config/check/PhabricatorSetupCheck.php @@ -82,12 +82,12 @@ abstract class PhabricatorSetupCheck extends Phobject { AphrontWriteGuard::allowDangerousUnguardedWrites(true); } - $caught = null; try { $db_cache = new PhabricatorKeyValueDatabaseCache(); $db_cache->deleteKey('phabricator.setup.issue-keys'); } catch (Exception $ex) { - $caught = $ex; + // If we hit an exception here, just ignore it. In particular, this can + // happen on initial startup before the databases are initialized. } if ($use_scope) { @@ -95,10 +95,6 @@ abstract class PhabricatorSetupCheck extends Phobject { } else { AphrontWriteGuard::allowDangerousUnguardedWrites(false); } - - if ($caught) { - throw $caught; - } } final public static function setOpenSetupIssueKeys( diff --git a/src/applications/settings/editor/PhabricatorUserPreferencesEditor.php b/src/applications/settings/editor/PhabricatorUserPreferencesEditor.php index c2ec0a7094..a927cc7475 100644 --- a/src/applications/settings/editor/PhabricatorUserPreferencesEditor.php +++ b/src/applications/settings/editor/PhabricatorUserPreferencesEditor.php @@ -159,7 +159,7 @@ final class PhabricatorUserPreferencesEditor $user_phid); } else { $cache = PhabricatorCaches::getMutableStructureCache(); - $cache->deleteKey(PhabricatorUserPreferences::getGlobalCacheKey()); + $cache->deleteKey(PhabricatorUser::getGlobalSettingsCacheKey()); PhabricatorUserCache::clearCacheForAllUsers( PhabricatorUserPreferencesCacheType::KEY_PREFERENCES);