diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-29 16:18:50 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-29 16:18:50 +0000 |
commit | 7aee7f5f41387b9d6d3aa9c168e6d50430a67226 (patch) | |
tree | 164438925c553259af7c20ed8b33b83ec350ce9c | |
parent | 808ead24b977e01204a93e4c5b98ce24a832eb69 (diff) | |
download | elgg-7aee7f5f41387b9d6d3aa9c168e6d50430a67226.tar.gz elgg-7aee7f5f41387b9d6d3aa9c168e6d50430a67226.tar.bz2 |
Added some useful helper functions.
git-svn-id: https://code.elgg.org/elgg/trunk@1576 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/system_log.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index 85087219b..ad1616d6a 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -102,6 +102,42 @@ } /** + * Return a specific log entry. + * + * @param int $entry_id The log entry + */ + function get_log_entry($entry_id) + { + global $CONFIG; + + $entry_id = (int)$entry_id; + + return get_data_row("SELECT * from {$CONFIG->dbprefix}system_log where id=$entry_id"); + } + + /** + * Return the object referred to by a given log entry + * + * @param int $entry_id The log entry + */ + function get_object_from_log_entry($entry_id) + { + $entry = get_log_entry($entry_id); + + if ($entry) + { + $class = $entry->object_class; + $tmp = new $class(); + $object = $tmp->getObjectFromID($entry->object_id); + + if ($object) + return $object; + } + + return false; + } + + /** * Log a system event related to a specific object. * * This is called by the event system and should not be called directly. |