Merge pull request #8082 from annando/issue-8081

Issue 8081: The usage has to be an object, not an array
This commit is contained in:
Hypolite Petovan 2020-01-09 05:07:12 -05:00 committed by GitHub
commit 878bebc429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -5,6 +5,7 @@ namespace Friendica\Module;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\DI; use Friendica\DI;
use stdClass;
/** /**
* Standardized way of exposing metadata about a server running one of the distributed social networks. * Standardized way of exposing metadata about a server running one of the distributed social networks.
@ -26,22 +27,22 @@ class NodeInfo extends BaseModule
/** /**
* Return the supported services * Return the supported services
* *
* @return array with supported services * @return Object with supported services
*/ */
private static function getUsage() private static function getUsage()
{ {
$config = DI::config(); $config = DI::config();
$usage = []; $usage = new stdClass();
if (!empty($config->get('system', 'nodeinfo'))) { if (!empty($config->get('system', 'nodeinfo'))) {
$usage['users'] = [ $usage->users = [
'total' => intval($config->get('nodeinfo', 'total_users')), 'total' => intval($config->get('nodeinfo', 'total_users')),
'activeHalfyear' => intval($config->get('nodeinfo', 'active_users_halfyear')), 'activeHalfyear' => intval($config->get('nodeinfo', 'active_users_halfyear')),
'activeMonth' => intval($config->get('nodeinfo', 'active_users_monthly')) 'activeMonth' => intval($config->get('nodeinfo', 'active_users_monthly'))
]; ];
$usage['localPosts'] = intval($config->get('nodeinfo', 'local_posts')); $usage->localPosts = intval($config->get('nodeinfo', 'local_posts'));
$usage['localComments'] = intval($config->get('nodeinfo', 'local_comments')); $usage->localComments = intval($config->get('nodeinfo', 'local_comments'));
} }
return $usage; return $usage;