updated plugin ActivityPub
version 5.8.0
This commit is contained in:
@ -7,9 +7,6 @@
|
||||
|
||||
namespace Activitypub;
|
||||
|
||||
use WP_DEBUG;
|
||||
use WP_DEBUG_LOG;
|
||||
|
||||
/**
|
||||
* ActivityPub Debug Class.
|
||||
*
|
||||
@ -20,9 +17,11 @@ class Debug {
|
||||
* Initialize the class, registering WordPress hooks.
|
||||
*/
|
||||
public static function init() {
|
||||
if ( WP_DEBUG_LOG ) {
|
||||
if ( \WP_DEBUG && \WP_DEBUG_LOG ) {
|
||||
\add_action( 'activitypub_safe_remote_post_response', array( self::class, 'log_remote_post_responses' ), 10, 2 );
|
||||
\add_action( 'activitypub_inbox', array( self::class, 'log_inbox' ), 10, 3 );
|
||||
|
||||
\add_action( 'activitypub_sent_to_inbox', array( self::class, 'log_sent_to_inbox' ), 10, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,12 +47,26 @@ class Debug {
|
||||
$type = strtolower( $type );
|
||||
|
||||
if ( 'delete' !== $type ) {
|
||||
$url = object_to_uri( $data['actor'] );
|
||||
$actor = $data['actor'] ?? '';
|
||||
$url = object_to_uri( $actor );
|
||||
// phpcs:ignore WordPress.PHP.DevelopmentFunctions
|
||||
\error_log( "[INBOX] Request From: {$url} with Activity: " . \print_r( $data, true ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the sent to follower action.
|
||||
*
|
||||
* @param array $result The result of the remote post request.
|
||||
* @param string $inbox The inbox URL.
|
||||
*/
|
||||
public static function log_sent_to_inbox( $result, $inbox ) {
|
||||
if ( \is_wp_error( $result ) ) {
|
||||
// phpcs:ignore WordPress.PHP.DevelopmentFunctions
|
||||
\error_log( "[DISPATCHER] Failed Request to: {$inbox} with Result: " . \print_r( $result, true ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a log entry.
|
||||
*
|
||||
|
Reference in New Issue
Block a user