本文整理汇总了PHP中Folder::purge方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::purge方法的具体用法?PHP Folder::purge怎么用?PHP Folder::purge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::purge方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: purgeFoundationCache
/**
* 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);
}
示例2: run
/**
* run once
*/
public function run()
{
foreach (array('assets/js', 'assets/css') as $dir) {
// Purge the folder
$objFolder = new \Folder($dir);
$objFolder->purge();
}
}
示例3: 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));
}
示例4: removeCacheDir
/**
*
*/
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);
}
}
示例5: compile
/**
* 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;
}
示例6: purgePhpFastCache
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);
}
示例7: deleteFiles
/**
* 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;
}
示例8: purgeCacheFiles
public function purgeCacheFiles()
{
$objFolder = new \Folder(ImmoConnector::CACHE_DIRECTORY);
$objFolder->purge();
$this->log("Cache-File were deleted.", __METHOD__, TL_FILES);
}
示例9: purgeTempFolder
/**
* 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);
}
示例10: purgeTempFolder
/**
* 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);
}