trying to work arround "PHP Fatal error: Cannot unset string offsets in /usr/share/egroupware/importexport/inc/class.importexport_schedule_ui.inc.php on line 444"

This commit is contained in:
Ralf Becker 2012-03-13 10:22:15 +00:00
parent dff1f3894e
commit b68cbecbe2

View File

@ -423,16 +423,10 @@
if(is_dir($data['target'])) if(is_dir($data['target']))
{ {
$dir = opendir($data['target']); $targets = array();
$contents = array(); foreach(scandir($data['target']) as $target)
while(false !== ($item = readdir($dir))) {
$contents[] = $item;
}
closedir($dir);
$targets = array_diff($contents, array('.','..'));
$files = array();
foreach($targets as $key => &$target)
{ {
if ($target == '.' || $target == '..') continue;
$target = $data['target'].(substr($data['target'],-1) == '/' ? '' : '/').$target; $target = $data['target'].(substr($data['target'],-1) == '/' ? '' : '/').$target;
// Check modification time, make sure it's not currently being written // Check modification time, make sure it's not currently being written
@ -441,17 +435,14 @@
if($mod_time >= time() - 10) if($mod_time >= time() - 10)
{ {
$data['result'][$target] = lang('Skipped'); $data['result'][$target] = lang('Skipped');
unset($targets[$key]);
continue; continue;
} }
$files[$mod_time.$target] = $target; $targets[$mod_time.$target] = $target;
} }
if($files) if($targets)
{ {
ksort($files); ksort($targets);
} }
$targets = $files;
unset($target); // Unset it, or it will be overwritten in loop below
} }
else else
{ {