aboutsummaryrefslogtreecommitdiffstats
path: root/lib/filecache.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-25 20:27:16 +0100
committerRobin Appelman <icewind@owncloud.com>2012-02-25 20:27:16 +0100
commit4f627c428eb64fae307ea293e8093e345d742edc (patch)
treeb14d265ce4ed7ab7ce0fcc381605bd9a1ecaafda /lib/filecache.php
parentdda79a90cf50f98c1dc4c98401be8707b7103346 (diff)
downloadnextcloud-server-4f627c428eb64fae307ea293e8093e345d742edc.tar.gz
nextcloud-server-4f627c428eb64fae307ea293e8093e345d742edc.zip
some more error reporting during filesystem scan
Diffstat (limited to 'lib/filecache.php')
-rw-r--r--lib/filecache.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/filecache.php b/lib/filecache.php
index faadddfb37e..cabad329b12 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -102,8 +102,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) VALUES(?,?,?,?,?,?,?,?,?,?)');
- $query->execute(array($parent,basename($path),$path,$data['size'],$data['mtime'],$data['ctime'],$data['mimetype'],$mimePart,$user,$data['writable']));
-
+ $result=$query->execute(array($parent,basename($path),$path,$data['size'],$data['mtime'],$data['ctime'],$data['mimetype'],$mimePart,$user,$data['writable']));
+ if(OC_DB::isError($result)){
+ OC_Log::write('files','error while writing file('.$path.') to cache',OC_Log::ERROR);
+ }
}
/**
@@ -128,7 +130,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);
+ }
}
/**
@@ -262,11 +267,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;
}
}