/** * Checks to see if cache exists and is the latest, if it does, return it * * Extra security checks for images * * @param string $originalFile * @param string $cacheFile * * @return bool|string */ protected function checkCache($originalFile, $cacheFile) { if (!($return = parent::checkCache($originalFile, $cacheFile))) { /** * If using the placeholder when the original file doesn't exist * and it has already been cached, return the cached contents. * Also make sure the placeholder hasn't been modified since being cached. */ $this->placeholder = $this->parsePlaceholders($originalFile); if (!file_exists($originalFile) && $this->placeholder) { return parent::checkCache($this->placeholder, $cacheFile); } } return $return; }
/** * 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; }