Merge pull request #236 from annando/1502-bugfix-statistics

Bugfix: The item counter doubled the value if the global community was active
This commit is contained in:
Tobias Diekershoff 2015-02-01 10:45:56 +01:00
commit 8c96978e2c

View file

@ -3,7 +3,7 @@
/** /**
* Name: Statistics * Name: Statistics
* Description: Generates some statistics for http://the-federation.info/ * Description: Generates some statistics for http://the-federation.info/
* Version: 0.1 * Version: 0.2
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*/ */
@ -29,7 +29,7 @@ function statistics_json_init() {
$statistics = array( $statistics = array(
"name" => $a->config["sitename"], "name" => $a->config["sitename"],
"network" => FRIENDICA_PLATFORM, "network" => FRIENDICA_PLATFORM,
"version" => FRIENDICA_VERSION, "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION,
"registrations_open" => ($a->config['register_policy'] != 0), "registrations_open" => ($a->config['register_policy'] != 0),
"total_users" => get_config('statistics_json','total_users'), "total_users" => get_config('statistics_json','total_users'),
"active_users_halfyear" => get_config('statistics_json','active_users_halfyear'), "active_users_halfyear" => get_config('statistics_json','active_users_halfyear'),
@ -125,7 +125,7 @@ function statistics_json_cron($a,$b) {
set_config('statistics_json','active_users_monthly', $active_users_monthly); set_config('statistics_json','active_users_monthly', $active_users_monthly);
} }
$posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE `wall` AND left(body, 6) != '[share'"); $posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE `wall` AND `uid` != 0 AND `id` = `parent` AND left(body, 6) != '[share'");
if (!is_array($posts)) if (!is_array($posts))
$local_posts = -1; $local_posts = -1;