aboutsummaryrefslogtreecommitdiffstats
path: root/include/statistics_fns.php
diff options
context:
space:
mode:
authorPaolo T <tuscanhobbit@users.noreply.github.com>2014-11-24 14:19:22 +0100
committerPaolo T <tuscanhobbit@users.noreply.github.com>2014-11-24 14:19:22 +0100
commitbef8879cb1356b880279c6104fcffb0752414a7c (patch)
treece3733df7ca168f4afe7e963dc81b6f00944c34c /include/statistics_fns.php
parent1cb45c30e9032794b7827738cc28f7728ac28677 (diff)
parent5b7124f0daeca4aa619f6411ee373d9ff5a22b7b (diff)
downloadvolse-hubzilla-bef8879cb1356b880279c6104fcffb0752414a7c.tar.gz
volse-hubzilla-bef8879cb1356b880279c6104fcffb0752414a7c.tar.bz2
volse-hubzilla-bef8879cb1356b880279c6104fcffb0752414a7c.zip
Merge pull request #7 from friendica/master
Merge from main project
Diffstat (limited to 'include/statistics_fns.php')
-rw-r--r--include/statistics_fns.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/include/statistics_fns.php b/include/statistics_fns.php
index 4f72e6615..288925a2c 100644
--- a/include/statistics_fns.php
+++ b/include/statistics_fns.php
@@ -13,7 +13,9 @@ function update_channels_total_stat() {
function update_channels_active_halfyear_stat() {
$r = q("select channel_id from channel left join account on account_id = channel_account_id
- where account_flags = 0 and account_lastlog > UTC_TIMESTAMP - INTERVAL 6 MONTH");
+ where account_flags = 0 and account_lastlog > %s - INTERVAL %s",
+ db_utcnow(), db_quoteinterval('6 MONTH')
+ );
if($r) {
$s = '';
foreach($r as $rr) {
@@ -21,8 +23,9 @@ function update_channels_active_halfyear_stat() {
$s .= ',';
$s .= intval($rr['channel_id']);
}
- $x = q("select uid from item where uid in ( $s ) and (item_flags & %d) and created > UTC_TIMESTAMP - INTERVAL 6 MONTH group by uid",
- intval(ITEM_WALL)
+ $x = q("select uid from item where uid in ( $s ) and (item_flags & %d)>0 and created > %s - INTERVAL %s group by uid",
+ intval(ITEM_WALL),
+ db_utcnow(), db_quoteinterval('6 MONTH')
);
if($x) {
$channels_active_halfyear_stat = count($x);
@@ -37,7 +40,9 @@ function update_channels_active_halfyear_stat() {
function update_channels_active_monthly_stat() {
$r = q("select channel_id from channel left join account on account_id = channel_account_id
- where account_flags = 0 and account_lastlog > UTC_TIMESTAMP - INTERVAL 1 MONTH");
+ where account_flags = 0 and account_lastlog > %s - INTERVAL %s",
+ db_utcnow(), db_quoteinterval('1 MONTH')
+ );
if($r) {
$s = '';
foreach($r as $rr) {
@@ -45,8 +50,9 @@ function update_channels_active_monthly_stat() {
$s .= ',';
$s .= intval($rr['channel_id']);
}
- $x = q("select uid from item where uid in ( $s ) and ( item_flags & %d ) and created > UTC_TIMESTAMP - INTERVAL 1 MONTH group by uid",
- intval(ITEM_WALL)
+ $x = q("select uid from item where uid in ( $s ) and ( item_flags & %d )>0 and created > %s - INTERVAL %s group by uid",
+ intval(ITEM_WALL),
+ db_utcnow(), db_quoteinterval('1 MONTH')
);
if($x) {
$channels_active_monthly_stat = count($x);
@@ -60,7 +66,7 @@ function update_channels_active_monthly_stat() {
}
function update_local_posts_stat() {
- $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE (item_flags & %d) ",
+ $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE (item_flags & %d)>0 ",
intval(ITEM_WALL) );
if (is_array($posts)) {
$local_posts_stat = intval($posts[0]["local_posts"]);