static function getCachedPluginsMapping() { $sCacheFile = self::filenameCachedPluginsMapping(); if (!file_exists($sCacheFile)) { throw new AnwCacheNotFoundException(); } //mapping must be newer than enabled-plugins-settings try { $sConfigFileOverride = AnwUtils::getFileOverride("global.cfg.php", AnwComponent::getGlobalComponentFullDir()); if (filemtime($sCacheFile) < filemtime($sConfigFileOverride)) { self::debug("cachedPluginsMapping obsoleted by settings"); throw new AnwCacheNotFoundException(); } } catch (AnwFileNotFoundException $e) { } //no override config //mapping must be newer than each enabled plugin $asEnabledPlugins = AnwComponent::globalCfgModulesPlugins(); foreach ($asEnabledPlugins as $sEnabledPlugin) { $asPluginFilesLocations = array(); $sPluginFile = 'plugin_' . $sEnabledPlugin . '.php'; $sPluginDir = AnwPlugin::getComponentDir($sEnabledPlugin); list($sFilePluginDefault, $null) = AnwUtils::getFileDefault($sPluginFile, $sPluginDir); $asPluginFilesLocations[] = $sFilePluginDefault; try { $sFilePluginOverride = AnwUtils::getFileOverride($sPluginFile, $sPluginDir); $asPluginFilesLocations[] = $sFilePluginOverride; } catch (AnwFileNotFoundException $e) { } //no override file found foreach ($asPluginFilesLocations as $sPluginFileLocation) { if (file_exists($sPluginFileLocation) && filemtime($sCacheFile) < filemtime($sPluginFileLocation)) { self::debug("cachedPluginsMapping obsoleted by plugin : " . $sEnabledPlugin); throw new AnwCacheNotFoundException(); } } } //load it from cache $oObject = (array) self::getCachedObject($sCacheFile); if (!is_array($oObject)) { self::debug("cachedPluginsMapping invalid : " . $sCacheFile); throw new AnwCacheNotFoundException(); } else { self::debug("cachedPluginsMapping found : " . $sCacheFile); } return $oObject; }
static function discoverEnabledComponents() { return AnwComponent::globalCfgModulesPlugins(); }