Skip to content
Snippets Groups Projects
Commit 3e77f3f5 authored by Robin Appelman's avatar Robin Appelman
Browse files

fix sqlite compatibility for webdav server

parent d4fa1dda
No related branches found
No related tags found
No related merge requests found
...@@ -512,15 +512,17 @@ ...@@ -512,15 +512,17 @@
} }
$destpath = $this->_unslashify($options["dest"]); $destpath = $this->_unslashify($options["dest"]);
if (is_dir($source)) { if (is_dir($source)) {
$dpath=OC_DB::escape($destpath);
$path=OC_DB::escape($options["path"]);
$query = "UPDATE {$CONFIG_DBTABLEPREFIX}properties $query = "UPDATE {$CONFIG_DBTABLEPREFIX}properties
SET path = REPLACE(path, '".$options["path"]."', '".$destpath."') SET path = REPLACE(path, '$path', '$dpath')
WHERE path LIKE '".$this->_slashify($options["path"])."%'"; WHERE path LIKE '$path%'";
OC_DB::query($query); OC_DB::query($query);
} }
$query = "UPDATE {$CONFIG_DBTABLEPREFIX}properties $query = "UPDATE {$CONFIG_DBTABLEPREFIX}properties
SET path = '".$destpath."' SET path = '$dpath'
WHERE path = '".$options["path"]."'"; WHERE path = '$path'";
OC_DB::query($query); OC_DB::query($query);
} else { } else {
if (OC_FILESYSTEM::is_dir($source)) { if (OC_FILESYSTEM::is_dir($source)) {
...@@ -553,7 +555,7 @@ ...@@ -553,7 +555,7 @@
} }
} else { } else {
if (!OC_FILESYSTEM::copy($file, $destfile)) { if (!OC_FILESYSTEM::copy($file, $destfile)) {
return "409 Conflict"; return "409 Conflict($source) $file --> $destfile ".implode('::',$files);
} }
} }
} }
...@@ -581,10 +583,14 @@ ...@@ -581,10 +583,14 @@
if ($prop["ns"] == "DAV:") { if ($prop["ns"] == "DAV:") {
$options["props"][$key]['status'] = "403 Forbidden"; $options["props"][$key]['status'] = "403 Forbidden";
} else { } else {
$path=OC_DB::escape($options['path']);
$name=OC_DB::escape($prop['name']);
$ns=OC_DB::escape($prop['ns']);
$val=OC_DB::escape($prop['val']);
if (isset($prop["val"])) { if (isset($prop["val"])) {
$query = "REPLACE INTO {$CONFIG_DBTABLEPREFIX}properties SET path = '$options[path]', name = '$prop[name]', ns= '$prop[ns]', value = '$prop[val]'"; $query = "REPLACE INTO {$CONFIG_DBTABLEPREFIX}properties (path,name,ns,value) VALUES('$path','$name','$ns','$val')";
} else { } else {
$query = "DELETE FROM {$CONFIG_DBTABLEPREFIX}properties WHERE path = '$options[path]' AND name = '$prop[name]' AND ns = '$prop[ns]'"; $query = "DELETE FROM {$CONFIG_DBTABLEPREFIX}properties WHERE path = '$path' AND name = '$name' AND ns = '$ns'";
} }
OC_DB::query($query); OC_DB::query($query);
} }
...@@ -659,15 +665,15 @@ ...@@ -659,15 +665,15 @@
} }
} }
$query = "INSERT INTO `{$CONFIG_DBTABLEPREFIX}locks` $locktoken=OC_DB::escape($options['locktoken']);
SET `token` = '$options[locktoken]' $path=OC_DB::escape($options['path']);
, `path` = '$options[path]' $time=time();
, `created` = ".time()." $owner=OC_DB::escape($options['owner']);
, `modified` = ".time()." $timeout=OC_DB::escape($options['timeout']);
, `owner` = '$options[owner]' $exclusive=($options['scope'] === "exclusive" ? "1" : "0");
, `expires` = '$options[timeout]' $query = "INSERT INTO `{$CONFIG_DBTABLEPREFIX}locks`
, `exclusivelock` = " .($options['scope'] === "exclusive" ? "1" : "0")." (`token`,`path`,`created`,`modified`,`owner`,`expires`,`exclusivelock`,`recursive`)
, `recursive` = $recursion"; VALUES ('$locktoken','$path',$time,$time,'$owner','timeout',$exclusive,$recursion)";
OC_DB::query($query); OC_DB::query($query);
$rows=OC_DB::affected_rows(); $rows=OC_DB::affected_rows();
if(!OC_FILESYSTEM::file_exists($fspath) and $rows>0) { if(!OC_FILESYSTEM::file_exists($fspath) and $rows>0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment