示例#1
0
 public static function enableCache($level = 1)
 {
     global $smarty;
     if (!Configuration::get('PS_SMARTY_CACHE')) {
         return;
     }
     if ($smarty->force_compile == 0 and $smarty->caching == $level) {
         return;
     }
     self::$_forceCompile = (int) $smarty->force_compile;
     self::$_caching = (int) $smarty->caching;
     $smarty->force_compile = 0;
     $smarty->caching = (int) $level;
 }
示例#2
0
 public static function enableCache($level = 1, Context $context = null)
 {
     if (!$context) {
         $context = Context::getContext();
     }
     $smarty = $context->smarty;
     if (!Configuration::get('PS_SMARTY_CACHE')) {
         return;
     }
     if ($smarty->force_compile == 0 && $smarty->caching == $level) {
         return;
     }
     self::$_forceCompile = (int) $smarty->force_compile;
     self::$_caching = (int) $smarty->caching;
     $smarty->force_compile = 0;
     $smarty->caching = (int) $level;
     $smarty->cache_lifetime = 31536000;
     // 1 Year
 }
示例#3
0
 public static function enableCache($level = 1)
 {
     global $smarty;
     if (!Configuration::get('PS_SMARTY_CACHE') || $smarty->force_compile == 0 && $smarty->caching == $level) {
         return;
     }
     /* Backup current values */
     self::$_forceCompile = (int) $smarty->force_compile;
     self::$_caching = (int) $smarty->caching;
     /* Forcing Smarty to use the cache */
     $smarty->force_compile = 0;
     $smarty->caching = (int) $level;
 }