private function loadData() { if (!$this->oCache->contains($this->sCacheId)) { $this->generateCacheFile(); } $this->aData = $this->oCache->fetch($this->sCacheId); }
/** * Charge la liste des langues actives. * * @return void */ public function load() { if (!$this->cache->contains($this->cache_id)) { $this->generateCacheList(); } $this->list = $this->cache->fetch($this->cache_id); $this->num = count($this->list); $this->unique = (bool) ($this->num == 1); }
/** * Retourne les informations concernant les dépôts de thèmes. * * @param array $aRepositories * @return array */ public function getRepositoriesInfos($aRepositories = array()) { if (!$this->cache->contains($this->cache_repo_id)) { $this->saveRepositoriesInfosCache($aRepositories); } return $this->cache->fetch($this->cache_repo_id); }
/** * @return array|false|mixed * @throws \Exception */ public function getCollection() { if ($this->cache->contains($this->file_data['hash'])) { // On default we don't need to re-compile $compile_required = false; // get file info for all files foreach ($this->file_data['list'] as $file) { $file_info = $file->getFileInfo(); // check if a parsed_file list is stored if ($file_info['parsed_files'] !== false) { // check all parsed fields if they still exists/have changed foreach ($file_info['parsed_files'] as $parsed_file => $parsed_file_time) { if (!file_exists($parsed_file) || filemtime($parsed_file) > $parsed_file_time) { // file does not exist or filemtime is different $compile_required = true; } } } else { if ($file->requiresFileList() === true) { // check if a file list should be stored, if true we will need to recompile $compile_required = true; } } } // if no compile is required, return the cached file if ($compile_required === false) { return $this->cache->fetch($this->file_data['hash']); } } // File changed or not cached $contents = ""; foreach ($this->file_data['list'] as $file) { $contents .= $file->getFile() . "\n"; // New line to avoid comments cutting off code when combining files } // if result is css, run the file through a auto prefixer if (isset($this->response_type['css'])) { $contents = csscrush_string($contents, array('minify' => $this->minify)); } else { if (isset($this->response_type['js'])) { if ($this->minify) { // minify js $contents = Minifier::minify($contents, array('flaggedComments' => false)); } } } // store in cache $this->cache->save($this->file_data['hash'], $contents, 60 * 60 * 24 * 30); return $contents; }
/** * Gets the Crawl-delay of $host from the crawl delay bloom filter * * @param string $host site to check for a Crawl-delay * @return int the crawl-delay in seconds or -1 if $host has no delay */ function getCrawlDelay($host) { if (!$this->crawl_delay_filter->contains("-1" . $host)) { return -1; } $value = 0; for ($i = 0; $i < 8; $i++) { if ($this->crawl_delay_filter->contains("{$i}" . $host)) { $value += 1 << $i; } } return $value; }