Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/inc/HTTP
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@dev.(none)>2010-03-29 18:13:26 +0400
committerFrank Karlitschek <frank@dev.(none)>2010-03-29 18:13:26 +0400
commit78a1792c0488ed31da5577664924694bf1fb4e40 (patch)
tree13cae434f19c8fb8d866773b3d8c10529c455168 /inc/HTTP
parentba9c95621bccddc8c83689906643a080e1671f22 (diff)
move to sqlite merged
Diffstat (limited to 'inc/HTTP')
-rwxr-xr-xinc/HTTP/WebDAV/Server/Filesystem.php74
1 files changed, 19 insertions, 55 deletions
diff --git a/inc/HTTP/WebDAV/Server/Filesystem.php b/inc/HTTP/WebDAV/Server/Filesystem.php
index eeec0af41bd..81dd64983ff 100755
--- a/inc/HTTP/WebDAV/Server/Filesystem.php
+++ b/inc/HTTP/WebDAV/Server/Filesystem.php
@@ -1,5 +1,6 @@
<?php
-
+
+ require_once "lib_base.php";
require_once "HTTP/WebDAV/Server.php";
require_once "System.php";
@@ -20,38 +21,6 @@
*/
var $base = "";
- /**
- * MySQL Host where property and locking information is stored
- *
- * @access private
- * @var string
- */
- var $db_host = "localhost";
-
- /**
- * MySQL database for property/locking information storage
- *
- * @access private
- * @var string
- */
- var $db_name = "webdav";
-
- /**
- * MySQL user for property/locking db access
- *
- * @access private
- * @var string
- */
- var $db_user = "root";
-
- /**
- * MySQL password for property/locking db access
- *
- * @access private
- * @var string
- */
- var $db_passwd = "";
-
/**
* Serve a webdav request
*
@@ -79,11 +48,6 @@
$this->base = $_SERVER['DOCUMENT_ROOT'];
}
- // establish connection to property/locking db
- mysql_connect($this->db_host, $this->db_user, $this->db_passwd) or die(mysql_error());
- mysql_select_db($this->db_name) or die(mysql_error());
- // TODO throw on connection problems
-
// let the base class do all the work
parent::ServeRequest();
}
@@ -192,11 +156,11 @@
// get additional properties from database
$query = "SELECT ns, name, value FROM properties WHERE path = '$path'";
- $res = mysql_query($query);
- while ($row = mysql_fetch_assoc($res)) {
+ $res = OC_DB::query($query);
+ while ($row = OC_DB::fetch_assoc($res)) {
$info["props"][] = $this->mkprop($row["ns"], $row["name"], $row["value"]);
}
- mysql_free_result($res);
+ OC_DB::free_result($res);
return $info;
}
@@ -478,13 +442,13 @@
if (is_dir($path)) {
$query = "DELETE FROM properties WHERE path LIKE '".$this->_slashify($options["path"])."%'";
- mysql_query($query);
+ OC_DB::query($query);
System::rm("-rf $path");
} else {
unlink ($path);
}
$query = "DELETE FROM properties WHERE path = '$options[path]'";
- mysql_query($query);
+ OC_DB::query($query);
return "204 No Content";
}
@@ -568,13 +532,13 @@
$query = "UPDATE properties
SET path = REPLACE(path, '".$options["path"]."', '".$destpath."')
WHERE path LIKE '".$this->_slashify($options["path"])."%'";
- mysql_query($query);
+ OC_DB::query($query);
}
$query = "UPDATE properties
SET path = '".$destpath."'
WHERE path = '".$options["path"]."'";
- mysql_query($query);
+ OC_DB::query($query);
} else {
if (is_dir($source)) {
$files = System::find($source);
@@ -644,7 +608,7 @@
} else {
$query = "DELETE FROM properties WHERE path = '$options[path]' AND name = '$prop[name]' AND ns = '$prop[ns]'";
}
- mysql_query($query);
+ OC_DB::query($query);
}
}
@@ -662,9 +626,9 @@
{
if (isset($options["update"])) { // Lock Update
$query = "UPDATE locks SET expires = ".(time()+300);
- mysql_query($query);
+ OC_DB::query($query);
- if (mysql_affected_rows()) {
+ if (OC_DB::affected_rows()) {
$options["timeout"] = 300; // 5min hardcoded
return true;
} else {
@@ -681,9 +645,9 @@
, expires = '$options[timeout]'
, exclusivelock = " .($options['scope'] === "exclusive" ? "1" : "0")
;
- mysql_query($query);
+ OC_DB::query($query);
- return mysql_affected_rows() ? "200 OK" : "409 Conflict";
+ return OC_DB::affected_rows() ? "200 OK" : "409 Conflict";
}
/**
@@ -697,9 +661,9 @@
$query = "DELETE FROM locks
WHERE path = '$options[path]'
AND token = '$options[token]'";
- mysql_query($query);
+ OC_DB::query($query);
- return mysql_affected_rows() ? "204 No Content" : "409 Conflict";
+ return OC_DB::affected_rows() ? "204 No Content" : "409 Conflict";
}
/**
@@ -716,11 +680,11 @@
FROM locks
WHERE path = '$path'
";
- $res = mysql_query($query);
+ $res = OC_DB::query($query);
if ($res) {
- $row = mysql_fetch_array($res);
- mysql_free_result($res);
+ $row = OC_DB::fetch_assoc($res);
+ OC_DB::free_result($res);
if ($row) {
$result = array( "type" => "write",