| 1 |
<?php |
| 2 |
/** |
| 3 |
* WP-CLI commands registration. |
| 4 |
* |
| 5 |
* @package Activitypub |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Activitypub; |
| 9 |
|
| 10 |
/** |
| 11 |
* ActivityPub CLI command registry. |
| 12 |
* |
| 13 |
* Registers all ActivityPub CLI subcommands with WP-CLI. |
| 14 |
* |
| 15 |
* @package Activitypub |
| 16 |
*/ |
| 17 |
class Cli { |
| 18 |
|
| 19 |
/** |
| 20 |
* Register all ActivityPub CLI commands. |
| 21 |
* |
| 22 |
* This method registers the main 'activitypub' command namespace and all its |
| 23 |
* subcommands for managing ActivityPub functionality via WP-CLI. |
| 24 |
* |
| 25 |
* Available commands: |
| 26 |
* - wp activitypub post <delete|update> <id> |
| 27 |
* - wp activitypub comment <delete|update> <id> |
| 28 |
* - wp activitypub actor <delete|update> <id> |
| 29 |
* - wp activitypub outbox <undo|reschedule> <id> |
| 30 |
* - wp activitypub self-destruct [--status] [--yes] |
| 31 |
* - wp activitypub move <from> <to> |
| 32 |
* - wp activitypub follow <remote_user> |
| 33 |
*/ |
| 34 |
public static function register() { |
| 35 |
// Register parent command with version subcommand. |
| 36 |
\WP_CLI::add_command( |
| 37 |
'activitypub', |
| 38 |
'\Activitypub\Cli\Command', |
| 39 |
array( |
| 40 |
'shortdesc' => 'Manage ActivityPub plugin functionality and federation.', |
| 41 |
) |
| 42 |
); |
| 43 |
|
| 44 |
\WP_CLI::add_command( |
| 45 |
'activitypub post', |
| 46 |
'\Activitypub\Cli\Post_Command', |
| 47 |
array( |
| 48 |
'shortdesc' => 'Manage ActivityPub posts (delete or update).', |
| 49 |
) |
| 50 |
); |
| 51 |
|
| 52 |
\WP_CLI::add_command( |
| 53 |
'activitypub comment', |
| 54 |
'\Activitypub\Cli\Comment_Command', |
| 55 |
array( |
| 56 |
'shortdesc' => 'Manage ActivityPub comments (delete or update).', |
| 57 |
) |
| 58 |
); |
| 59 |
|
| 60 |
\WP_CLI::add_command( |
| 61 |
'activitypub actor', |
| 62 |
'\Activitypub\Cli\Actor_Command', |
| 63 |
array( |
| 64 |
'shortdesc' => 'Manage ActivityPub actors (delete or update).', |
| 65 |
) |
| 66 |
); |
| 67 |
|
| 68 |
\WP_CLI::add_command( |
| 69 |
'activitypub outbox', |
| 70 |
'\Activitypub\Cli\Outbox_Command', |
| 71 |
array( |
| 72 |
'shortdesc' => 'Manage ActivityPub outbox items (undo or reschedule).', |
| 73 |
) |
| 74 |
); |
| 75 |
|
| 76 |
\WP_CLI::add_command( |
| 77 |
'activitypub self-destruct', |
| 78 |
'\Activitypub\Cli\Self_Destruct_Command', |
| 79 |
array( |
| 80 |
'shortdesc' => 'Remove the entire blog from the Fediverse.', |
| 81 |
) |
| 82 |
); |
| 83 |
|
| 84 |
\WP_CLI::add_command( |
| 85 |
'activitypub move', |
| 86 |
'\Activitypub\Cli\Move_Command', |
| 87 |
array( |
| 88 |
'shortdesc' => 'Move the blog to a new URL.', |
| 89 |
) |
| 90 |
); |
| 91 |
|
| 92 |
\WP_CLI::add_command( |
| 93 |
'activitypub follow', |
| 94 |
'\Activitypub\Cli\Follow_Command', |
| 95 |
array( |
| 96 |
'shortdesc' => 'Follow a remote ActivityPub user.', |
| 97 |
) |
| 98 |
); |
| 99 |
} |
| 100 |
} |
| 101 |
|