/** * Initialization * * @return void */ public static function initialize() { if (static::isDropCacheRequested()) { // Drop classes cache \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators(); // Redirect to avoid loop \Includes\Utils\Operator::redirect(\XLite::getAdminScript() . '?target=main'); } elseif (static::isSafeModeRequested() && !static::isSafeModeStarted()) { $restorePoint = null; if (static::isRestoreDateSet()) { $restorePoint = \Includes\Utils\ModulesManager::getRestorePoint(static::getRestoreDate()); } if (static::isSoftwareResetEnabled()) { if (!($restorePoint != null ^ static::isRestoreDateSet())) { // Put safe mode indicator \Includes\Utils\FileManager::write(static::getIndicatorFileName(), static::getIndicatorFileContent()); // Clean cache indicators to force cache generation \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators(); } else { $date = \DateTime::createFromFormat(\Includes\Utils\ModulesManager::RESTORE_DATE_FORMAT, static::getRestoreDate()); \Includes\Decorator\Utils\PersistentInfo::set('restoreFailed', $date->getTimestamp()); } } // Redirect to avoid loop \Includes\Utils\Operator::redirect(\XLite::getAdminScript() . '?target=main'); } }
/** * Prepare to remove cache of classes * * @return void */ function doPrepareCacheRemoval() { \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators(); // Remove disabled structures $paths = array(LC_DIR_SERVICE . '.disabled.structures.php', LC_DIR_SERVICE . '.modules.structures.registry.hash.php', LC_DIR_SERVICE . '.modules.structures.registry.php'); foreach ($paths as $path) { if (file_exists($path)) { file_put_contents($path, ''); } } }
/** * Clean up classes cache (if needed) * * @return void */ public function __destruct() { if (static::$isNeedToCleanupCache) { \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators(); } }
/** * Prepare to remove a cache of classes * * @param array $params Database access data and other parameters * * @return bool */ function doRemoveCache($params) { $result = true; $pdoErrorMsg = ''; \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators(); \Includes\Decorator\Utils\CacheManager::cleanupRebuildIndicator(); // Remove all LiteCommerce tables if exists $connection = dbConnect($params, $pdoErrorMsg); if ($connection) { // Check if LiteCommerce tables is already exists $res = dbFetchAll('SHOW TABLES LIKE \'xlite_%\''); if (is_array($res)) { dbExecute('SET FOREIGN_KEY_CHECKS=0', $pdoErrorMsg); foreach ($res as $row) { $tableName = array_pop($row); $pdoErrorMsg = ''; $_query = sprintf('DROP TABLE `%s`', $tableName); dbExecute($_query, $pdoErrorMsg); if (!empty($pdoErrorMsg)) { $result = false; break; } } $pdoErrorMsg2 = ''; dbExecute('SET FOREIGN_KEY_CHECKS=1', $pdoErrorMsg2); if (empty($pdoErrorMsg)) { $pdoErrorMsg = $pdoErrorMsg2; } } } else { $result = false; } if (!$result) { x_install_log(xtr('doRemoveCache() failed'), $pdoErrorMsg); } return $result; }
/** * Initialization * * @return void */ public static function initialize() { if (static::isSafeModeRequested() && !static::isSafeModeStarted()) { if (static::isSoftwareResetEnabled()) { // Put safe mode indicator \Includes\Utils\FileManager::write(static::getIndicatorFileName(), static::getIndicatorFileContent()); // Clean cache indicators to force cache generation \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators(); } // Redirect to avoid loop \Includes\Utils\Operator::redirect('admin.php?target=main'); } }