Public Member Functions | |
__construct ($data=array()) | |
addComponent ($component) | |
validateComponents ($data) | |
getComponentsHash () |
Definition at line 35 of file Abstract.php.
__construct | ( | $ | data = array() |
) |
Constructor
Initializes components and allows to save the cache
array | $data |
Definition at line 44 of file Abstract.php.
00045 { 00046 parent::__construct($data); 00047 00048 $this->setComponents(array()); 00049 $this->setIsAllowedToSave(true); 00050 }
addComponent | ( | $ | component | ) |
Add configuration component to stats
string | $component Filename of the configuration component file |
Definition at line 58 of file Abstract.php.
00059 { 00060 $comps = $this->getComponents(); 00061 if (is_readable($component)) { 00062 $comps[$component] = array('mtime'=>filemtime($component)); 00063 } 00064 $this->setComponents($comps); 00065 00066 return $this; 00067 }
getComponentsHash | ( | ) |
Definition at line 89 of file Abstract.php.
00090 { 00091 $sum = ''; 00092 foreach ($this->getComponents() as $comp) { 00093 $sum .= $comp['mtime'].':'; 00094 } 00095 $hash = md5($sum); 00096 return $hash; 00097 }
validateComponents | ( | $ | data | ) |
Validate components in the stats
array | $data |
Definition at line 75 of file Abstract.php.
00076 { 00077 if (empty($data) || !is_array($data)) { 00078 return false; 00079 } 00080 // check that no source files were changed or check file exsists 00081 foreach ($data as $sourceFile=>$stat) { 00082 if (empty($stat['mtime']) || !is_file($sourceFile) || filemtime($sourceFile)!==$stat['mtime']) { 00083 return false; 00084 } 00085 } 00086 return true; 00087 }