3 namespace Friendica\Api\Mastodon;
5 use Friendica\Core\Config;
6 use Friendica\Core\Protocol;
7 use Friendica\Database\DBA;
12 * @see https://docs.joinmastodon.org/api/entities/#stats
24 * Creates a stats record
27 * @throws \Friendica\Network\HTTPException\InternalServerErrorException
29 public static function get() {
31 if (!empty(Config::get('system', 'nodeinfo'))) {
32 $stats->user_count = intval(Config::get('nodeinfo', 'total_users'));
33 $stats->status_count = Config::get('nodeinfo', 'local_posts') + Config::get('nodeinfo', 'local_comments');
34 $stats->domain_count = DBA::count('gserver', ["`network` in (?, ?) AND `last_contact` >= `last_failure`", Protocol::DFRN, Protocol::ACTIVITYPUB]);