14 if (!defined(
'IN_PEEL')) {
45 $cfgDefault = array(
'directory' =>
$GLOBALS[
'dirroot'] .
'/' .
$GLOBALS[
'site_parameters'][
'cache_folder'] .
'/',
'group' =>
'page');
48 foreach($cfgDefault as $k => $v) {
49 $this->cfg[$k] = !isset($cfg[$k]) ? $v : $cfg[$k];
53 $this->cfg = $cfgDefault;
66 function testTime($lifeTime = 7200, $update_timestamp_now =
false)
68 $lifeTime = round($lifeTime);
71 if (file_exists($this->file) ===
false || (($this->filemtime = @filemtime($this->file)) < time() - $lifeTime) || (!empty($_GET[
'update']) && $_GET[
'update'] == 1)) {
73 if ($update_timestamp_now && file_exists($this->file)) {
77 touch($this->file, time() - $lifeTime + 20);
94 if (file_exists($this->file) ===
false || @filemtime($this->file) < $lifeDate || (!empty($_GET[
'update']) && $_GET[
'update'] == 1)) {
110 @flock(
$fp, LOCK_SH);
112 $content = @fread(
$fp, @filesize($this->file));
113 @flock(
$fp, LOCK_UN);
119 if ($key != md5(
$data)) {
120 @touch($this->file, 0);
137 @flock(
$fp, LOCK_EX);
140 @flock(
$fp, LOCK_UN);
153 header(
'Cache-Control: public');
155 if(!empty($this->filemtime)) {
160 header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s', $filemtime).
' GMT');
161 header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', $filemtime + $lifeTime) .
' GMT');
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
clean_Cache($days_max=15, $filename_beginning=null)
Suppression des anciens fichiers de cache.
testDate($lifeDate)
Cache::testDate()
static fopen_utf8($filename, $mode, $force_filename_in_iso_8859=false, $try_filename_in_iso_8859_if_file_not_found=true)
Ouvre un fichier.
echo_headers($lifeTime=7200)
Cache::echo_headers()
testTime($lifeTime=7200, $update_timestamp_now=false)
Teste la validité d'un fichier de cache.
$GLOBALS['page_columns_count']
delete_cache_file($clean_all_group=false)
Cache::delete_cache_file()
Cache($id, $cfg=array())
Cache::Cache()
static substr($string, $start, $length=null)
Returns the portion of string specified by the start and length parameters.