Пример #1
0
 /**
  * Returns the module's settings from the cache
  *
  * @param string $module
  * @return array
  */
 public function getSettings($module)
 {
     if ($this->settings === []) {
         if ($this->coreCache->contains(static::CACHE_ID) === false) {
             $this->saveCache();
         }
         $this->settings = $this->coreCache->fetch(static::CACHE_ID);
     }
     return isset($this->settings[$module]) ? $this->settings[$module] : [];
 }
Пример #2
0
 /**
  * Saves the modules info cache
  */
 public function saveModulesInfoCache()
 {
     $infos = [];
     // 1. fetch all core modules
     // 2. Fetch all 3rd party modules
     // 3. Fetch all local module customizations
     foreach ($this->vendors->getVendors() as $vendor) {
         $infos += $this->fetchVendorModules($vendor);
     }
     $this->cache->save($this->getCacheKey(), $infos);
 }
Пример #3
0
 /**
  * Sets the cache for all registered languages
  *
  * @return bool
  */
 protected function saveLanguagePacksCache()
 {
     $languagePacks = [];
     foreach ($this->vendors->getVendors() as $vendors) {
         $languageFiles = glob($this->appPath->getModulesDir() . $vendors . '/*/Resources/i18n/*.xml');
         if ($languageFiles !== false) {
             foreach ($languageFiles as $file) {
                 $languagePack = $this->registerLanguagePack($file);
                 if (!empty($languagePack)) {
                     $languagePacks += $languagePack;
                 }
             }
         }
     }
     return $this->cache->save('language_packs', $languagePacks);
 }
Пример #4
0
 /**
  * @inheritdoc
  */
 public function getURI($layout = 'layout')
 {
     $debug = $this->environment === 'dev';
     $filenameHash = $this->generateFilenameHash($this->assetGroup, $layout);
     $cacheId = 'assets-last-generated-' . $filenameHash;
     if (false === ($lastGenerated = $this->systemCache->fetch($cacheId))) {
         $lastGenerated = time();
         // Assets are not cached -> set the current time as the new timestamp
     }
     $path = $this->buildAssetPath($debug, $this->assetGroup, $filenameHash, $lastGenerated);
     // If the requested minified StyleSheet and/or the JavaScript file doesn't exist, generate it
     if (is_file($this->appPath->getUploadsDir() . $path) === false || $debug === true) {
         // Get the enabled libraries and filter out empty entries
         $files = array_filter($this->processLibraries($layout), function ($var) {
             return !empty($var);
         });
         $this->saveMinifiedAsset($files, $this->appPath->getUploadsDir() . $path);
         // Save the time of the generation if the requested file
         $this->systemCache->save($cacheId, $lastGenerated);
     }
     return $this->appPath->getWebRoot() . 'uploads/' . $path . ($debug === true ? '?v=' . $lastGenerated : '');
 }
Пример #5
0
 /**
  * Löscht die zu einem Modul zugehörigen Ressourcen
  *
  * @param \ACP3\Core\Modules\Installer\SchemaInterface $schema
  *
  * @return bool
  */
 public function uninstall(SchemaInterface $schema)
 {
     $this->aclCache->getDriver()->deleteAll();
     return true;
 }
Пример #6
0
 /**
  * @param array $paths
  *
  * @return bool
  */
 public function saveCache(array $paths)
 {
     return $this->cache->save(self::CACHE_ID, $paths);
 }
Пример #7
0
 /**
  * @return \Doctrine\Common\Cache\CacheProvider
  */
 public function getCacheDriver()
 {
     return $this->cache->getDriver();
 }