Public Member Functions | |
setKey ($key) | |
load () | |
save () |
Definition at line 35 of file File.php.
load | ( | ) |
Try to load configuration cache from file
Definition at line 60 of file File.php.
00061 { 00062 $this->setIsLoaded(false); 00063 00064 // try to read stats 00065 if (!($stats = @file_get_contents($this->getStatFileName()))) { 00066 return false; 00067 } 00068 00069 // try to validate stats 00070 if (!$this->validateComponents(unserialize($stats))) { 00071 return false; 00072 } 00073 00074 // try to read cache file 00075 if (!($cache = @file_get_contents($this->getFileName()))) { 00076 return false; 00077 } 00078 00079 // try to process cache file 00080 if (!($data = $this->getConfig()->processFileData($cache))) { 00081 return false; 00082 } 00083 00084 $xml = $this->getConfig()->loadString($data); 00085 $this->getConfig()->setXml($xml); 00086 $this->setIsLoaded(true); 00087 00088 return true; 00089 }
save | ( | ) |
Try to save configuration cache to file
Definition at line 96 of file File.php.
00097 { 00098 if (!$this->getIsAllowedToSave()) { 00099 return false; 00100 } 00101 00102 // save stats 00103 @file_put_contents($this->getStatFileName(), serialize($this->getComponents())); 00104 00105 // save cache 00106 @file_put_contents($this->getFileName(), $this->getConfig()->getNode()->asNiceXml()); 00107 00108 return true; 00109 }
setKey | ( | $ | key | ) |
Initialize variables that depend on the cache key
string | $key |
Definition at line 44 of file File.php.
00045 { 00046 $this->setData('key', $key); 00047 00048 $file = $this->getDir().DS.$this->getKey(); 00049 $this->setFileName($file.'.xml'); 00050 $this->setStatFileName($file.'.stat'); 00051 00052 return $this; 00053 }