PluginProbe
ActivityPub / 9.0.2
ActivityPub v9.0.2
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
activitypub / includes / cli / class-actor-command.php

class-actor-command.php in ActivityPub 9.0.2, at includes/cli/class-actor-command.php

78 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Actor CLI Command.
4 *
5 * @package Activitypub
6 */
7
8 namespace Activitypub\Cli;
9
10 use Activitypub\Collection\Actors;
11 use Activitypub\Scheduler\Actor;
12
13 /**
14 * Manage ActivityPub actors.
15 *
16 * @package Activitypub
17 */
18 class Actor_Command extends \WP_CLI_Command {
19
20 /**
21 * Delete an Actor from the Fediverse.
22 *
23 * Sends a Delete activity to all followers to remove the actor from
24 * federated instances.
25 *
26 * ## OPTIONS
27 *
28 * <id>
29 * : The ID of the Actor (user ID).
30 *
31 * ## EXAMPLES
32 *
33 * # Delete actor with user ID 1
34 * $ wp activitypub actor delete 1
35 *
36 * @subcommand delete
37 *
38 * @param array $args The positional arguments.
39 * @param array $assoc_args The associative arguments (unused).
40 */
41 public function delete( $args, $assoc_args ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
42 if ( Actors::APPLICATION_USER_ID === (int) $args[0] ) {
43 \WP_CLI::error( 'You cannot delete the application actor.' );
44 }
45
46 \add_filter( 'activitypub_user_can_activitypub', '__return_true' );
47 Actor::schedule_user_delete( $args[0] );
48 \remove_filter( 'activitypub_user_can_activitypub', '__return_true' );
49 \WP_CLI::success( '"Delete" activity is queued.' );
50 }
51
52 /**
53 * Update an Actor on the Fediverse.
54 *
55 * Sends an Update activity to all followers to refresh the actor profile
56 * on federated instances.
57 *
58 * ## OPTIONS
59 *
60 * <id>
61 * : The ID of the Actor (user ID).
62 *
63 * ## EXAMPLES
64 *
65 * # Update actor with user ID 1
66 * $ wp activitypub actor update 1
67 *
68 * @subcommand update
69 *
70 * @param array $args The positional arguments.
71 * @param array $assoc_args The associative arguments (unused).
72 */
73 public function update( $args, $assoc_args ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
74 Actor::schedule_profile_update( $args[0] );
75 \WP_CLI::success( '"Update" activity is queued.' );
76 }
77 }
78