diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-05-03 23:16:18 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-05-03 23:17:03 +0200 |
commit | a22a79cddde69fc6380fc43ea051c9a034226629 (patch) | |
tree | fd426e3a108766a6e69f7478f16177bbc0dd9b42 /lib | |
parent | 76a60a2fc3237524e9736872e36217f7b94afa19 (diff) | |
download | nextcloud-server-a22a79cddde69fc6380fc43ea051c9a034226629.tar.gz nextcloud-server-a22a79cddde69fc6380fc43ea051c9a034226629.zip |
fix filecache for postgresql
Diffstat (limited to 'lib')
-rw-r--r-- | lib/filecache.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/filecache.php b/lib/filecache.php index fce9785f745..091a7939e1a 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -110,8 +110,13 @@ class OC_FileCache{ $data['versioned']=false; } $mimePart=dirname($data['mimetype']); + $data['size']=(int)$data['size']; + $data['ctime']=(int)$data['mtime']; + $data['writable']=(int)$data['writable']; + $data['encrypted']=(int)$data['encrypted']; + $data['versioned']=(int)$data['versioned']; $user=OC_User::getUser(); - $query=OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, path_hash, size, mtime, ctime, mimetype, mimepart,user,writable,encrypted,versioned) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)'); + $query=OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, path_hash, size, mtime, ctime, mimetype, mimepart,`user`,writable,encrypted,versioned) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)'); $result=$query->execute(array($parent,basename($path),$path,md5($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); @@ -208,9 +213,9 @@ class OC_FileCache{ } $rootLen=strlen($root); if(!$returnData){ - $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE name LIKE ? AND user=?'); + $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE name LIKE ? AND `user`=?'); }else{ - $query=OC_DB::prepare('SELECT * FROM *PREFIX*fscache WHERE name LIKE ? AND user=?'); + $query=OC_DB::prepare('SELECT * FROM *PREFIX*fscache WHERE name LIKE ? AND `user`=?'); } $result=$query->execute(array("%$search%",OC_User::getUser())); $names=array(); @@ -332,7 +337,7 @@ class OC_FileCache{ if(!$user){ $user=OC_User::getUser(); } - $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE id=? AND user=?'); + $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE id=? AND `user`=?'); $result=$query->execute(array($id,$user)); $row=$result->fetchRow(); $path=$row['path']; @@ -594,10 +599,10 @@ class OC_FileCache{ $root .= '%'; $user=OC_User::getUser(); if(!$part2){ - $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE mimepart=? AND user=? AND path LIKE ?'); + $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE mimepart=? AND `user`=? AND path LIKE ?'); $result=$query->execute(array($part1,$user, $root)); }else{ - $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE mimetype=? AND user=? AND path LIKE ? '); + $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE mimetype=? AND `user`=? AND path LIKE ? '); $result=$query->execute(array($part1.'/'.$part2,$user, $root)); } $names=array(); |