PluginProbe
ActivityPub / 7.9.1
ActivityPub v7.9.1
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-move-command.php

class-move-command.php in ActivityPub 7.9.1, at includes/cli/class-move-command.php

55 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Move CLI Command.
4 *
5 * @package Activitypub
6 */
7
8 namespace Activitypub\Cli;
9
10 use Activitypub\Move;
11
12 /**
13 * Move an ActivityPub account to a new URL.
14 *
15 * @package Activitypub
16 */
17 class Move_Command extends \WP_CLI_Command {
18
19 /**
20 * Move the blog to a new URL.
21 *
22 * Sends a Move activity to notify followers that your blog has moved
23 * to a new location. Followers on compatible instances will automatically
24 * update their subscription.
25 *
26 * ## OPTIONS
27 *
28 * <from>
29 * : The current URL of the blog.
30 *
31 * <to>
32 * : The new URL of the blog.
33 *
34 * ## EXAMPLES
35 *
36 * # Move blog from old URL to new URL
37 * $ wp activitypub move https://example.com/ https://newsite.com/
38 *
39 * @param array $args The positional arguments.
40 * @param array $assoc_args The associative arguments (unused).
41 */
42 public function __invoke( $args, $assoc_args ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
43 $from = $args[0];
44 $to = $args[1];
45
46 $outbox_item_id = Move::account( $from, $to );
47
48 if ( \is_wp_error( $outbox_item_id ) ) {
49 \WP_CLI::error( $outbox_item_id->get_error_message() );
50 } else {
51 \WP_CLI::success( 'Move Scheduled.' );
52 }
53 }
54 }
55