Location: PHPKode > projects > Simple Way to Usenet > scripts/file_cache_cleaner.php
<?php
//chdir to script folder to keep path compatibility
$buf = pathinfo($_SERVER['SCRIPT_FILENAME']);
chdir($buf['dirname']);
unset($buf);

//Site title 
define('SITE_TITLE',			'Simple Way To Usenet');
//dunno if it's possible but anyway let's try something just in case ;)
if ( ! defined('PATH_SEPARATOR') ){
	if ( ereg(';', ini_get('include_path')) ){
		define('PATH_SEPARATOR', ';');
	} else {
		define('PATH_SEPARATOR', ':');
	}
}
//path to folder containing this option set.
define('PATH_OPTS',				implode(PATH_SEPARATOR, Array('../config')));
//path that contains files with db objects structure.
define('PATH_CNF',				implode(PATH_SEPARATOR, Array('../config/CNF')));
//path to librairies.
define('PATH_LIBS',				implode(PATH_SEPARATOR, Array('../libs/core', '../libs/swun/')));
//a writable path, best if reserved to this
define('PATH_CACHE',			'../cache');
//path to temp folder, if defined will overwrite system temp folder
define('PATH_TMP',				PATH_CACHE.'/tmp');
//used in libs
define('CORE_CONTEXT',			'swun-cron');
//PHP ERROR REDIRECTION 
define('REDIRECT_PHP_ERRORS',	TRUE);
//PEAR ERROR REDIRECTION, require PEARS folder in include path. 
define('REDIRECT_PEAR_ERRORS',	FALSE);
//do we hidde events prefixed with the error suppression directive "@"
define('FOLLOW_ERROR_DIRECTIVE',TRUE);
//do we use core auth engine ?
define('CORE_AUTH',TRUE);

//Include of the main configuration file
//and we try to load the CORE.
$icp = ini_get('include_path');
ini_set('include_path', PATH_LIBS);
if ( ! include('CORE.class.php') ){ die('Missing CORE Librairie, plz check the value of PATH_LIBS in this file !'); }
if ( ! include('misc/chrono.class.php') ){ die('Missing Chrono Librairie, plz check the value of PATH_LIBS in this file !'); }

if ( 'file' == configs::get('newzinv2', 'cachetype') ){
	new nb_cache_file();
}
$fcaches = configs::get('file_cache');
foreach($fcaches as $cache => $conf){
	$c = new file_cache($cache);
	$c->cleanup();
	errors::raise("Cache $cache has been cleaned.", CORE_LOG_INFO, 'CLEANER');
}
Return current item: Simple Way to Usenet