From b16ca2b026b14cdea8dad79853bf0ab2ee6aaeff Mon Sep 17 00:00:00 2001 From: Steffen K9 Date: Mon, 3 Feb 2020 21:49:53 +0100 Subject: [PATCH 1/3] Changed statistics query for nodeinfo Removed the published to directories condition. Added check for 'user has logged in at least once'. Excluded community accounts (forums) from the user count. --- src/Model/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/User.php b/src/Model/User.php index fd7238819..f7562e148 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -1113,7 +1113,7 @@ class User FROM `user` INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid` INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self` - WHERE (`profile`.`publish` OR `profile`.`net-publish`) AND `user`.`verified` + WHERE `user`.`verified` AND `user`.`login_date` > '0001-01-01' AND NOT `user`.`account-type` = 3 AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND NOT `user`.`account_expired`"); From 9424ecc5bc8c0db5c6197e34ae52a6c5aeae31ba Mon Sep 17 00:00:00 2001 From: Steffen K9 Date: Mon, 3 Feb 2020 23:30:31 +0100 Subject: [PATCH 2/3] Use PHP constants for literals --- src/Model/User.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Model/User.php b/src/Model/User.php index f7562e148..0681e13d7 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -1113,9 +1113,15 @@ class User FROM `user` INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid` INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self` - WHERE `user`.`verified` AND `user`.`login_date` > '0001-01-01' AND NOT `user`.`account-type` = 3 - AND NOT `user`.`blocked` AND NOT `user`.`account_removed` - AND NOT `user`.`account_expired`"); + WHERE `user`.`verified` + AND `user`.`login_date` > ? + AND `user`.`account-type` != ? + AND NOT `user`.`blocked` + AND NOT `user`.`account_removed` + AND NOT `user`.`account_expired`", + DBA::NULL_DATETIME, + self::ACCOUNT_TYPE_COMMUNITY + ); if (!DBA::isResult($userStmt)) { return $statistics; From 52789f3ae4a07b79fabc99ab01386617fa75183f Mon Sep 17 00:00:00 2001 From: Steffen K9 Date: Tue, 4 Feb 2020 07:13:29 +0100 Subject: [PATCH 3/3] Remove join profile table Remove join profile table and remove exclude forums --- src/Model/User.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Model/User.php b/src/Model/User.php index 0681e13d7..24daf9a01 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -1111,16 +1111,13 @@ class User $userStmt = DBA::p("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item` FROM `user` - INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid` INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self` WHERE `user`.`verified` AND `user`.`login_date` > ? - AND `user`.`account-type` != ? AND NOT `user`.`blocked` AND NOT `user`.`account_removed` AND NOT `user`.`account_expired`", - DBA::NULL_DATETIME, - self::ACCOUNT_TYPE_COMMUNITY + DBA::NULL_DATETIME ); if (!DBA::isResult($userStmt)) {