/** * Purge the foundation CSS and SCSS cache */ public static function purgeFoundationCache() { // Purge the folder $objFolder = new \Folder('assets/foundation'); $objFolder->purge(); // Add a log entry \System::log('Purged the Foundation cache', __METHOD__, TL_CRON); }
/** * run once */ public function run() { foreach (array('assets/js', 'assets/css') as $dir) { // Purge the folder $objFolder = new \Folder($dir); $objFolder->purge(); } }
/** * Purge the page cache. * * @return void * * @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.CamelCaseVariableName) */ public function purge() { foreach ($GLOBALS['TL_PURGE']['folders']['metamodels']['affected'] as $folderName) { // Purge the folder $folder = new \Folder($folderName); $folder->purge(); } /** @var EventDispatcherInterface $dispatcher */ $dispatcher = $GLOBALS['container']['event-dispatcher']; $dispatcher->dispatch(ContaoEvents::SYSTEM_LOG, new LogEvent('Purged the MetaModels cache', __METHOD__, TL_CRON)); }
/** * */ protected function removeCacheDir() { if (is_dir(TL_ROOT . '/system/cache/timelinejs')) { // Purge the folder $objFolder = new \Folder('system/cache/timelinejs'); $objFolder->purge(); $objFolder->delete(); // Add a log entry \Controller::log('Removed not used timelinejs cache directory', 'TimelineJSRunOnce run()', TL_CRON); } }
/** * Compile the SCSS * @param \Contao\ThemeModel * @param boolean */ public static function compile(\Contao\ThemeModel $objTheme, $blnForce = false) { if (!self::confirmDependencies()) { return; } //Get file key $strKey = self::getKey($objTheme); //Set file path $strCSSPath = 'assets/foundation/css/' . $strKey . '.css'; //Compile the scss if (!file_exists(TL_ROOT . '/' . $strCSSPath) || $blnForce) { //Gather up the SCSS files in the assets/foundation/scss folder //This allows to work with different configs and edit defaults //Without affecting the original source $strBasePath = COMPOSER_DIR_RELATIVE . '/vendor/zurb/foundation/scss'; $strCopyPath = 'assets/foundation/scss/' . $strKey; //Create new folder if not exists and clean it out $objNew = new \Folder($strCopyPath); $objNew->purge(); $objOriginal = new \Folder($strBasePath); $objOriginal->copyTo($strCopyPath); //Apply the config self::applyConfig($objTheme, $strCopyPath); $strFoundationCSS = ''; $strNormalizeCSS = ''; //Create the SCSS compiler if (class_exists('scssc')) { $objCompiler = new \scssc(); $objCompiler->setImportPaths(TL_ROOT . '/' . $strCopyPath); $objCompiler->setFormatter(\Config::get('debugMode') ? 'scss_formatter' : 'scss_formatter_compressed'); } else { $objCompiler = new Compiler(); $objCompiler->setImportPaths(TL_ROOT . '/' . $strCopyPath); $objCompiler->setFormatter(\Config::get('debugMode') ? 'Leafo\\ScssPhp\\Formatter\\Expanded' : 'Leafo\\ScssPhp\\Formatter\\Compressed'); } $strFoundationContent = file_get_contents(TL_ROOT . '/' . $strCopyPath . '/foundation.scss'); $strNormalizeContent = file_get_contents(TL_ROOT . '/' . $strCopyPath . '/normalize.scss'); //Compile $strFoundationCSS = $objCompiler->compile($strFoundationContent); $strNormalizeCSS = $objCompiler->compile($strNormalizeContent); //Write to single CSS file cache $objFile = new \File($strCSSPath); $objFile->write($strNormalizeCSS . "\n" . $strFoundationCSS); $objFile->close(); } return $strCSSPath; }
public function purgePhpFastCache() { if (!is_array($GLOBALS['TL_PURGE']['folders']['phpfastcache']['affected'])) { return false; } foreach ($GLOBALS['TL_PURGE']['folders']['phpfastcache']['affected'] as $folder) { // Purge folder $objFolder = new \Folder($folder); $objFolder->purge(); // Restore the index.html file $objFile = new \File('templates/index.html', true); $objFile->copyTo($folder . 'index.html'); } // Also empty the page cache so there are no links to deleted scripts $this->purgePageCache(); // Add a log entry $this->log('Purged the phpfastcache cache', 'HeimrichHannot\\Haste\\Backend\\Automator purgePhpFastCache()', TL_CRON); }
/** * delete all files in target folder */ protected function deleteFiles($path, $test = false) { $fileCount = 0; $folder = new \Folder($path); $folder->purge(); return 0; if (!is_writeable(TL_ROOT . '/' . $path) && is_dir(TL_ROOT . '/' . $path)) { chmod(TL_ROOT . '/' . $path, 0777); } if (is_writeable(TL_ROOT . '/' . $path) && is_dir(TL_ROOT . '/' . $path)) { $handle = opendir(TL_ROOT . '/' . $path); while ($tmp = readdir($handle)) { if (in_array(strrchr($tmp, '.'), array('.html', '.xhtml', '.html5', '.css', '.jpg', 'png', 'gif'))) { if (is_writeable(TL_ROOT . '/' . $path . '/' . $tmp) && is_file(TL_ROOT . '/' . $path . '/' . $tmp)) { if (!$test) { if (unlink(TL_ROOT . '/' . $path . '/' . $tmp)) { $fileCount++; } } else { $fileCount++; } } elseif (!is_writeable(TL_ROOT . '/' . $path . '/' . $tmp) && is_file(TL_ROOT . '/' . $path . '/' . $tmp)) { if (!$test) { chmod(TL_ROOT . '/' . $path . '/' . $tmp, 0666); if (unlink(TL_ROOT . '/' . $path . '/' . $tmp)) { $fileCount++; } } else { $fileCount++; } } } } closedir($handle); } return $fileCount; }
public function purgeCacheFiles() { $objFolder = new \Folder(ImmoConnector::CACHE_DIRECTORY); $objFolder->purge(); $this->log("Cache-File were deleted.", __METHOD__, TL_FILES); }
/** * Purge the temp folder */ public function purgeTempFolder() { // Purge the folder $objFolder = new \Folder('system/tmp'); $objFolder->purge(); // Restore the .gitignore file $objFile = new \File('system/logs/.gitignore', true); $objFile->copyTo('system/tmp/.gitignore'); // Add a log entry $this->log('Purged the temp folder', __METHOD__, TL_CRON); }
/** * Purge the temp folder */ public function purgeTempFolder() { // Purge the folder $objFolder = new \Folder('system/tmp'); $objFolder->purge(); // Restore the .htaccess file $objFile = new \File('system/logs/.htaccess'); $objFile->copyTo('system/tmp/.htaccess'); // Add a log entry $this->log('Purged the temp folder', 'Automator purgeTempFolder()', TL_CRON); }