Exemple #1
0
 static function getCachedActionsMapping()
 {
     $sCacheFile = self::filenameCachedActionsMapping();
     if (!file_exists($sCacheFile)) {
         throw new AnwCacheNotFoundException();
     }
     //mapping must be newer than enabled-plugins-settings
     try {
         if (filemtime($sCacheFile) < filemtime(AnwUtils::getFileOverride("global.cfg.php", AnwComponent::getGlobalComponentFullDir()))) {
             self::debug("cachedActionsMapping obsoleted by settings");
             throw new AnwCacheNotFoundException();
         }
     } catch (AnwFileNotFoundException $e) {
     }
     //no override config
     //mapping must be newer than each available action
     $asEnabledActions = AnwComponent::getAvailableComponents(AnwComponent::TYPE_ACTION);
     foreach ($asEnabledActions as $sEnabledAction) {
         $asActionsFilesLocations = array();
         $sActionFile = 'action_' . $sEnabledAction . '.php';
         $sActionDir = AnwAction::getComponentDir($sEnabledAction);
         list($sFileActionDefault, $null) = AnwUtils::getFileDefault($sActionFile, $sActionDir);
         $asActionsFilesLocations[] = $sFileActionDefault;
         try {
             $sFileActionOverride = AnwUtils::getFileOverride($sActionDir, $sActionDir);
             $asActionsFilesLocations[] = $sFileActionOverride;
         } catch (AnwFileNotFoundException $e) {
         }
         //no override config
         foreach ($asActionsFilesLocations as $sActionFileLocation) {
             if (file_exists($sActionFileLocation) && filemtime($sCacheFile) < filemtime($sActionFileLocation)) {
                 self::debug("cachedActionsMapping obsoleted by action : " . $sEnabledAction);
                 throw new AnwCacheNotFoundException();
             }
         }
     }
     //load it from cache
     $oObject = (array) self::getCachedObject($sCacheFile);
     if (!is_array($oObject)) {
         self::debug("cachedActionsMapping invalid : " . $sCacheFile);
         throw new AnwCacheNotFoundException();
     } else {
         self::debug("cachedActionsMapping found : " . $sCacheFile);
     }
     return $oObject;
 }
 static function getComponentsRootDir()
 {
     return AnwAction::getComponentDir('install');
 }