mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-02 12:54:18 +01:00
* Filemanager/WebDAV: understand Windows7 modification time attribute and setting and returning is as vfs modification time
This commit is contained in:
parent
d35dcaa295
commit
926ffc1688
@ -316,6 +316,26 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
|
|||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Which regular properties should be copied to different namespaces and names,
|
||||||
|
* because PROPPATCH stores them not as properties under their namespace and name,
|
||||||
|
* but simply sets the standard stat values instead.
|
||||||
|
*
|
||||||
|
* @var array stat-attr => array(array('ns'=>namespace, 'name'=>attribute-name)[, ...])
|
||||||
|
*/
|
||||||
|
public static $auto_props = array(
|
||||||
|
'mtime' => array(
|
||||||
|
array('ns' => 'urn:schemas-microsoft-com:', 'name' => 'Win32LastModifiedTime'),
|
||||||
|
array('ns' => 'http://www.southrivertech.com/', 'name' => 'srt_modifiedtime'),
|
||||||
|
array('ns' => 'http://www.southrivertech.com/', 'name' => 'getlastmodified'),
|
||||||
|
),
|
||||||
|
'ctime' => array(
|
||||||
|
// no streamwrapper interface / php function to set the ctime currently
|
||||||
|
//array('ns' => 'urn:schemas-microsoft-com:', 'name' => 'Win32CreationTime'),
|
||||||
|
//array('ns' => 'http://www.southrivertech.com/', 'name' => 'srt_creationtime'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PROPFIND method handler
|
* PROPFIND method handler
|
||||||
*
|
*
|
||||||
@ -334,13 +354,33 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
|
|||||||
$path2n = array();
|
$path2n = array();
|
||||||
foreach($files['files'] as $n => $info)
|
foreach($files['files'] as $n => $info)
|
||||||
{
|
{
|
||||||
if (!$n && substr($info['path'],-1) == '/')
|
$path = $info['path'];
|
||||||
|
if (!$n && substr($info['path'],-1) == '/') $path = substr($info['path'],0,-1);
|
||||||
|
$path2n[$path] = $n;
|
||||||
|
|
||||||
|
// adding some properties used instead of regular DAV times
|
||||||
|
if (($stat = egw_vfs::stat($path)))
|
||||||
{
|
{
|
||||||
$path2n[substr($info['path'],0,-1)] = $n;
|
$fileprops =& $files['files'][$path2n[$path]]['props'];
|
||||||
}
|
foreach(self::$auto_props as $attr => $props)
|
||||||
else
|
{
|
||||||
{
|
switch($attr)
|
||||||
$path2n[$info['path']] = $n;
|
{
|
||||||
|
case 'ctime':
|
||||||
|
case 'mtime':
|
||||||
|
case 'atime':
|
||||||
|
$value = gmdate('D, d M Y H:i:s T',$stat[$attr]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
foreach($props as $prop)
|
||||||
|
{
|
||||||
|
$prop['val'] = $value;
|
||||||
|
$fileprops[] = $prop;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($path2n && ($path2props = egw_vfs::propfind(array_keys($path2n),null)))
|
if ($path2n && ($path2props = egw_vfs::propfind(array_keys($path2n),null)))
|
||||||
@ -359,6 +399,7 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->debug) error_log(__METHOD__."() props=".array2string($files['files']));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,13 +444,12 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
|
|||||||
* They are not stored as (arbitrary) WebDAV properties with their own namespace and name,
|
* They are not stored as (arbitrary) WebDAV properties with their own namespace and name,
|
||||||
* but in the regular vfs attributes.
|
* but in the regular vfs attributes.
|
||||||
*
|
*
|
||||||
* @todo Store a properties in the DB and retrieve them in PROPFIND again.
|
|
||||||
* @param array general parameter passing array
|
* @param array general parameter passing array
|
||||||
* @return bool true on success
|
* @return bool true on success
|
||||||
*/
|
*/
|
||||||
function PROPPATCH(&$options)
|
function PROPPATCH(&$options)
|
||||||
{
|
{
|
||||||
$path = $GLOBALS['egw']->translation->convert($options['path'],'utf-8');
|
$path = translation::convert($options['path'],'utf-8');
|
||||||
|
|
||||||
foreach ($options['props'] as $key => $prop) {
|
foreach ($options['props'] as $key => $prop) {
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
@ -424,7 +464,7 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
|
|||||||
egw_vfs::touch($path,strtotime($prop['val']));
|
egw_vfs::touch($path,strtotime($prop['val']));
|
||||||
break;
|
break;
|
||||||
//case 'srt_creationtime':
|
//case 'srt_creationtime':
|
||||||
// not supported via the streamwrapper interface atm.
|
// no streamwrapper interface / php function to set the ctime currently
|
||||||
//$attributes['created'] = strtotime($prop['val']);
|
//$attributes['created'] = strtotime($prop['val']);
|
||||||
//break;
|
//break;
|
||||||
default:
|
default:
|
||||||
@ -447,6 +487,21 @@ class vfs_webdav_server extends HTTP_WebDAV_Server_Filesystem
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'urn:schemas-microsoft-com:':
|
||||||
|
switch($prop['name'])
|
||||||
|
{
|
||||||
|
case 'Win32LastModifiedTime':
|
||||||
|
egw_vfs::touch($path,strtotime($prop['val']));
|
||||||
|
break;
|
||||||
|
case 'Win32CreationTime': // eg. "Wed, 14 Sep 2011 15:48:26 GMT"
|
||||||
|
case 'Win32LastAccessTime':
|
||||||
|
case 'Win32FileAttributes': // not sure what that is, it was always "00000000"
|
||||||
|
default:
|
||||||
|
if (!egw_vfs::proppatch($path,array($prop))) $options['props'][$key]['status'] = '403 Forbidden';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case egw_vfs::DEFAULT_PROP_NAMESPACE.'customfields/': // eGW's customfields
|
case egw_vfs::DEFAULT_PROP_NAMESPACE.'customfields/': // eGW's customfields
|
||||||
$prop['ns'] = egw_vfs::DEFAULT_PROP_NAMESPACE;
|
$prop['ns'] = egw_vfs::DEFAULT_PROP_NAMESPACE;
|
||||||
$prop['name'] = '#'.$prop['name'];
|
$prop['name'] = '#'.$prop['name'];
|
||||||
|
Loading…
Reference in New Issue
Block a user