Skip to content

Commit

Permalink
hello APPLICATION_ACTOR_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwiebe committed Nov 22, 2024
1 parent c093566 commit 71c74e7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion includes/class-health-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public static function is_author_url_accessible() {
* @return boolean|WP_Error
*/
public static function is_webfinger_endpoint_accessible() {
$user = Actors::get_by_id( Actors::APPLICATION_USER_ID );
$user = Actors::get_by_id( Actors::APPLICATION_ACTOR_ID );
$resource = $user->get_webfinger();

$url = Webfinger::resolve( $resource );
Expand Down
2 changes: 1 addition & 1 deletion includes/class-http.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static function get( $url, $cached = false ) {
}

$date = \gmdate( 'D, d M Y H:i:s T' );
$signature = Signature::generate_signature( Actors::APPLICATION_USER_ID, 'get', $url, $date );
$signature = Signature::generate_signature( Actors::APPLICATION_ACTOR_ID, 'get', $url, $date );

$wp_version = get_masked_wp_version();

Expand Down
10 changes: 9 additions & 1 deletion includes/collection/class-actors.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ class Actors {
/**
* The ID of the Application Actor.
*
* @deprecated version 4.3.0
* @var int
*/
const APPLICATION_USER_ID = -1;

/**
* The ID of the Application Actor.
*
* @var int
*/
const APPLICATION_ACTOR_ID = -1;

/**
* Get the Actor by ID.
*
Expand All @@ -68,7 +76,7 @@ public static function get_by_id( $user_id ) {
switch ( $user_id ) {
case self::BLOG_ACTOR_ID:
return new Blog();
case self::APPLICATION_USER_ID:
case self::APPLICATION_ACTOR_ID:
return new Application();
default:
return User::from_wp_user( $user_id );
Expand Down
2 changes: 1 addition & 1 deletion includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ function is_user_disabled( $user_id ) {

switch ( $user_id ) {
// if the user is the application user, it's always enabled.
case \Activitypub\Collection\Actors::APPLICATION_USER_ID:
case \Activitypub\Collection\Actors::APPLICATION_ACTOR_ID:
$disabled = false;
break;
// if the user is the blog user, it's only enabled in single-user mode.
Expand Down
4 changes: 2 additions & 2 deletions includes/model/class-application.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Application extends Actor {
*
* @var int
*/
protected $_id = Actors::APPLICATION_USER_ID; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
protected $_id = Actors::APPLICATION_ACTOR_ID; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore

/**
* Whether the Application is discoverable.
Expand Down Expand Up @@ -224,7 +224,7 @@ public function get_public_key() {
return array(
'id' => $this->get_id() . '#main-key',
'owner' => $this->get_id(),
'publicKeyPem' => Signature::get_public_key_for( Actors::APPLICATION_USER_ID ),
'publicKeyPem' => Signature::get_public_key_for( Actors::APPLICATION_ACTOR_ID ),
);
}

Expand Down

0 comments on commit 71c74e7

Please sign in to comment.