|
|
@ -102,8 +102,10 @@ class OC_FileCache{ |
|
|
|
$mimePart=dirname($data['mimetype']); |
|
|
|
$mimePart=dirname($data['mimetype']); |
|
|
|
$user=OC_User::getUser(); |
|
|
|
$user=OC_User::getUser(); |
|
|
|
$query=OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart,user,writable) VALUES(?,?,?,?,?,?,?,?,?,?)'); |
|
|
|
$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=?'; |
|
|
|
$sql = 'UPDATE *PREFIX*fscache SET '.implode(' , ',$queryParts).' WHERE id=?'; |
|
|
|
$query=OC_DB::prepare($sql); |
|
|
|
$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){ |
|
|
|
private static function getFileId($path){ |
|
|
|
$query=OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE 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)){ |
|
|
|
if(is_array($result)){ |
|
|
|
return $result['id']; |
|
|
|
return $result['id']; |
|
|
|
}else{ |
|
|
|
}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; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|