comparison CacheTimeCheck.inc @ 47:66382989353f

Extract baseDir only once. Function for generating cacheset. Added logger functionality. Removed hardcoded location for flagScript. BUGFIX: masterdocument was not added to the cacheset. BUGFIX: When two options existed next to eachother, the last was not read.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Mon, 08 Oct 2012 17:35:08 +0200
parents fbbb82ced6de
children c6d0892f81ff
comparison
equal deleted inserted replaced
46:15879e2aab65 47:66382989353f
8 private function __construct($filename = False) 8 private function __construct($filename = False)
9 { 9 {
10 if ($filename) 10 if ($filename)
11 $this->cache_time($filename); 11 $this->cache_time($filename);
12 $this->cache_time(__FILE__); 12 $this->cache_time(__FILE__);
13 }
14
15 function cacheSet($humanReadable = False)
16 {
17 $retVal = array();
18 foreach($this->files as $file) {
19 $mtime = filemtime($file);
20 if ($humanReadable)
21 $mtime = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';
22
23 $retVal[$file] = $mtime;
24 }
25 return $retVal;
13 } 26 }
14 27
15 function instance($filename = False) 28 function instance($filename = False)
16 { 29 {
17 if (! self::$myInstance) 30 if (! self::$myInstance)
42 } 55 }
43 56
44 function cache_time($path, $basedir = False) 57 function cache_time($path, $basedir = False)
45 { 58 {
46 if (!file_exists($path)) { 59 if (!file_exists($path)) {
47 if (DEBUG_LEVEL >= VERBOSITY_WARNING) 60 warn("${path} does not exist");
48 print "${path} does not exist";
49 var_dump($_SERVER);
50 errorPage("Resource not available"); 61 errorPage("Resource not available");
51 } 62 }
52 63
53 array_push($this->files, $path); 64 array_push($this->files, $path);
54 $mtime = filemtime($path); 65 $mtime = filemtime($path);