fixing 3 failed litmus tests:

- copy_coll, move_coll: using egw_vfs::find instead of System::find which we dont require and fails anyway for some reason
- copy_shallow: by updating COPY with changes from 1.0.0RC6 (depth="0" is allowed for copy, thought HTTP_WebDAV_Server still copies the whole collection!)
This commit is contained in:
Ralf Becker 2011-07-31 10:06:11 +00:00
parent a1fd7f5f1e
commit ece7c6de04

View File

@ -128,7 +128,28 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
$source = $this->base .$options["path"];
if (!file_exists($source)) return "404 Not found";
if (is_dir($source)) { // resource is a collection
switch ($options["depth"]) {
case "infinity": // valid
break;
case "0": // valid for COPY only
if ($del) { // MOVE?
return "400 Bad request";
}
break;
case "1": // invalid for both COPY and MOVE
default:
return "400 Bad request";
}
}
$dest = $this->base . $options["dest"];
$destdir = dirname($dest);
if (!file_exists($destdir) || !is_dir($destdir)) {
return "409 Conflict";
}
$new = !file_exists($dest);
$existing_col = false;
@ -158,11 +179,6 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
}
}
if (is_dir($source) && ($options["depth"] != "infinity")) {
// RFC 2518 Section 9.2, last paragraph
return "400 Bad request";
}
if ($del) {
if (!rename($source, $dest)) {
return "500 Internal server error";
@ -182,9 +198,8 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
mysql_query($query);
*/
} else {
if (is_dir($source)) {
$files = System::find($source);
$files = array_reverse($files);
if (is_dir($source) && $options['depth'] == 'infinity') {
$files = egw_vfs::find($source,array('depth' => true,'url' => true)); // depth=true: return dirs first, url=true: allow urls!
} else {
$files = array($source);
}