summaryrefslogtreecommitdiffstats
path: root/lib/connector/sabre/locks.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connector/sabre/locks.php')
-rw-r--r--lib/connector/sabre/locks.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/connector/sabre/locks.php b/lib/connector/sabre/locks.php
index a12f2a54406..0ddc8b18d2f 100644
--- a/lib/connector/sabre/locks.php
+++ b/lib/connector/sabre/locks.php
@@ -41,9 +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.
- // 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` = ?)';
+ // NOTE: SQLite requires time() to be inserted directly. That's ugly
+ // but otherwise reading locks from SQLite Databases will return
+ // nothing
+ $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.
@@ -72,8 +73,8 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
}
$query.=')';
- $stmt = OC_DB::prepare($query);
- $result = $stmt->execute($params);
+ $stmt = OC_DB::prepare( $query );
+ $result = $stmt->execute( $params );
$lockList = array();
while( $row = $result->fetchRow()){
@@ -110,7 +111,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
$locks = $this->getLocks($uri,false);
$exists = false;
- foreach($locks as $k=>$lock) {
+ foreach($locks as $lock) {
if ($lock->token == $lockInfo->token) $exists = true;
}