diff options
author | Johannes 'josch' Schauer <josch@debian.org> | 2018-07-20 13:00:02 +0200 |
---|---|---|
committer | Johannes 'josch' Schauer <josch@debian.org> | 2018-07-20 13:00:02 +0200 |
commit | b93b13c065aab268d0fd12ce423bd45ab203642c (patch) | |
tree | 091e6ab2bb819c299922afb9a6177286817f0039 /caches/FileCache.php | |
parent | cad54b35d336e58278a02e72d2b10b8c14acf120 (diff) |
Import upstream version 2018-07-17
Diffstat (limited to 'caches/FileCache.php')
-rw-r--r-- | caches/FileCache.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/caches/FileCache.php b/caches/FileCache.php index 20323aa..de17d52 100644 --- a/caches/FileCache.php +++ b/caches/FileCache.php @@ -8,7 +8,9 @@ class FileCache implements CacheInterface { protected $param; public function loadData(){ - return unserialize(file_get_contents($this->getCacheFile())); + if(file_exists($this->getCacheFile())) { + return unserialize(file_get_contents($this->getCacheFile())); + } } public function saveData($datas){ @@ -17,7 +19,7 @@ class FileCache implements CacheInterface { $writeStream = file_put_contents($this->getCacheFile(), serialize($datas)); if($writeStream === false) { - throw new \Exception("Cannot write the cache... Do you have the right permissions ?"); + throw new \Exception('Cannot write the cache... Do you have the right permissions ?'); } return $this; |