Ejemplo n.º 1
0
Archivo: Cache.php Proyecto: acp3/core
 /**
  * @return array
  */
 public function getCache()
 {
     if ($this->cache->contains(self::CACHE_ID) === true) {
         return $this->cache->fetch(self::CACHE_ID);
     }
     return [];
 }
Ejemplo n.º 2
0
 /**
  * @return array
  */
 public function getModulesInfoCache()
 {
     if ($this->cache->contains($this->getCacheKey()) === false) {
         $this->saveModulesInfoCache();
     }
     return $this->cache->fetch($this->getCacheKey());
 }
Ejemplo n.º 3
0
 /**
  * Gets the cache for all registered languages
  *
  * @return array
  */
 public function getLanguagePacksCache()
 {
     if ($this->cache->contains('language_packs') === false) {
         $this->saveLanguagePacksCache();
     }
     return $this->cache->fetch('language_packs');
 }
Ejemplo n.º 4
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] : [];
 }
Ejemplo n.º 5
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 : '');
 }