disable() public static method

Disables the complete pimcore cache
public static disable ( ) : void
return void
<?php

\Pimcore\Cache::disable();
$customCacheFile = PIMCORE_CONFIGURATION_DIRECTORY . "/cache.xml";
// create legacy config folder
$legacyFolder = PIMCORE_CONFIGURATION_DIRECTORY . "/LEGACY";
if (!is_dir($legacyFolder)) {
    mkdir($legacyFolder, 0777, true);
}
if (file_exists($customCacheFile)) {
    try {
        $conf = new \Zend_Config_Xml($customCacheFile);
        $arrayConf = $conf->toArray();
        $content = json_encode($arrayConf);
        $content = \Zend_Json::prettyPrint($content);
        $jsonFile = \Pimcore\Config::locateConfigFile("cache.json");
        file_put_contents($jsonFile, $content);
        rename($customCacheFile, $legacyFolder . "/cache.xml");
    } catch (\Exception $e) {
    }
}
Esempio n. 2
0
 /**
  * @param $revision
  * @param $type
  * @return array
  */
 public static function executeScript($revision, $type)
 {
     $script = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/update/" . $revision . "/scripts/" . $type . ".php";
     $maxExecutionTime = 900;
     @ini_set("max_execution_time", $maxExecutionTime);
     set_time_limit($maxExecutionTime);
     Cache::disable();
     // it's important to disable the cache here eg. db-schemas, ...
     if (is_file($script)) {
         $outputMessage = "";
         ob_start();
         try {
             if (!self::$dryRun) {
                 include $script;
             }
         } catch (\Exception $e) {
             \Logger::error($e);
             $outputMessage .= "EXCEPTION: " . $e->getMessage();
             $outputMessage .= "<br>For details please have a look into debug.log<br>";
         }
         $outputMessage .= ob_get_clean();
     }
     self::clearOPCaches();
     return ["message" => $outputMessage, "success" => true];
 }