forked from Automattic/wordpress-activitypub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass-cli.php
More file actions
136 lines (128 loc) · 2.77 KB
/
class-cli.php
File metadata and controls
136 lines (128 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
namespace Activitypub;
use WP_CLI;
use WP_CLI_Command;
/**
* WP-CLI commands
*
* @package Activitypub
*/
class Cli extends WP_CLI_Command {
/**
* See the Plugin Meta-Informations
*
* ## OPTIONS
*
* [--Name]
* The Plugin Name
*
* [--PluginURI]
* The Plugin URI
*
* [--Version]
* The Plugin Version
*
* [--Description]
* The Plugin Description
*
* [--Author]
* The Plugin Author
*
* [--AuthorURI]
* The Plugin Author URI
*
* [--TextDomain]
* The Plugin Text Domain
*
* [--DomainPath]
* The Plugin Domain Path
*
* [--Network]
* The Plugin Network
*
* [--RequiresWP]
* The Plugin Requires at least
*
* [--RequiresPHP]
* The Plugin Requires PHP
*
* [--UpdateURI]
* The Plugin Update URI
*
* See: https://developer.wordpress.org/reference/functions/get_plugin_data/#return
*
* ## EXAMPLES
*
* $ wp webmention meta
*
* $ wp webmention meta --Version
* Version: 1.0.0
*
* @param array|null $args The arguments.
* @param array|null $assoc_args The associative arguments.
*
* @return void
*/
public function meta( $args, $assoc_args ) {
$plugin_data = get_plugin_meta();
if ( $assoc_args ) {
$plugin_data = array_intersect_key( $plugin_data, $assoc_args );
} else {
WP_CLI::line( __( "ActivityPub Plugin Meta:\n", 'activitypub' ) );
}
foreach ( $plugin_data as $key => $value ) {
WP_CLI::line( $key . ': ' . $value );
}
}
/**
* Remove the blog from the Fediverse.
*
* ## EXAMPLES
*
* $ wp activitypub self-destruct
*
* @subcommand self-destruct
*
* @param array|null $args The arguments.
* @param array|null $assoc_args The associative arguments.
*
* @return void
*/
public function self_destruct( $args, $assoc_args ) {
$question = __( 'We are in the process of deleting your blog from the Fediverse. This action could be irreversible, so are you sure you want to continue?', 'activitypub' );
WP_CLI::confirm( WP_CLI::colorize( "%r{$question}%n" ), $assoc_args = array() );
WP_CLI::success( __( 'Deleting your Blog from the Fediverse...', 'activitypub' ) );
// Deactivate the ActivityPub Plugin after the deletion.
WP_CLI::runcommand( 'plugin deactivate activitypub' );
}
/**
* Delete or Update a User.
*
* ## OPTIONS
*
* <action>
* : The action to perform. Either `delete` or `update`.
* ---
* options:
* - delete
* - update
* ---
*
* <id>
* : The id of the registered WordPress user.
*
* ## EXAMPLES
*
* $ wp activitypub user delete 1
*
* @synopsis <action> <id>
*
* @param array|null $args The arguments.
* @param array|null $assoc_args The associative arguments.
*
* @return void
*/
public function user( $args, $assoc_args ) {
// @todo add code
}
}