Skip to content

Commit

Permalink
Should fix #9255, this prevents an issue where we try to issue a back…
Browse files Browse the repository at this point in the history
…end command before we are connected to a backend.

(cherry picked from commit 7cb9061)
  • Loading branch information
kormoc committed Dec 21, 2010
1 parent cc03d21 commit 1a998aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions includes/db_update.php
Expand Up @@ -39,11 +39,11 @@
data BLOB NOT NULL,
INDEX (modified)
)');
setting('WebDBSchemaVer', null, ++$db_vers);
setting('WebDBSchemaVer', null, ++$db_vers, false);
// Moving settings into the database
case 1:
setting('WebPrefer_Channum', null, 1);
setting('WebDBSchemaVer', null, ++$db_vers);
setting('WebPrefer_Channum', null, 1, false);
setting('WebDBSchemaVer', null, ++$db_vers, false);
// All other numbers should run their changes sequentially
#case 2:
# # do something to upgrade the database here
Expand Down
5 changes: 3 additions & 2 deletions includes/utils.php
Expand Up @@ -30,7 +30,7 @@
*
* @return string The value (settings.data) associated with $field and $hostname.
/**/
function setting($field, $hostname=null, $new_value = "old\0old") {
function setting($field, $hostname=null, $new_value = "old\0old", $clearSettingsCache = true) {
global $db;
static $cache = array();
// Best not to have an array index that's null
Expand All @@ -54,7 +54,8 @@ function setting($field, $hostname=null, $new_value = "old\0old") {
// occasional times where setting() gets called before we're actually
// connected to the backend, the only known instance is in db_update.php
// and those settings don't affect anything but MythWeb.
MythBackend::find()->sendCommand('CLEAR_SETTINGS_CACHE');
if ($clearSettingsCache)
MythBackend::find()->sendCommand('CLEAR_SETTINGS_CACHE');
}
// Not cached?
elseif (!array_key_exists($field, $cache[$h])) {
Expand Down

0 comments on commit 1a998aa

Please sign in to comment.