summaryrefslogtreecommitdiff
path: root/includes/theme.inc
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-01-30 20:24:49 -0800
committerwebchick <webchick@24967.no-reply.drupal.org>2012-01-30 20:24:49 -0800
commitbbede7f65093c4f85a99dc94282809436effc799 (patch)
treeb6819bd0f2defca621cea1927f1f9e2f4767ef28 /includes/theme.inc
parentc367b7d954e04cd10008c0f6111cb36c67b0ba0c (diff)
downloadbrdo-bbede7f65093c4f85a99dc94282809436effc799.tar.gz
brdo-bbede7f65093c4f85a99dc94282809436effc799.tar.bz2
Issue #1371484 by catch, langworthy, makara, ArtistConk: Fixed Private properties in abstract class DrupalCacheArray.
Diffstat (limited to 'includes/theme.inc')
-rw-r--r--includes/theme.inc42
1 files changed, 27 insertions, 15 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index 9a921decc..da4200e56 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -372,23 +372,31 @@ class ThemeRegistry Extends DrupalCacheArray {
$data = $cached->data;
}
else {
- $complete_registry = theme_get_registry();
+ // If there is no runtime cache stored, fetch the full theme registry,
+ // but then initialize each value to NULL. This allows offsetExists()
+ // to function correctly on non-registered theme hooks without triggering
+ // a call to resolveCacheMiss().
+ $data = $this->initializeRegistry();
if ($this->persistable) {
- // If there is no runtime cache stored, fetch the full theme registry,
- // but then initialize each value to NULL. This allows
- // offsetExists() to function correctly on non-registered theme hooks
- // without triggering a call to resolveCacheMiss().
- $data = array_fill_keys(array_keys($complete_registry), NULL);
- $this->set($this->cid, $data, $this->bin);
- $this->completeRegistry = $complete_registry;
- }
- else {
- $data = $complete_registry;
+ $this->set($data);
}
}
$this->storage = $data;
}
+ /**
+ * Initializes the full theme registry.
+ *
+ * @return
+ * An array with the keys of the full theme registry, but the values
+ * initialized to NULL.
+ */
+ function initializeRegistry() {
+ $this->completeRegistry = theme_get_registry();
+
+ return array_fill_keys(array_keys($this->completeRegistry), NULL);
+ }
+
public function offsetExists($offset) {
// Since the theme registry allows for theme hooks to be requested that
// are not registered, just check the existence of the key in the registry.
@@ -420,15 +428,19 @@ class ThemeRegistry Extends DrupalCacheArray {
return $this->storage[$offset];
}
- public function set($cid, $data, $bin, $lock = TRUE) {
- $lock_name = $cid . ':' . $bin;
+ public function set($data, $lock = TRUE) {
+ $lock_name = $this->cid . ':' . $this->bin;
if (!$lock || lock_acquire($lock_name)) {
- if ($cached = cache_get($cid, $this->bin)) {
+ if ($cached = cache_get($this->cid, $this->bin)) {
// Use array merge instead of union so that filled in values in $data
// overwrite empty values in the current cache.
$data = array_merge($cached->data, $data);
}
- cache_set($cid, $data, $bin);
+ else {
+ $registry = $this->initializeRegistry();
+ $data = array_merge($registry, $data);
+ }
+ cache_set($this->cid, $data, $this->bin);
if ($lock) {
lock_release($lock_name);
}