X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FNodeinfo.php;h=d39641553114acc8fa527b36f40457a5b6504e80;hb=7b7132971a64a92a685a5fd860fe4709dce1765a;hp=6d9c77154a17b720c570f3ab04663c05e39b7b94;hpb=03038e7a3bb74bdab497d26b7f829a5c3036d1c2;p=friendica.git diff --git a/src/Model/Nodeinfo.php b/src/Model/Nodeinfo.php index 6d9c77154a..d396415531 100644 --- a/src/Model/Nodeinfo.php +++ b/src/Model/Nodeinfo.php @@ -1,4 +1,23 @@ . + * + */ namespace Friendica\Model; @@ -52,12 +71,15 @@ class Nodeinfo $logger->debug('user statistics', $userStats); - $local_posts = DBA::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]); - $config->set('nodeinfo', 'local_posts', $local_posts); - $logger->debug('thread statistics', ['local_posts' => $local_posts]); - - $local_comments = DBA::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]); - $config->set('nodeinfo', 'local_comments', $local_comments); - $logger->debug('item statistics', ['local_comments' => $local_comments]); + $items = DBA::p("SELECT COUNT(*) AS `total`, `gravity` FROM `item` WHERE `origin` AND NOT `deleted` AND `uid` != 0 AND `gravity` IN (?, ?) GROUP BY `gravity`", + GRAVITY_PARENT, GRAVITY_COMMENT); + while ($item = DBA::fetch($items)) { + if ($item['gravity'] == GRAVITY_PARENT) { + $config->set('nodeinfo', 'local_posts', $item['total']); + } elseif ($item['gravity'] == GRAVITY_COMMENT) { + $config->set('nodeinfo', 'local_comments', $item['total']); + } + } + DBA::close($items); } }