]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix OC_Connector_Sabre_Locks for SQLite
authorJakob Sack <mail@jakobsack.de>
Sun, 12 Aug 2012 07:06:46 +0000 (09:06 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Fri, 24 Aug 2012 13:00:52 +0000 (15:00 +0200)
lib/connector/sabre/locks.php

index b4878fabc78bf2fd6aecefd9180e9fe30f72991e..a12f2a5440652e0723ba8d4864a0b1b3144effbc 100644 (file)
@@ -41,8 +41,10 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
                // NOTE: the following 10 lines or so could be easily replaced by
                // pure sql. MySQL's non-standard string concatination prevents us
                // from doing this though.
-               $query = 'SELECT * FROM `*PREFIX*locks` WHERE `userid` = ? AND (`created` + `timeout`) > ? AND ((`uri` = ?)';
-               $params = array(OC_User::getUser(),time(),$uri);
+               // Fix: sqlite does not insert time() as a number but as text, making
+               // the equation returning false all the time
+               $query = 'SELECT * FROM `*PREFIX*locks` WHERE `userid` = ? AND (`created` + `timeout`) > '.time().' AND ((`uri` = ?)';
+               $params = array(OC_User::getUser(),$uri);
 
                // We need to check locks for every part in the uri.
                $uriParts = explode('/',$uri);