/** * Checks to see if cache exists and is the latest, if it does, return it * It also checks to see if this is LESS cache and makes sure all imported files are the latest * * @param string $originalFile * @param string $cacheFile * * @return bool|string|array */ protected function checkCache($originalFile, $cacheFile) { if (!($ret = parent::checkCache($originalFile, $cacheFile))) { return false; } if (Utils::isSerialized($ret, $ret)) { // Go through each file and make sure none of them have changed foreach ($ret['files'] as $file => $lastModified) { if (filemtime($file) > $lastModified) { return false; } } $ret = serialize($ret); } return $ret; }
/** * Overwrite the _setupFile function so placeholder images can be shown instead of broken images * * * @param string $originalFile * @param string $cacheFile */ protected function setupFile($originalFile, $cacheFile) { if (count($this->filters) > 0) { $this->checkNumberOfAllowedFilters($cacheFile); if ($this->options['checkReferrer']) { $this->checkReferrer(); } } if (!file_exists($originalFile)) { // If we are using a placeholder and that exists, use it! if ($this->placeholder && file_exists($this->placeholder)) { $originalFile = $this->placeholder; } } parent::setupFile($originalFile, $cacheFile); }