mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
Fixed links stream wrapper and link class, to work with storage=db
This commit is contained in:
parent
7ac2a20db3
commit
4328a0c906
@ -67,6 +67,10 @@ class egw_link extends solink
|
|||||||
* appname used for returned attached files (!= 'filemanager'!)
|
* appname used for returned attached files (!= 'filemanager'!)
|
||||||
*/
|
*/
|
||||||
const VFS_APPNAME = 'file'; // pseudo-appname for own file-attachments in vfs, this is NOT the vfs-app
|
const VFS_APPNAME = 'file'; // pseudo-appname for own file-attachments in vfs, this is NOT the vfs-app
|
||||||
|
/**
|
||||||
|
* Baseurl for the attachments in the vfs
|
||||||
|
*/
|
||||||
|
const VFS_BASEURL = 'vfs://default/apps';
|
||||||
/**
|
/**
|
||||||
* Turns on debug-messages
|
* Turns on debug-messages
|
||||||
*/
|
*/
|
||||||
@ -704,7 +708,8 @@ class egw_link extends solink
|
|||||||
*/
|
*/
|
||||||
static function vfs_path($app,$id='',$file='')
|
static function vfs_path($app,$id='',$file='')
|
||||||
{
|
{
|
||||||
$path = links_stream_wrapper::BASEURL;
|
$path = self::VFS_BASEURL;
|
||||||
|
|
||||||
if ($app)
|
if ($app)
|
||||||
{
|
{
|
||||||
$path .= '/'.$app;
|
$path .= '/'.$app;
|
||||||
@ -719,6 +724,7 @@ class egw_link extends solink
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$path = egw_vfs::resolve_url($path);
|
||||||
//error_log(__METHOD__."($app,$id,$file)=$path");
|
//error_log(__METHOD__."($app,$id,$file)=$path");
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
@ -740,14 +746,14 @@ class egw_link extends solink
|
|||||||
*/
|
*/
|
||||||
static function attach_file($app,$id,$file,$comment='')
|
static function attach_file($app,$id,$file,$comment='')
|
||||||
{
|
{
|
||||||
|
$entry_dir = self::vfs_path($app,$id);
|
||||||
if (self::DEBUG)
|
if (self::DEBUG)
|
||||||
{
|
{
|
||||||
echo "<p>attach_file: app='$app', id='$id', tmp_name='$file[tmp_name]', name='$file[name]', size='$file[size]', type='$file[type]', path='$file[path]', ip='$file[ip]', comment='$comment'</p>\n";
|
echo "<p>attach_file: app='$app', id='$id', tmp_name='$file[tmp_name]', name='$file[name]', size='$file[size]', type='$file[type]', path='$file[path]', ip='$file[ip]', comment='$comment', entry_dir='$entry_dir'</p>\n";
|
||||||
}
|
}
|
||||||
$entry_dir = self::vfs_path($app,$id);
|
|
||||||
if (file_exists($entry_dir) || ($Ok = mkdir($entry_dir,0,true)))
|
if (file_exists($entry_dir) || ($Ok = mkdir($entry_dir,0,true)))
|
||||||
{
|
{
|
||||||
$Ok = copy($file['tmp_name'],$fname = $entry_dir.'/'.$file['name']) &&
|
$Ok = copy($file['tmp_name'],$fname = egw_vfs::concat($entry_dir,$file['name'])) &&
|
||||||
($stat = links_stream_wrapper::url_stat($fname,0));
|
($stat = links_stream_wrapper::url_stat($fname,0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -164,9 +164,11 @@ class links_stream_wrapper extends sqlfs_stream_wrapper
|
|||||||
*/
|
*/
|
||||||
static function mkdir($path,$mode,$options)
|
static function mkdir($path,$mode,$options)
|
||||||
{
|
{
|
||||||
|
if($path[0] != '/')
|
||||||
if($path[0] != '/') $path = parse_url($path,PHP_URL_PATH);
|
{
|
||||||
|
if (strpos($path,'?') !== false) $query = parse_url($path,PHP_URL_QUERY);
|
||||||
|
$path = parse_url($path,PHP_URL_PATH).($query ? '?'.$query : '');
|
||||||
|
}
|
||||||
list(,$apps,$app,$id,$rel_path) = explode('/',$path,5);
|
list(,$apps,$app,$id,$rel_path) = explode('/',$path,5);
|
||||||
|
|
||||||
$ret = false;
|
$ret = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user