You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -56,7 +58,7 @@ public static function register_commands(): void {
56
58
[
57
59
'type' => 'assoc',
58
60
'name' => 'sites',
59
-
'description' => __( "Networked site url(s) comma separated to distribute the post to – or 'all' to distribute to all sites in the network." ),
61
+
'description' => __( "Networked site url(s) comma separated to distribute the post to – or 'all' to distribute to all sites in the network.", 'newspack-network' ),
60
62
'optional' => false,
61
63
],
62
64
[
@@ -68,6 +70,47 @@ public static function register_commands(): void {
68
70
],
69
71
]
70
72
);
73
+
WP_CLI::add_command(
74
+
'newspack network distributor migrate',
75
+
[ __CLASS__, 'cmd_distributor_migrate' ],
76
+
[
77
+
'shortdesc' => __( 'Migrate posts from Distributor to Newspack Network\'s content distribution', 'newspack-network' ),
78
+
'synopsis' => [
79
+
[
80
+
'type' => 'positional',
81
+
'name' => 'post-id',
82
+
'description' => __( 'The ID of the post to migrate.', 'newspack-network' ),
83
+
'repeating' => false,
84
+
'optional' => true,
85
+
],
86
+
[
87
+
'type' => 'flag',
88
+
'name' => 'all',
89
+
'description' => __( 'Migrate all posts.', 'newspack-network' ),
90
+
'optional' => true,
91
+
],
92
+
[
93
+
'type' => 'assoc',
94
+
'name' => 'batch-size',
95
+
'description' => __( 'Number of posts to migrate in each batch.', 'newspack-network' ),
96
+
'optional' => true,
97
+
'default' => 50,
98
+
],
99
+
[
100
+
'type' => 'flag',
101
+
'name' => 'strict',
102
+
'description' => __( 'Whether to only migrate if all distributed posts can be migrated.', 'newspack-network' ),
103
+
'optional' => true,
104
+
],
105
+
[
106
+
'type' => 'flag',
107
+
'name' => 'delete',
108
+
'description' => __( 'Whether to deactivate and delete the Distributor plugin after migrating all posts. This will only take effect if all posts were able to migrate.', 'newspack-network' ),
109
+
'optional' => true,
110
+
],
111
+
],
112
+
]
113
+
);
71
114
}
72
115
73
116
/**
@@ -107,4 +150,91 @@ public function cmd_distribute_post( array $pos_args, array $assoc_args ): void
107
150
WP_CLI::error( $e->getMessage() );
108
151
}
109
152
}
153
+
154
+
/**
155
+
* Callback for the `newspack-network distributor migrate` command.
0 commit comments