diff --git a/includes/Wpup/FileCache.php b/includes/Wpup/FileCache.php index fa2dda1..3a165a5 100644 --- a/includes/Wpup/FileCache.php +++ b/includes/Wpup/FileCache.php @@ -1,6 +1,14 @@ getCacheFilename($key); if ( is_file($filename) && is_readable($filename) ) { - $cache = unserialize(file_get_contents($filename)); + $cache = unserialize(base64_decode(file_get_contents($filename))); if ( $cache['expiration_time'] < time() ) { return null; //Cache expired. } else { @@ -41,7 +49,7 @@ public function set($key, $value, $expiration = 0) { 'expiration_time' => time() + $expiration, 'value' => $value, ); - file_put_contents($this->getCacheFilename($key), serialize($cache)); + file_put_contents($this->getCacheFilename($key), base64_encode(serialize($cache))); } /** diff --git a/includes/Wpup/Package.php b/includes/Wpup/Package.php index 24ad4f1..4b97c84 100644 --- a/includes/Wpup/Package.php +++ b/includes/Wpup/Package.php @@ -75,7 +75,7 @@ public function getMetadata() { */ public static function fromArchive($filename, $slug = null, Wpup_Cache $cache = null) { $modified = filemtime($filename); - $cacheKey = 'metadata-' . md5($filename . '|' . filesize($filename) . '|' . $modified); + $cacheKey = 'metadata-b64-' . $slug . '-' . md5($filename . '|' . filesize($filename) . '|' . $modified); $metadata = null; //Try the cache first.