mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-02 16:18:12 +03:00
Cron-процесс для периодической очистки cache-директории от кешированных файлов js,css
This commit is contained in:
parent
a9368efe7b
commit
b0189cf6d1
51
include/cron/template.php
Normal file
51
include/cron/template.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* LiveStreet Engine Social Networking
|
||||
* Copyright © 2008 Mzhelskiy Maxim
|
||||
*
|
||||
*--------------------------------------------------------
|
||||
*
|
||||
* Official site: www.livestreet.ru
|
||||
* Contact e-mail: rus.engine@gmail.com
|
||||
*
|
||||
* GNU General Public License, version 2:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
---------------------------------------------------------
|
||||
*/
|
||||
define('SYS_HACKER_CONSOLE',false);
|
||||
|
||||
$sDirRoot=dirname(dirname(dirname(__FILE__)));
|
||||
set_include_path(get_include_path().PATH_SEPARATOR.$sDirRoot);
|
||||
chdir($sDirRoot);
|
||||
|
||||
require_once($sDirRoot."/config/loader.php");
|
||||
require_once($sDirRoot."/engine/classes/Cron.class.php");
|
||||
|
||||
class TemplateCacheCleanCron extends Cron {
|
||||
protected $sProcessName='TemplateCacheCleanCron';
|
||||
/**
|
||||
* Находим все кеш-файлы js и css и удаляем их с сервера
|
||||
*/
|
||||
public function Client() {
|
||||
$sDir = Config::Get('path.smarty.cache');
|
||||
/**
|
||||
* Выбираем все файлы кеша
|
||||
*/
|
||||
$aFiles = (array)glob($sDir. DIRECTORY_SEPARATOR ."*.{css,js}", GLOB_BRACE);
|
||||
|
||||
print PHP_EOL."Cache files count: ".count($aFiles);
|
||||
|
||||
foreach ($aFiles as $sFilePath) {
|
||||
@unlink($sFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Создаем объект крон-процесса
|
||||
*/
|
||||
$app=new TemplateCacheClean();
|
||||
print $app->Exec();
|
||||
?>
|
Loading…
Reference in a new issue