mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
Fix exporting to a directory
This commit is contained in:
parent
df1f6b2ff4
commit
dff86e4842
@ -344,9 +344,9 @@
|
||||
*/
|
||||
private static function is__writable($path) {
|
||||
if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
|
||||
return is__writable($path.uniqid(mt_rand()).'.tmp');
|
||||
return self::is__writable($path.uniqid(mt_rand()).'.tmp');
|
||||
else if (is_dir($path))
|
||||
return is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
|
||||
return self::is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
|
||||
// check tmp file for read/write capabilities
|
||||
$rm = file_exists($path);
|
||||
$f = @fopen($path, 'a');
|
||||
@ -423,25 +423,33 @@
|
||||
|
||||
if(is_dir($data['target']))
|
||||
{
|
||||
$targets = array();
|
||||
foreach(scandir($data['target']) as $target)
|
||||
if($data['type'] == 'import')
|
||||
{
|
||||
if ($target == '.' || $target == '..') continue;
|
||||
$target = $data['target'].(substr($data['target'],-1) == '/' ? '' : '/').$target;
|
||||
|
||||
// Check modification time, make sure it's not currently being written
|
||||
// Skip files modified in the last 10 seconds
|
||||
$mod_time = filemtime($target);
|
||||
if($mod_time >= time() - 10)
|
||||
$targets = array();
|
||||
foreach(scandir($data['target']) as $target)
|
||||
{
|
||||
$data['result'][$target] = lang('Skipped');
|
||||
continue;
|
||||
if ($target == '.' || $target == '..') continue;
|
||||
$target = $data['target'].(substr($data['target'],-1) == '/' ? '' : '/').$target;
|
||||
|
||||
// Check modification time, make sure it's not currently being written
|
||||
// Skip files modified in the last 10 seconds
|
||||
$mod_time = filemtime($target);
|
||||
if($mod_time >= time() - 10)
|
||||
{
|
||||
$data['result'][$target] = lang('Skipped');
|
||||
continue;
|
||||
}
|
||||
$targets[$mod_time.$target] = $target;
|
||||
}
|
||||
if($targets)
|
||||
{
|
||||
ksort($targets);
|
||||
}
|
||||
$targets[$mod_time.$target] = $target;
|
||||
}
|
||||
if($targets)
|
||||
else
|
||||
{
|
||||
ksort($targets);
|
||||
// Create a unique file for export
|
||||
$targets = array($data['target'].uniqid($definition->name).'.'.$po->get_filesuffix());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user