aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-29 16:11:38 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-29 16:11:38 +0000
commit808ead24b977e01204a93e4c5b98ce24a832eb69 (patch)
tree169712919eba43978187d2ee4d4b39a5ffa2f49e /engine
parent32df0fad09f36ea7f7d3ea519bd4fbe35108a7d9 (diff)
downloadelgg-808ead24b977e01204a93e4c5b98ce24a832eb69.tar.gz
elgg-808ead24b977e01204a93e4c5b98ce24a832eb69.tar.bz2
Count support added
git-svn-id: https://code.elgg.org/elgg/trunk@1575 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/system_log.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php
index fbf0b073a..85087219b 100644
--- a/engine/lib/system_log.php
+++ b/engine/lib/system_log.php
@@ -59,8 +59,9 @@
* @param string $class The class of object it effects.
* @param int $limit Maximum number of responses to return.
* @param int $offset Offset of where to start.
+ * @param bool $count Return count or not
*/
- function get_system_log($by_user = "", $event = "", $class = "", $limit = 10, $offset = 0)
+ function get_system_log($by_user = "", $event = "", $class = "", $limit = 10, $offset = 0, $count = false)
{
global $CONFIG;
@@ -88,12 +89,14 @@
if ($class!=="")
$where[] = "object_class='$class'";
- $query = "SELECT * from {$CONFIG->dbprefix}system_log where 1 ";
+ $select = "*";
+ if ($count) $select = "count(*)";
+ $query = "SELECT $select; from {$CONFIG->dbprefix}system_log where 1 ";
foreach ($where as $w)
$query .= " and $w";
$query .= " order by time_created desc";
- $query .= " limit $offset, $limit"; // Add order and limit
+ if (!$count) $query .= " limit $offset, $limit"; // Add order and limit
return get_data($query);
}