Varien_Simplexml_Config_Cache_Abstract Class Reference

Inheritance diagram for Varien_Simplexml_Config_Cache_Abstract:

Varien_Object Varien_Simplexml_Config_Cache_File

List of all members.

Public Member Functions

 __construct ($data=array())
 addComponent ($component)
 validateComponents ($data)
 getComponentsHash ()


Detailed Description

Definition at line 35 of file Abstract.php.


Constructor & Destructor Documentation

__construct ( data = array()  ) 

Constructor

Initializes components and allows to save the cache

Parameters:
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     }


Member Function Documentation

addComponent ( component  ) 

Add configuration component to stats

Parameters:
string $component Filename of the configuration component file
Returns:
Varien_Simplexml_Config_Cache_Abstract

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

Parameters:
array $data
Returns:
boolean

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     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:25:04 2009 for Magento by  doxygen 1.5.8