diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-19 18:51:00 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-19 18:51:00 +0000 |
commit | 915bdaf8fb2c69395fd0371e5a3d6cb47c367cb4 (patch) | |
tree | c6abb6f67fbbf708fb41c2576f50b08dc97262ae | |
parent | 4a4c45645fcbfa2c0281aebe1936429a7b2c5bfe (diff) | |
download | elgg-915bdaf8fb2c69395fd0371e5a3d6cb47c367cb4.tar.gz elgg-915bdaf8fb2c69395fd0371e5a3d6cb47c367cb4.tar.bz2 |
System_log no longer adds double entries.
git-svn-id: https://code.elgg.org/elgg/trunk@1007 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/system_log.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index d35453c68..52ec6bee0 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -99,10 +99,14 @@ */ function system_log($object, $event) { - global $CONFIG; + global $CONFIG;
+ static $logcache; if ($object instanceof Loggable) - { + {
+
+ if (!is_array($logcache)) $logcache = array();
+ // Has loggable interface, extract the necessary information and store $object_id = (int)$object->getSystemLogID(); $object_class = $object->getClassName(); @@ -110,8 +114,17 @@ $time = time(); $performed_by = (int)$_SESSION['guid']; - // Create log - return insert_data("INSERT into {$CONFIG->dbprefix}system_log (object_id, object_class, event, performed_by_guid, time_created) VALUES ('$object_id','$object_class','$event',$performed_by, '$time')"); + // Create log if we haven't already created it
+ if (!isset($logcache[$time][$object_id][$event])) { + if (insert_data("INSERT into {$CONFIG->dbprefix}system_log (object_id, object_class, event, performed_by_guid, time_created) VALUES ('$object_id','$object_class','$event',$performed_by, '$time')")) {
+ $logcache[$time][$object_id][$event] = true;
+ return true;
+ }
+ return false;
+ }
+
+ return true;
+ } } |