+ $config->set('nodeinfo', 'active_users_weekly', $userStats['active_users_weekly']);
+
+ $logger->info('user statistics', $userStats);
+
+ $posts = DBA::count('post-thread', ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE NOT `deleted` AND `origin`)"]);
+ $comments = DBA::count('post', ["NOT `deleted` AND `gravity` = ? AND `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)", Item::GRAVITY_COMMENT]);
+ $config->set('nodeinfo', 'local_posts', $posts);
+ $config->set('nodeinfo', 'local_comments', $comments);
+
+ $logger->info('User actitivy', ['posts' => $posts, 'comments' => $comments]);
+ }
+
+ /**
+ * Return the supported services
+ *
+ * @return Object with supported services
+ */
+ public static function getUsage(bool $version2 = false)
+ {
+ $config = DI::config();
+
+ $usage = new stdClass();
+ $usage->users = new \stdClass;
+
+ if (!empty($config->get('system', 'nodeinfo'))) {
+ $usage->users->total = intval($config->get('nodeinfo', 'total_users'));
+ $usage->users->activeHalfyear = intval($config->get('nodeinfo', 'active_users_halfyear'));
+ $usage->users->activeMonth = intval($config->get('nodeinfo', 'active_users_monthly'));
+ $usage->localPosts = intval($config->get('nodeinfo', 'local_posts'));
+ $usage->localComments = intval($config->get('nodeinfo', 'local_comments'));
+
+ if ($version2) {
+ $usage->users->activeWeek = intval($config->get('nodeinfo', 'active_users_weekly'));
+ }
+ }
+
+ return $usage;
+ }
+
+ /**
+ * Return the supported services
+ *
+ * @return array with supported services
+ */
+ public static function getServices(): array
+ {
+ $services = [
+ 'inbound' => [],
+ 'outbound' => [],
+ ];