mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
- Fix sorting by modification time to handle files changed at the same time
- Catch exceptions for logging
This commit is contained in:
parent
f175a12c6e
commit
68798a2200
@ -131,6 +131,7 @@ abstract class importexport_basic_import_csv implements importexport_iface_impor
|
||||
$this->results = array();
|
||||
|
||||
// Failures
|
||||
$this->warnings = array();
|
||||
$this->errors = array();
|
||||
|
||||
while ( $record = $import_csv->get_record() ) {
|
||||
|
@ -372,7 +372,7 @@ class importexport_import_csv implements importexport_iface_import_record { //,
|
||||
// Need to handle format first
|
||||
if($format == 1)
|
||||
{
|
||||
$formatted = egw_time::createFromFormat(egw_time::$user_dateformat, $record[$name]);
|
||||
$formatted = egw_time::createFromFormat('!'.egw_time::$user_dateformat, $record[$name]);
|
||||
if($formatted && $errors = egw_time::getLastErrors() && $errors['error_count'] == 0)
|
||||
{
|
||||
$record[$name] = $formatted->getTimestamp();
|
||||
|
@ -422,7 +422,7 @@
|
||||
unset($targets[$key]);
|
||||
continue;
|
||||
}
|
||||
$files[$mod_time] = $target;
|
||||
$files[$mod_time.$target] = $target;
|
||||
}
|
||||
if($files)
|
||||
{
|
||||
@ -438,13 +438,21 @@
|
||||
|
||||
foreach($targets as $target)
|
||||
{
|
||||
if($resource = @fopen( $target, $data['type'] == 'import' ? 'rb' : 'wb' )) {
|
||||
$result = $po->$type( $resource, $definition );
|
||||
$resource = null;
|
||||
try {
|
||||
if($resource = @fopen( $target, $data['type'] == 'import' ? 'rb' : 'wb' )) {
|
||||
$result = $po->$type( $resource, $definition );
|
||||
|
||||
fclose($resource);
|
||||
} else {
|
||||
fwrite(STDERR,'importexport_schedule: ' . date('c') . ": File $target not readable! \n");
|
||||
$data['errors'][$target][] = lang('%1 is not readable',$target);
|
||||
}
|
||||
}
|
||||
catch (Exception $i_ex)
|
||||
{
|
||||
fclose($resource);
|
||||
} else {
|
||||
fwrite(STDERR,'importexport_schedule: ' . date('c') . ": File $target not readable! \n");
|
||||
$data['errors'][$target][] = lang('%1 is not readable',$target);
|
||||
$data['errors'][$target][] = $i_ex->getMessage();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user