Fix some database errors

This commit is contained in:
Robin Appelman 2010-07-05 13:39:53 +02:00
parent db5ac0b477
commit a26ef87840
3 changed files with 4 additions and 5 deletions

View File

@ -324,6 +324,7 @@
*/ */
function PUT(&$options) function PUT(&$options)
{ {
error_log("put $fspath");
$fspath = $options["path"]; $fspath = $options["path"];
$dir = dirname($fspath); $dir = dirname($fspath);
if (!OC_FILESYSTEM::file_exists($dir) || !OC_FILESYSTEM::is_dir($dir)) { if (!OC_FILESYSTEM::file_exists($dir) || !OC_FILESYSTEM::is_dir($dir)) {
@ -641,14 +642,14 @@
return true; return true;
} else {//check for indirect refresh } else {//check for indirect refresh
$query = "SELECT * $query = "SELECT *
FROM locks FROM {$CONFIG_DBTABLEPREFIX}locks
WHERE recursive = 1 WHERE recursive = 1
"; ";
$res = OC_DB::select($query); $res = OC_DB::select($query);
foreach($res as $row){ foreach($res as $row){
if(strpos($options['path'],$row['path'])==0){//are we a child of a folder with an recursive lock if(strpos($options['path'],$row['path'])==0){//are we a child of a folder with an recursive lock
$where = "WHERE path = '$row[path]' AND token = '$options[update]'"; $where = "WHERE path = '$row[path]' AND token = '$options[update]'";
$query = "UPDATE `locks` SET `expires` = '$options[timeout]', `modified` = ".time()." $where"; $query = "UPDATE `{$CONFIG_DBTABLEPREFIX}locks` SET `expires` = '$options[timeout]', `modified` = ".time()." $where";
OC_DB::query($query); OC_DB::query($query);
$options['owner'] = $row['owner']; $options['owner'] = $row['owner'];
$options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared"; $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared";
@ -727,7 +728,7 @@
}else{ }else{
//check for recursive locks; //check for recursive locks;
$query = "SELECT * $query = "SELECT *
FROM locks FROM {$CONFIG_DBTABLEPREFIX}locks
WHERE recursive = 1 WHERE recursive = 1
"; ";
$res = OC_DB::select($query); $res = OC_DB::select($query);

View File

@ -336,7 +336,6 @@ class OC_CONFIG{
$result = pg_exec($connection, $query); $result = pg_exec($connection, $query);
} }
} }
global $CONFIG_DBTABLEPREFIX;
} }
} }
?> ?>

View File

@ -69,7 +69,6 @@ class OC_LOG {
$user=$_SESSION['username_clean']; $user=$_SESSION['username_clean'];
$result = OC_DB::select('select `timestamp`,`user`,`type`,`message` from '.$CONFIG_DBTABLEPREFIX.'log where user=\''.$user.'\' order by timestamp desc limit 20'); $result = OC_DB::select('select `timestamp`,`user`,`type`,`message` from '.$CONFIG_DBTABLEPREFIX.'log where user=\''.$user.'\' order by timestamp desc limit 20');
} }
$result = OC_DB::select($query);
foreach($result as $entry){ foreach($result as $entry){
echo('<tr class="browserline">'); echo('<tr class="browserline">');
echo('<td class="sizetext">'.date($CONFIG_DATEFORMAT,$entry['timestamp']).'</td>'); echo('<td class="sizetext">'.date($CONFIG_DATEFORMAT,$entry['timestamp']).'</td>');