diff options
Diffstat (limited to 'lib/filecache/cached.php')
-rw-r--r-- | lib/filecache/cached.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/filecache/cached.php b/lib/filecache/cached.php index 261bd2f572b..9b1eb4f7803 100644 --- a/lib/filecache/cached.php +++ b/lib/filecache/cached.php @@ -18,11 +18,22 @@ class OC_FileCache_Cached{ $root=OC_Filesystem::getRoot(); } $path=$root.$path; - $query=OC_DB::prepare('SELECT `path`,`ctime`,`mtime`,`mimetype`,`size`,`encrypted`,`versioned`,`writable` FROM `*PREFIX*fscache` WHERE `path_hash`=?'); - $result=$query->execute(array(md5($path)))->fetchRow(); + $stmt=OC_DB::prepare('SELECT `path`,`ctime`,`mtime`,`mimetype`,`size`,`encrypted`,`versioned`,`writable` FROM `*PREFIX*fscache` WHERE `path_hash`=?'); + if ( ! OC_DB::isError($stmt) ) { + $result=$stmt->execute(array(md5($path))); + if ( ! OC_DB::isError($result) ) { + $result = $result->fetchRow(); + } else { + OC:Log::write('OC_FileCache_Cached', 'could not execute get: '. OC_DB::getErrorMessage($result), OC_Log::ERROR); + $result = false; + } + } else { + OC_Log::write('OC_FileCache_Cached', 'could not prepare get: '. OC_DB::getErrorMessage($stmt), OC_Log::ERROR); + $result = false; + } if(is_array($result)) { if(isset(self::$savedData[$path])) { - $result=array_merge($result,self::$savedData[$path]); + $result=array_merge($result, self::$savedData[$path]); } return $result; }else{ @@ -54,7 +65,7 @@ class OC_FileCache_Cached{ if($root===false) { $root=OC_Filesystem::getRoot(); } - $parent=OC_FileCache::getId($path,$root); + $parent=OC_FileCache::getId($path, $root); if($parent==-1) { return array(); } @@ -63,7 +74,7 @@ class OC_FileCache_Cached{ if(is_array($result)) { return $result; }else{ - OC_Log::write('files','getFolderContent(): file not found in cache ('.$path.')',OC_Log::DEBUG); + OC_Log::write('files', 'getFolderContent(): file not found in cache ('.$path.')', OC_Log::DEBUG); return false; } } |