Merge branch 'master' into feature-guidance
This commit is contained in:
commit
9869daffeb
2 changed files with 16 additions and 2 deletions
|
@ -116,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,
|
||||||
|
|
|
@ -75,6 +75,9 @@ class Outbox {
|
||||||
$json->partOf = \get_rest_url( null, "/activitypub/1.0/users/$user_id/outbox" ); // phpcs:ignore
|
$json->partOf = \get_rest_url( null, "/activitypub/1.0/users/$user_id/outbox" ); // phpcs:ignore
|
||||||
$json->totalItems = 0; // phpcs:ignore
|
$json->totalItems = 0; // phpcs:ignore
|
||||||
|
|
||||||
|
// phpcs:ignore
|
||||||
|
$json->totalItems = 0;
|
||||||
|
|
||||||
foreach ( $post_types as $post_type ) {
|
foreach ( $post_types as $post_type ) {
|
||||||
$count_posts = \wp_count_posts( $post_type );
|
$count_posts = \wp_count_posts( $post_type );
|
||||||
$json->totalItems += \intval( $count_posts->publish ); // phpcs:ignore
|
$json->totalItems += \intval( $count_posts->publish ); // phpcs:ignore
|
||||||
|
|
Loading…
Reference in a new issue