mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
* ImportExport: fix not working import from http(s)
caused by trying to seek a non-seekable http steam
This commit is contained in:
parent
158f683e69
commit
dbecc4ee84
@ -528,6 +528,15 @@ class importexport_schedule_ui
|
||||
{
|
||||
if (($resource = @fopen( $target, $data['type'] == 'import' ? 'rb' : 'wb' )))
|
||||
{
|
||||
// if steam is NOT seekable (e.g. http), copy it into temp stream, which is
|
||||
if ($data['type'] == 'import' && ($metadata=stream_get_meta_data($resource)) &&
|
||||
!$metadata['seekable'] && ($tmp = fopen('php://temp', 'r+')))
|
||||
{
|
||||
stream_copy_to_stream($resource, $tmp);
|
||||
fclose($resource);
|
||||
fseek($tmp, 0);
|
||||
$resource = $tmp;
|
||||
}
|
||||
$result = $po->$type( $resource, $definition );
|
||||
|
||||
fclose($resource);
|
||||
@ -685,4 +694,4 @@ class importexport_schedule_ui
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user