/** * @return array names of plugins that have been loaded */ public function loadTrackerPlugins() { $cache = new PersistentCache('PluginsTracker'); if ($cache->has()) { $pluginsTracker = $cache->get(); } else { $this->unloadPlugins(); $this->loadActivatedPlugins(); $pluginsTracker = array(); foreach ($this->loadedPlugins as $pluginName => $plugin) { if ($this->isTrackerPlugin($plugin)) { $pluginsTracker[] = $pluginName; } } if (!empty($pluginsTracker)) { $cache->set($pluginsTracker); } } $this->unloadPlugins(); if (empty($pluginsTracker)) { return array(); } $pluginsTracker = array_diff($pluginsTracker, Tracker::getPluginsNotToLoad()); $this->doNotLoadAlwaysActivatedPlugins(); $this->loadPlugins($pluginsTracker); return $pluginsTracker; }
private static function getCachedDimensionFileChanges() { $persistentCache = new PersistentCache('AllDimensionModifyTime'); if ($persistentCache->has()) { return $persistentCache->get(); } return array(); }
public function findMultipleComponents($directoryWithinPlugin, $expectedSubclass) { $this->cache->setCacheKey('Plugin' . $this->pluginName . $directoryWithinPlugin . $expectedSubclass); if ($this->cache->has()) { $components = $this->cache->get(); if ($this->includeComponents($components)) { return $components; } else { // problem including one cached file, refresh cache } } $components = $this->doFindMultipleComponents($directoryWithinPlugin, $expectedSubclass); $this->cache->set($components); return $components; }
private function loadAvailableLanguages() { if (!is_null($this->availableLanguageNames)) { return; } $cache = new PersistentCache('availableLanguages'); if ($cache->has()) { $languagesInfo = $cache->get(); } else { $filenames = $this->getAvailableLanguages(); $languagesInfo = array(); foreach ($filenames as $filename) { $data = file_get_contents(PIWIK_INCLUDE_PATH . "/lang/{$filename}.json"); $translations = json_decode($data, true); $languagesInfo[] = array('code' => $filename, 'name' => $translations['General']['OriginalLanguageName'], 'english_name' => $translations['General']['EnglishLanguageName']); } $cache->set($languagesInfo); } $this->availableLanguageNames = $languagesInfo; }