aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-29 16:39:30 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-29 16:39:30 +0000
commitf4df8ab602cd8d9d2ead55999f312b2da6eea1e0 (patch)
treea806a06c21a0dd33f1d770ba8f2e356774bbd555
parent53cfda0da7bb372d5920c8e84eab3998b88558f4 (diff)
downloadelgg-f4df8ab602cd8d9d2ead55999f312b2da6eea1e0.tar.gz
elgg-f4df8ab602cd8d9d2ead55999f312b2da6eea1e0.tar.bz2
Fixed count
git-svn-id: https://code.elgg.org/elgg/trunk@1578 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/system_log.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php
index 83a7406aa..458c9da93 100644
--- a/engine/lib/system_log.php
+++ b/engine/lib/system_log.php
@@ -90,15 +90,26 @@
$where[] = "object_class='$class'";
$select = "*";
- if ($count) $select = "count(*)";
+ if ($count) $select = "count(*) as count";
$query = "SELECT $select from {$CONFIG->dbprefix}system_log where 1 ";
foreach ($where as $w)
$query .= " and $w";
- $query .= " order by time_created desc";
- if (!$count) $query .= " limit $offset, $limit"; // Add order and limit
-
- return get_data($query);
+ if (!$count)
+ {
+ $query .= " order by time_created desc";
+ $query .= " limit $offset, $limit"; // Add order and limit
+ }
+
+ if ($count)
+ {
+ if ($numrows = get_data_row($query))
+ return $numrows->count;
+ }
+ else
+ return get_data($query);
+
+ return false;
}
/**