forked from extern/egroupware
Importexport: Improve handling of targets
- Give error if target uses an unknown stream wrapper - If stream wrapper is not provided, assume VFS
This commit is contained in:
parent
5aba575d25
commit
93e2633107
@ -286,16 +286,25 @@ class importexport_schedule_ui
|
||||
*
|
||||
* $data should contain target & type
|
||||
*/
|
||||
public static function check_target(Array $data) {
|
||||
public static function check_target(Array &$data) {
|
||||
$scheme = parse_url($data['target'], PHP_URL_SCHEME);
|
||||
if($scheme == '' || $scheme == 'file')
|
||||
if($scheme == 'file')
|
||||
{
|
||||
return 'Direct file access not allowed';
|
||||
}
|
||||
else if ($scheme == '')
|
||||
{
|
||||
$data['target'] = Vfs::PREFIX.$data['target'];
|
||||
return static::check_target($data);
|
||||
}
|
||||
|
||||
if($scheme == Vfs::SCHEME && !in_array(Vfs::SCHEME, stream_get_wrappers())) {
|
||||
stream_wrapper_register(Vfs::SCHEME, 'vfs_stream_wrapper', STREAM_IS_URL);
|
||||
}
|
||||
else if (!in_array($scheme, stream_get_wrappers()))
|
||||
{
|
||||
return lang("Unable to access files with '%1'",$scheme);
|
||||
}
|
||||
|
||||
if ($data['type'] == 'import' && ($scheme == Vfs::SCHEME && !Vfs::is_readable($data['target'])))
|
||||
{
|
||||
@ -398,7 +407,7 @@ class importexport_schedule_ui
|
||||
$data['last_run'] = time();
|
||||
|
||||
// Lock job for an hour to prevent multiples overlapping
|
||||
$data['lock'] = time() + 3600;
|
||||
// $data['lock'] = time() + 3600;
|
||||
self::update_job($data, true);
|
||||
|
||||
// check file
|
||||
|
@ -137,6 +137,7 @@ too many matches importexport en too many matches
|
||||
translation importexport en custom modifocation
|
||||
true importexport en True
|
||||
try importexport en Try
|
||||
unable to access files with '%1' importexport en Unable to access files with '%1'
|
||||
unable to delete importexport en Unable to delete
|
||||
unable to link to %1 "%2" importexport en Unable to link to %1 "%2"
|
||||
unable to schedule importexport en Unable to schedule.
|
||||
|
Loading…
Reference in New Issue
Block a user