/** * Execute certain hook handler * * @return void */ public function executeHookHandler() { // Delete old and rename new if (\Includes\Decorator\Utils\CacheManager::isCapsular()) { $repo = \XLite\Core\Database::getRepo('XLite\\Model\\TemplatePatch'); $key = \Includes\Decorator\Utils\CacheManager::getKey(); $repo->deleteObsolete($key); $repo->markCurrentVersion($key); } }
/** * Execute certain hook handler * * @return void */ public function executeHookHandler() { // Remove old capsular directories if (\Includes\Decorator\Utils\CacheManager::isCapsular()) { $currentKey = \Includes\Decorator\Utils\CacheManager::getKey(); foreach (\Includes\Decorator\Utils\CacheManager::getCacheDirs(true) as $dir) { $list = glob(rtrim($dir, LC_DS) . '.*'); if ($list) { foreach ($list as $subdir) { list($main, $key) = explode('.', $subdir, 2); if ($key && $key != $currentKey) { \Includes\Utils\FileManager::unlinkRecursive($subdir); } } } } } \Includes\Decorator\Utils\CacheManager::cleanupCache(); // Load classes from "classes" (do not use cache) \Includes\Autoloader::switchLcAutoloadDir(); \Includes\Decorator\Plugin\Doctrine\Plugin\QuickData\Main::initializeCounter(); }
/** * Add cleanup cache mark * * @param string $location URL * * @return string */ protected function addCleanupCacheMark($location) { if (\XLite::getCleanUpCacheFlag()) { $location .= (strpos($location, '?') === false ? '?' : '&') . \Includes\Decorator\Utils\CacheManager::KEY_NAME . '=' . \Includes\Decorator\Utils\CacheManager::getKey(true); } return $location; }
/** * Prepare common properties * * @param array $data Data describe the patch * @param string $class Patcher class * * @return array */ protected function getCommonData(array $data, $class) { $parts = explode(':', $data[$class::PATCHER_CELL_TPL], 3); if (1 == count($parts)) { $parts = array('customer', '', $parts[0]); } elseif (2 == count($parts)) { $parts = array($parts[0], '', $parts[1]); } $version = \Includes\Decorator\Utils\CacheManager::isCapsular() ? \Includes\Decorator\Utils\CacheManager::getKey() : null; return array('patch_type' => $data[$class::PATCHER_CELL_TYPE], 'version' => $version) + array_combine(array('zone', 'lang', 'tpl'), $parts); }