diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index 5f9988b3fa2feac11d28a2ea4280c1cb3bd79dde..4911927b8d796714a9cd59a71b98fbfd25c70c24 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -211,7 +211,6 @@ class CopyPasteHandler foreach ($this->clean_objects as $key => $entry) { $this->current = $entry; $errors = $this->current['object']->save(); - logging::log('copy', 'paste', $this->current['object']->dn, [], reset($errors)); if (empty($errors)) { $this->current_saved(); @@ -231,7 +230,6 @@ class CopyPasteHandler /* Save current object if edition is finished */ if (isset($_POST['edit_finish'])) { $errors = $this->current['object']->save(); - logging::log('copy', 'paste', $this->current['object']->dn, [], reset($errors)); if (empty($errors)) { $this->current_saved(); @@ -272,6 +270,7 @@ class CopyPasteHandler private function current_saved () { $this->lastdn = $this->current['object']->dn; + logging::log('copy', 'paste', $this->lastdn); $this->handleReferences(); $this->current = FALSE; } diff --git a/include/class_logging.inc b/include/class_logging.inc index dbc06eede6754d4936f6a8538a49d63857504442..63cce8d05828a55944a406faadd0449742a54ce1 100644 --- a/include/class_logging.inc +++ b/include/class_logging.inc @@ -40,32 +40,27 @@ class logging /*! * \brief logging method * - * \param $action One of these values (modify|create|remove|copy|snapshot|security|error) + * \param string $action One of these values (modify|create|remove|copy|snapshot|security|error) * - * \param $objecttype represents the current edited objecttype, like user/user, or the event, like logout + * \param string $objecttype represents the current edited objecttype, like user/user, or the event, like logout * - * \param $object represents the current edited object dn, or the target of the operation + * \param string $object represents the current edited object dn, or the target of the operation * - * \param $changes_array An array containing names of all touched attributes + * \param array $changes An array containing names of all touched attributes * - * \param $result A status message, containing errors or success messages + * \param string $result A status message, containing errors or success messages */ - static function log ($action, $objecttype, $object, array $changes_array = [], $result = '') + static function log (string $action, string $objecttype, string $object, array $changes = [], string $result = '') { global $config, $ui; - if ($result === NULL) { - trigger_error('"Result" parameter should not be NULL'); - $result = ''; - } - /* Create data object */ $entry = [ 'timestamp' => microtime(TRUE), 'action' => $action, 'objecttype' => $objecttype, 'object' => $object, - 'changes' => $changes_array, + 'changes' => $changes, 'result' => $result ]; if (isset($ui->dn) && !empty($ui->dn)) {