summaryrefslogtreecommitdiff
path: root/includes/cache-install.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-03 05:18:06 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-03 05:18:06 +0000
commita986e349fa3676fce41f2aa02fb7b67fc24dacda (patch)
tree2a562718ed07e59342e17116cb368fc353b466af /includes/cache-install.inc
parentc6e2dfa5730568a117523a1bcf2cfd54ee34defe (diff)
downloadbrdo-a986e349fa3676fce41f2aa02fb7b67fc24dacda.tar.gz
brdo-a986e349fa3676fce41f2aa02fb7b67fc24dacda.tar.bz2
#605880 by bleen18 and David_Rothstein: Fix weird bugs with settings and menus after install due to faulty caching.
Diffstat (limited to 'includes/cache-install.inc')
-rw-r--r--includes/cache-install.inc30
1 files changed, 25 insertions, 5 deletions
diff --git a/includes/cache-install.inc b/includes/cache-install.inc
index 3be7588eb..56bf3eb52 100644
--- a/includes/cache-install.inc
+++ b/includes/cache-install.inc
@@ -10,10 +10,7 @@
* implementation during normal operations would have a negative impact
* on performance.
*/
-class DrupalFakeCache implements DrupalCacheInterface {
- function __construct($bin) {
- }
-
+class DrupalFakeCache extends DrupalDatabaseCache implements DrupalCacheInterface {
function get($cid) {
return FALSE;
}
@@ -22,11 +19,34 @@ class DrupalFakeCache implements DrupalCacheInterface {
return array();
}
-
function set($cid, $data, $expire = CACHE_PERMANENT, array $headers = NULL) {
}
function clear($cid = NULL, $wildcard = FALSE) {
+ // If there is a database cache, attempt to clear it whenever possible. The
+ // reason for doing this is that the database cache can accumulate data
+ // during installation due to any full bootstraps that may occur at the
+ // same time (for example, AJAX requests triggered by the installer). If we
+ // didn't try to clear it whenever this function is called, the data in the
+ // cache would become stale; for example, the installer sometimes calls
+ // variable_set(), which updates the {variable} table and then clears the
+ // cache to make sure that the next page request picks up the new value.
+ // Not actually clearing the cache here therefore leads old variables to be
+ // loaded on the first page requests after installation, which can cause
+ // subtle bugs, some of which would not be fixed unless the site
+ // administrator cleared the cache manually.
+ try {
+ if (function_exists('drupal_install_initialize_database')) {
+ drupal_install_initialize_database();
+ parent::clear($cid, $wildcard);
+ }
+ }
+ // If the attempt at clearing the cache causes an error, that means that
+ // either the database connection is not set up yet or the relevant cache
+ // table in the database has not yet been created, so we can safely do
+ // nothing here.
+ catch (Exception $e) {
+ }
}
function isEmpty() {