diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-02-26 14:21:06 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-02-26 14:21:06 +0100 |
commit | d4d09b06f80462394983fe04d291a0345dd57280 (patch) | |
tree | e4452055533c7ec7bb6fa49ac7f6b5c93ba8c4f7 /lib/filecache.php | |
parent | ea8f71a19c59e7138d4a504bacc0beb410fc77e8 (diff) | |
parent | 3d0d47957e65a72e17d33a924c9c4efcd5088ed2 (diff) | |
download | nextcloud-server-d4d09b06f80462394983fe04d291a0345dd57280.tar.gz nextcloud-server-d4d09b06f80462394983fe04d291a0345dd57280.zip |
merge master into encryption
Diffstat (limited to 'lib/filecache.php')
-rw-r--r-- | lib/filecache.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/filecache.php b/lib/filecache.php index 6ccb0d90ef1..732160c216a 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -112,7 +112,10 @@ class OC_FileCache{ $mimePart=dirname($data['mimetype']); $user=OC_User::getUser(); $query=OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart,user,writable,encrypted,versioned) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)'); - $query->execute(array($parent,basename($path),$path,$data['size'],$data['mtime'],$data['ctime'],$data['mimetype'],$mimePart,$user,$data['writable'],$data['encrypted'],$data['versioned'])); + $result=$query->execute(array($parent,basename($path),$path,$data['size'],$data['mtime'],$data['ctime'],$data['mimetype'],$mimePart,$user,$data['writable'],$data['encrypted'],$data['versioned'])); + if(OC_DB::isError($result)){ + OC_Log::write('files','error while writing file('.$path.') to cache',OC_Log::ERROR); + } } /** @@ -137,7 +140,10 @@ class OC_FileCache{ $sql = 'UPDATE *PREFIX*fscache SET '.implode(' , ',$queryParts).' WHERE id=?'; $query=OC_DB::prepare($sql); - $query->execute($arguments); + $result=$query->execute($arguments); + if(OC_DB::isError($result)){ + OC_Log::write('files','error while updating file('.$path.') in cache',OC_Log::ERROR); + } } /** @@ -271,11 +277,20 @@ class OC_FileCache{ */ private static function getFileId($path){ $query=OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?'); - $result=$query->execute(array($path))->fetchRow(); + if(OC_DB::isError($query)){ + OC_Log::write('files','error while getting file id of '.$path,OC_Log::ERROR); + return -1; + } + $result=$query->execute(array($path)); + if(OC_DB::isError($result)){ + OC_Log::write('files','error while getting file id of '.$path,OC_Log::ERROR); + return -1; + } + $result=$result->fetchRow(); if(is_array($result)){ return $result['id']; }else{ - OC_Log::write('getFileId(): file not found in cache ('.$path.')','core',OC_Log::DEBUG); + OC_Log::write('getFileId(): file not found in cache ('.$path.')','core',OC_Log::DEBUG); return -1; } } |