- allow the cost-free netdrive to set the modification date

- also storing the modification date in the filesystem, as reloads resets it to that
This commit is contained in:
Ralf Becker 2008-01-17 05:40:38 +00:00
parent 1812979a6b
commit 9364f9e77e
2 changed files with 57 additions and 30 deletions

View File

@ -1970,6 +1970,18 @@
$edited_comment = 1; $edited_comment = 1;
} }
$to_write[$this->vfs_column_prefix.$attribute] = $data['attributes'][$attribute]; $to_write[$this->vfs_column_prefix.$attribute] = $data['attributes'][$attribute];
if ($this->file_actions)
{
switch($attribute)
{
// if the modification time get's set, we also set it in the filesystem, as
// the next reload reset it again to the modification time of the filesystem
case 'modified':
touch($p->real_full_path,$data['attributes'][$attribute]);
break;
}
}
} }
} }

View File

@ -405,39 +405,54 @@ class vfs_webdav_server extends HTTP_WebDAV_Server
function PROPPATCH(&$options) function PROPPATCH(&$options)
{ {
foreach ($options["props"] as $key => $prop) { foreach ($options["props"] as $key => $prop) {
if ($prop["ns"] == "DAV:") { $attributes = array();
$options["props"][$key]['status'] = "403 Forbidden"; switch($prop['ns'])
} else { {
$attributes = array(); // allow Webdrive to set creation and modification time
switch($prop['ns']) case 'http://www.southrivertech.com/':
{ switch($prop['name'])
// allow Webdrive (Novel) to set creation and modification time {
case 'http://www.southrivertech.com/': case 'srt_modifiedtime':
switch($prop['name']) case 'getlastmodified':
{ $attributes['modified'] = strtotime($prop['val']);
case 'srt_modifiedtime': break;
case 'getlastmodified': case 'srt_creationtime':
$attributes['modified'] = strtotime($prop['val']); $attributes['created'] = strtotime($prop['val']);
break; break;
case 'srt_creationtime': }
$attributes['created'] = strtotime($prop['val']); break;
break;
} case 'DAV:':
break; switch($prop['name'])
} {
if ($attributes) // allow netdrive to change the modification time
{ case 'getlastmodified':
$vfs_data = array( $attributes['modified'] = strtotime($prop['val']);
'string' => $GLOBALS['egw']->translation->convert($options['path'],'utf-8'), break;
'relatives' => array(RELATIVE_ROOT), // filename is relative to the vfs-root // not sure why, the filesystem example of the WebDAV class does it ...
'attributes'=> $attributes, default:
); $options["props"][$key]['status'] = "403 Forbidden";
$this->vfs->set_attributes($vfs_data); break;
} }
break;
} }
if ($this->debug) $props[] = '('.$prop["ns"].')'.$prop['name'].'='.$prop['val']; if ($this->debug) $props[] = '('.$prop["ns"].')'.$prop['name'].'='.$prop['val'];
} }
if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.": path=$options[path],props=".implode(', ',$props)); if ($attributes)
{
$vfs_data = array(
'string' => $GLOBALS['egw']->translation->convert($options['path'],'utf-8'),
'relatives' => array(RELATIVE_ROOT), // filename is relative to the vfs-root
'attributes'=> $attributes,
);
$this->vfs->set_attributes($vfs_data);
}
if ($this->debug)
{
error_log(__CLASS__.'::'.__METHOD__.": path=$options[path], props=".implode(', ',$props));
if ($attributes) error_log(__CLASS__.'::'.__METHOD__.": path=$options[path], set attributes=".str_replace("\n",' ',print_r($attributes,true)));
}
return ""; // this is as the filesystem example handler does it, no true or false ... return ""; // this is as the filesystem example handler does it, no true or false ...
} }