mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-26 07:49:28 +01:00
Record how many of which action were done
This commit is contained in:
parent
5179365a8c
commit
425e29642c
@ -86,6 +86,11 @@ class import_events_csv implements iface_import_plugin {
|
|||||||
*/
|
*/
|
||||||
protected $errors = array();
|
protected $errors = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of actions, and how many times that action was taken
|
||||||
|
*/
|
||||||
|
protected $results = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* imports entries according to given definition object.
|
* imports entries according to given definition object.
|
||||||
* @param resource $_stream
|
* @param resource $_stream
|
||||||
@ -138,6 +143,7 @@ class import_events_csv implements iface_import_plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->errors = array();
|
$this->errors = array();
|
||||||
|
$this->results = array();
|
||||||
|
|
||||||
while ( $record = $import_csv->get_record() ) {
|
while ( $record = $import_csv->get_record() ) {
|
||||||
|
|
||||||
@ -230,11 +236,14 @@ class import_events_csv implements iface_import_plugin {
|
|||||||
// are we serious?
|
// are we serious?
|
||||||
if ( $this->dry_run ) {
|
if ( $this->dry_run ) {
|
||||||
print_r($_data);
|
print_r($_data);
|
||||||
|
$this->results[$_action]++;
|
||||||
} else {
|
} else {
|
||||||
$messages = array();
|
$messages = array();
|
||||||
$result = $this->bocalupdate->update( $_data, true, !$_data['modified'], $this->is_admin, true, $messages);
|
$result = $this->bocalupdate->update( $_data, true, !$_data['modified'], $this->is_admin, true, $messages);
|
||||||
if(!$result) {
|
if(!$result) {
|
||||||
$this->errors = implode(',', $messages);
|
$this->errors = implode(',', $messages);
|
||||||
|
} else {
|
||||||
|
$this->results[$_action]++;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -307,5 +316,16 @@ class import_events_csv implements iface_import_plugin {
|
|||||||
return $this->errors;
|
return $this->errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of actions taken, and the number of records for that action.
|
||||||
|
* Actions are things like 'insert', 'update', 'delete', and may be different for each plugin.
|
||||||
|
*
|
||||||
|
* @return Array (
|
||||||
|
* action => record count
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function get_results() {
|
||||||
|
return $this->results;
|
||||||
|
}
|
||||||
} // end of iface_export_plugin
|
} // end of iface_export_plugin
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user