parent
229e1cd6ed
commit
d5dac9699a
1 changed files with 13 additions and 10 deletions
|
@ -95,10 +95,6 @@ class Nodeinfo {
|
||||||
'outbound' => array(),
|
'outbound' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$nodeinfo['metadata'] = array(
|
|
||||||
'email' => \get_option( 'admin_email' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
return new \WP_REST_Response( $nodeinfo, 200 );
|
return new \WP_REST_Response( $nodeinfo, 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,13 +116,24 @@ class Nodeinfo {
|
||||||
'version' => \get_bloginfo( 'version' ),
|
'version' => \get_bloginfo( 'version' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$users = \count_users();
|
$users = \get_users(
|
||||||
|
array(
|
||||||
|
'capability__in' => array( 'publish_posts' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( is_array( $users ) ) {
|
||||||
|
$users = count( $users );
|
||||||
|
} else {
|
||||||
|
$users = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$posts = \wp_count_posts();
|
$posts = \wp_count_posts();
|
||||||
$comments = \wp_count_comments();
|
$comments = \wp_count_comments();
|
||||||
|
|
||||||
$nodeinfo['usage'] = array(
|
$nodeinfo['usage'] = array(
|
||||||
'users' => array(
|
'users' => array(
|
||||||
'total' => (int) $users['total_users'],
|
'total' => (int) $users,
|
||||||
),
|
),
|
||||||
'localPosts' => (int) $posts->publish,
|
'localPosts' => (int) $posts->publish,
|
||||||
'localComments' => (int) $comments->approved,
|
'localComments' => (int) $comments->approved,
|
||||||
|
@ -140,10 +147,6 @@ class Nodeinfo {
|
||||||
'outbound' => array(),
|
'outbound' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$nodeinfo['metadata'] = array(
|
|
||||||
'email' => \get_option( 'admin_email' ),
|
|
||||||
);
|
|
||||||
|
|
||||||
return new \WP_REST_Response( $nodeinfo, 200 );
|
return new \WP_REST_Response( $nodeinfo, 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue