/** * Checks if giving a relative path results in the same path under water. */ public function testCacheDirLocation() { $cacheDirLocation = $this->cache->getDirectory(); $filesystem = new Filesystem(); $relative = $filesystem->makePathRelative($cacheDirLocation, __DIR__); $newCache = new Cache($relative); $this->assertEquals($cacheDirLocation, $newCache->getDirectory()); }
/** * Check if the cache version matches Bolt's current version * * @return boolean TRUE - versions match * FALSE - versions don't match */ protected function checkCacheVersion() { $file = $this->cache->getDirectory() . '/.version'; if (!file_exists($file)) { return false; } $version = md5($this->boltVersion . $this->boltName); $cached = file_get_contents($file); if ($version === $cached) { return true; } return false; }
/** * Write our version string out to given cache directory */ protected function updateCacheVersion() { $version = md5($this->boltVersion); file_put_contents($this->cache->getDirectory() . '/.version', $version); }
private function getVersionFileName() { return dirname(dirname($this->cache->getDirectory())) . '/.version'; }