- 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;
}
$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)
{
foreach ($options["props"] as $key => $prop) {
if ($prop["ns"] == "DAV:") {
$options["props"][$key]['status'] = "403 Forbidden";
} else {
$attributes = array();
switch($prop['ns'])
{
// allow Webdrive (Novel) to set creation and modification time
case 'http://www.southrivertech.com/':
switch($prop['name'])
{
case 'srt_modifiedtime':
case 'getlastmodified':
$attributes['modified'] = strtotime($prop['val']);
break;
case 'srt_creationtime':
$attributes['created'] = strtotime($prop['val']);
break;
}
break;
}
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);
}
$attributes = array();
switch($prop['ns'])
{
// allow Webdrive to set creation and modification time
case 'http://www.southrivertech.com/':
switch($prop['name'])
{
case 'srt_modifiedtime':
case 'getlastmodified':
$attributes['modified'] = strtotime($prop['val']);
break;
case 'srt_creationtime':
$attributes['created'] = strtotime($prop['val']);
break;
}
break;
case 'DAV:':
switch($prop['name'])
{
// allow netdrive to change the modification time
case 'getlastmodified':
$attributes['modified'] = strtotime($prop['val']);
break;
// not sure why, the filesystem example of the WebDAV class does it ...
default:
$options["props"][$key]['status'] = "403 Forbidden";
break;
}
break;
}
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 ...
}