/** * Utility method for clearing all application caches. */ public function clearCaches() { \Events::dispatch('on_cache_flush'); $this['cache']->flush(); $this['cache/expensive']->flush(); $config = $this['config']; // Delete and re-create the cache directory $cacheDir = $config->get('concrete.cache.directory'); if (is_dir($cacheDir)) { $fh = Core::make('helper/file'); $fh->removeAll($cacheDir, true); } $this->setupFilesystem(); $pageCache = PageCache::getLibrary(); if (is_object($pageCache)) { $pageCache->flush(); } // Clear the file thumbnail path cache $connection = $this['database']; $sql = $connection->getDatabasePlatform()->getTruncateTableSQL('FileImageThumbnailPaths'); try { $connection->executeUpdate($sql); } catch (\Exception $e) { } // clear the environment overrides cache $env = \Environment::get(); $env->clearOverrideCache(); // Clear localization cache Localization::clearCache(); // clear block type cache BlockType::clearCache(); // Clear precompiled script bytecode caches OpCache::clear(); \Events::dispatch('on_cache_flush_end'); }
/** * Utility method for clearing all application caches. */ public function clearCaches() { \Events::dispatch('on_cache_flush'); $this['cache']->flush(); $this['cache/expensive']->flush(); $config = $this['config']; // Delete and re-create the cache directory $cacheDir = $config->get('concrete.cache.directory'); if (is_dir($cacheDir)) { $fh = Core::make('helper/file'); $fh->removeAll($cacheDir, true); } $this->setupFilesystem(); $pageCache = PageCache::getLibrary(); if (is_object($pageCache)) { $pageCache->flush(); } // clear the environment overrides cache $env = \Environment::get(); $env->clearOverrideCache(); // Clear localization cache Localization::clearCache(); // clear block type cache BlockType::clearCache(); // Clear precompiled script bytecode caches OpCache::clear(); }
/** * Utility method for clearing all application caches. */ public function clearCaches() { \Events::dispatch('on_cache_flush'); Core::make('cache')->flush(); Core::make('cache/expensive')->flush(); // flush the CSS cache if (is_dir(DIR_FILES_CACHE . '/' . DIRNAME_CSS)) { $fh = Loader::helper("file"); $fh->removeAll(DIR_FILES_CACHE . '/' . DIRNAME_CSS); } $pageCache = PageCache::getLibrary(); if (is_object($pageCache)) { $pageCache->flush(); } // clear the environment overrides cache $env = \Environment::get(); $env->clearOverrideCache(); // Clear localization cache Localization::clearCache(); // clear block type cache BlockType::clearCache(); }