Skip to content

Commit 6814118

Browse files
pfefferleobenland
andauthored
Site Health: Fix issue 1545 and add some additional informations (#1547)
* Fix 1545 * Add changelog * phpcs fixes * fix phpcs * backslashit --------- Co-authored-by: Konstantin Obenland <[email protected]>
1 parent 3166870 commit 6814118

File tree

3 files changed

+57
-20
lines changed

3 files changed

+57
-20
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: fixed
3+
4+
Fixed some some bugs and added additional informations on the Debug tab of the Site-Health page.

includes/class-sanitize.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ public static function constant_value( $value ) {
112112
return esc_attr( $value );
113113
}
114114

115+
if ( is_array( $value ) ) {
116+
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
117+
return print_r( $value, true );
118+
}
119+
115120
return $value;
116121
}
117122
}

includes/wp-admin/class-health-check.php

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -263,27 +263,55 @@ public static function is_webfinger_endpoint_accessible() {
263263
* @return array The filtered information
264264
*/
265265
public static function debug_information( $info ) {
266+
$info['activitypub'] = array(
267+
'label' => \__( 'ActivityPub', 'activitypub' ),
268+
'fields' => array(),
269+
);
270+
266271
$actor = Actors::get_by_id( \get_current_user_id() );
267272

268-
$info['activitypub'] = array(
269-
'label' => __( 'ActivityPub', 'activitypub' ),
270-
'fields' => array(
271-
'webfinger' => array(
272-
'label' => __( 'WebFinger Resource', 'activitypub' ),
273-
'value' => Webfinger::get_user_resource( wp_get_current_user()->ID ),
274-
'private' => false,
275-
),
276-
'author_url' => array(
277-
'label' => __( 'Author URL', 'activitypub' ),
278-
'value' => $actor->get_url(),
279-
'private' => false,
280-
),
281-
'author_id' => array(
282-
'label' => __( 'Author ID', 'activitypub' ),
283-
'value' => $actor->get_id(),
284-
'private' => false,
285-
),
286-
),
273+
if ( $actor && ! is_wp_error( $actor ) ) {
274+
$info['activitypub']['fields']['webfinger'] = array(
275+
'label' => \__( 'WebFinger Resource', 'activitypub' ),
276+
'value' => Webfinger::get_user_resource( wp_get_current_user()->ID ),
277+
'private' => false,
278+
);
279+
280+
$info['activitypub']['fields']['author_url'] = array(
281+
'label' => \__( 'Author URL', 'activitypub' ),
282+
'value' => $actor->get_url(),
283+
'private' => false,
284+
);
285+
286+
$info['activitypub']['fields']['author_id'] = array(
287+
'label' => \__( 'Author ID', 'activitypub' ),
288+
'value' => $actor->get_id(),
289+
'private' => false,
290+
);
291+
}
292+
293+
$info['activitypub']['fields']['actor_mode'] = array(
294+
'label' => \__( 'Actor Mode', 'activitypub' ),
295+
'value' => \esc_attr( \get_option( 'activitypub_actor_mode' ) ),
296+
'private' => false,
297+
);
298+
299+
$info['activitypub']['fields']['object_type'] = array(
300+
'label' => \__( 'Object Type', 'activitypub' ),
301+
'value' => \esc_attr( \get_option( 'activitypub_object_type' ) ),
302+
'private' => false,
303+
);
304+
305+
$info['activitypub']['fields']['post_template'] = array(
306+
'label' => \__( 'Post Template', 'activitypub' ),
307+
'value' => \esc_attr( \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ) ),
308+
'private' => false,
309+
);
310+
311+
$info['activitypub']['fields']['authorized_fetch'] = array(
312+
'label' => \__( 'Authorized Fetch', 'activitypub' ),
313+
'value' => \esc_attr( (int) \get_option( 'activitypub_authorized_fetch', '0' ) ),
314+
'private' => false,
287315
);
288316

289317
$consts = get_defined_constants( true );
@@ -298,7 +326,7 @@ public static function debug_information( $info ) {
298326
}
299327

300328
$info['activitypub']['fields'][ $key ] = array(
301-
'label' => esc_attr( $key ),
329+
'label' => \esc_attr( $key ),
302330
'value' => Sanitize::constant_value( $value ),
303331
'private' => false,
304332
);

0 commit comments

Comments
 (0)