Skip to content
Permalink
Browse files

Do not assume SMART_CACHE object is loaded

  • Loading branch information...
chrisgraham committed Jun 24, 2019
1 parent 12112cf commit 6fc763958838ad8a757a0b22094adb66d57d4701
Showing with 16 additions and 6 deletions.
  1. +3 −1 sources/site.php
  2. +7 −3 sources/themes.php
  3. +6 −2 sources/web_resources.php
@@ -1629,7 +1629,9 @@ function load_comcode_page_from_cache($codename, $zone, $theme)
$tuple = array($codename, $zone, $theme);
global $SMART_CACHE;
$SMART_CACHE->append('comcode_pages_needed', serialize($tuple));
if ($SMART_CACHE !== null) {
$SMART_CACHE->append('comcode_pages_needed', serialize($tuple));
}
$ret = _load_comcodes_page_from_cache(array($tuple));
return isset($ret[0]) ? $ret[0] : null;
@@ -233,7 +233,9 @@ function find_theme_image($id, $silent_fail = false, $leave_local = false, $them
// Smart cache learning if we ended up having to bypass smart cache
if ((($THEME_IMAGES_LOAD_INTENSITY[$db_place] === THEME_IMAGES_LOAD_INTENSITY__ALL) || ($force_recache)) && (!$pure_only)) {
$SMART_CACHE->append('theme_images_' . $theme . '_' . $lang . '_' . strval($db_place), $id, $url_path);
if ($SMART_CACHE !== null) {
$SMART_CACHE->append('theme_images_' . $theme . '_' . $lang . '_' . strval($db_place), $id, $url_path);
}
}
if ($url_path !== '') {
@@ -294,8 +296,10 @@ function load_theme_image_cache($db, $db_place, $true_theme, $true_lang)
switch ($THEME_IMAGES_LOAD_INTENSITY[$db_place]) {
case THEME_IMAGES_LOAD_INTENSITY__NONE:
$THEME_IMAGES_CACHE[$db_place] = $SMART_CACHE->get('theme_images_' . $true_theme . '_' . $true_lang . '_' . strval($db_place));
if (is_null($THEME_IMAGES_CACHE[$db_place])) {
if ($SMART_CACHE !== null) {
$THEME_IMAGES_CACHE[$db_place] = $SMART_CACHE->get('theme_images_' . $true_theme . '_' . $true_lang . '_' . strval($db_place));
}
if (!isset($THEME_IMAGES_CACHE[$db_place])) {
$THEME_IMAGES_CACHE[$db_place] = array();
}
@@ -53,7 +53,9 @@ function require_javascript($javascript)
$JS_OUTPUT_STARTED_LIST[$javascript] = true;
if (strpos($javascript, 'merged__') === false) {
$SMART_CACHE->append('JAVASCRIPTS', $javascript);
if ($SMART_CACHE !== null) {
$SMART_CACHE->append('JAVASCRIPTS', $javascript);
}
}
if ((isset($GLOBALS['JS_OUTPUT_STARTED'])) && ($GLOBALS['JS_OUTPUT_STARTED'])) {
@@ -284,7 +286,9 @@ function require_css($css)
$CSS_OUTPUT_STARTED_LIST[$css] = true;
if (strpos($css, 'merged__') === false) {
$SMART_CACHE->append('CSSS', $css);
if ($SMART_CACHE !== null) {
$SMART_CACHE->append('CSSS', $css);
}
}
// Has to move into footer

0 comments on commit 6fc7639

Please sign in to comment.
You can’t perform that action at this time.