Index: branches/5.2.x/core/kernel/application.php =================================================================== diff -u -N -r16691 -r16716 --- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 16691) +++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 16716) @@ -1,6 +1,6 @@ 0, 'force_front=no' => 0); - if ( $theme_id > 0 ) { - return $theme_id; + $static_cache_key = $force_front ? 'force_front=yes' : 'force_front=no'; + + if ( $cache[$static_cache_key] > 0 ) { + return $cache[$static_cache_key]; } if ( kUtil::constOn('DBG_FORCE_THEME') ) { - $theme_id = DBG_FORCE_THEME; + $cache[$static_cache_key] = DBG_FORCE_THEME; } elseif ( !$force_front && $this->isAdmin ) { - $theme_id = 999; + $cache[$static_cache_key] = 999; } else { $cache_key = 'primary_theme[%ThemeSerial%]'; - $theme_id = $this->getCache($cache_key); + $cache[$static_cache_key] = $this->getCache($cache_key); - if ( $theme_id === false ) { + if ( $cache[$static_cache_key] === false ) { $this->Conn->nextQueryCachable = true; $sql = 'SELECT ' . $this->getUnitOption('theme', 'IDField') . ' FROM ' . $this->getUnitOption('theme', 'TableName') . ' WHERE (PrimaryTheme = 1) AND (Enabled = 1)'; - $theme_id = $this->Conn->GetOne($sql); + $cache[$static_cache_key] = $this->Conn->GetOne($sql); - if ( $theme_id !== false ) { - $this->setCache($cache_key, $theme_id); + if ( $cache[$static_cache_key] !== false ) { + $this->setCache($cache_key, $cache[$static_cache_key]); } } } - return $theme_id; + return $cache[$static_cache_key]; } /**