diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-05-23 10:38:02 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-05-23 10:38:02 +0000 |
commit | f5c0093da9c466df97e0049b4dc4251e12f04faf (patch) | |
tree | c7ae28f30c3d112192b973ffc9c480d7bd0a8568 /engine/lib/system_log.php | |
parent | d28d94b3a8e19ba3cbf79db042d6f786f50e27b2 (diff) | |
download | elgg-f5c0093da9c466df97e0049b4dc4251e12f04faf.tar.gz elgg-f5c0093da9c466df97e0049b4dc4251e12f04faf.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* System log event code
git-svn-id: https://code.elgg.org/elgg/trunk@691 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/system_log.php')
-rw-r--r-- | engine/lib/system_log.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index 80fc1b27f..827c79927 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -19,13 +19,17 @@ interface Loggable { /** - * Return an identification for the object for storage in the system log. This id must be an integer. + * Return an identification for the object for storage in the system log. + * This id must be an integer. * * @return int */ public function getSystemLogID(); - - // get object from ID .. ? + + /** + * Return the class name of the object. Added as a function because get_class causes errors for some reason. + */ + public function getClassName(); } /** @@ -42,9 +46,9 @@ { // Has loggable interface, extract the necessary information and store $object_id = (int)$object->getSystemLogID(); - $object_class = santisise_string(get_class($object)); + $object_class = $object->getClassName(); $event = sanitise_string($event); - $time_created = time(); + $time = time(); // Create log return insert_data("INSERT into {$CONFIG->dbprefix}system_log (object_id, object_class, event, time_created) VALUES ('$object_id','$object_class','$event','$time')"); @@ -61,14 +65,12 @@ */ function system_log_listener($event, $object_type, $object) { - if ($object instanceof Loggable) - { - system_log($object, $event); - } + system_log($object, $event); return true; } - + /** Register event to listen to all events **/ register_event_handler('all','all','system_log_listener'); + ?>
\ No newline at end of file |