|
4 | 4 | return; |
5 | 5 | } |
6 | 6 |
|
7 | | -$autoload = dirname( __FILE__ ) . '/vendor/autoload.php'; |
8 | | -if ( file_exists( $autoload ) ) { |
9 | | - require_once $autoload; |
| 7 | +$wpcli_entity_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php'; |
| 8 | +if ( file_exists( $wpcli_entity_autoloader ) ) { |
| 9 | + require_once $wpcli_entity_autoloader; |
10 | 10 | } |
11 | 11 |
|
12 | 12 | WP_CLI::add_command( 'comment', 'Comment_Command' ); |
13 | 13 | WP_CLI::add_command( 'comment meta', 'Comment_Meta_Command' ); |
14 | 14 | WP_CLI::add_command( 'menu', 'Menu_Command' ); |
15 | 15 | WP_CLI::add_command( 'menu item', 'Menu_Item_Command' ); |
16 | 16 | WP_CLI::add_command( 'menu location', 'Menu_Location_Command' ); |
17 | | -WP_CLI::add_command( 'network meta', 'Network_Meta_Command', array( |
18 | | - 'before_invoke' => function () { |
19 | | - if ( !is_multisite() ) { |
20 | | - WP_CLI::error( 'This is not a multisite installation.' ); |
21 | | - } |
22 | | - } |
23 | | -) ); |
| 17 | +WP_CLI::add_command( |
| 18 | + 'network meta', |
| 19 | + 'Network_Meta_Command', |
| 20 | + array( |
| 21 | + 'before_invoke' => function () { |
| 22 | + if ( ! is_multisite() ) { |
| 23 | + WP_CLI::error( 'This is not a multisite installation.' ); |
| 24 | + } |
| 25 | + }, |
| 26 | + ) |
| 27 | +); |
24 | 28 | WP_CLI::add_command( 'option', 'Option_Command' ); |
25 | 29 | WP_CLI::add_command( 'post', 'Post_Command' ); |
26 | 30 | WP_CLI::add_command( 'post meta', 'Post_Meta_Command' ); |
27 | 31 | WP_CLI::add_command( 'post term', 'Post_Term_Command' ); |
28 | 32 | WP_CLI::add_command( 'post-type', 'Post_Type_Command' ); |
29 | 33 | WP_CLI::add_command( 'site', 'Site_Command' ); |
30 | | -WP_CLI::add_command( 'site meta', 'Site_Meta_Command', array( |
31 | | - 'before_invoke' => function() { |
32 | | - if ( !is_multisite() ) { |
33 | | - WP_CLI::error( 'This is not a multisite installation.' ); |
34 | | - } |
35 | | - if( ! function_exists('is_site_meta_supported') || ! is_site_meta_supported() ){ |
36 | | - WP_CLI::error( sprintf( 'The %s table is not installed. Please run the network database upgrade.', $GLOBALS['wpdb']->blogmeta ) ); |
37 | | - } |
38 | | - } |
39 | | -) ); |
40 | | -WP_CLI::add_command( 'site option', 'Site_Option_Command', array( |
41 | | - 'before_invoke' => function() { |
42 | | - if ( !is_multisite() ) { |
43 | | - WP_CLI::error( 'This is not a multisite installation.' ); |
44 | | - } |
45 | | - } |
46 | | -) ); |
| 34 | +WP_CLI::add_command( |
| 35 | + 'site meta', |
| 36 | + 'Site_Meta_Command', |
| 37 | + array( |
| 38 | + 'before_invoke' => function() { |
| 39 | + if ( ! is_multisite() ) { |
| 40 | + WP_CLI::error( 'This is not a multisite installation.' ); |
| 41 | + } |
| 42 | + if ( ! function_exists( 'is_site_meta_supported' ) || ! is_site_meta_supported() ) { |
| 43 | + WP_CLI::error( sprintf( 'The %s table is not installed. Please run the network database upgrade.', $GLOBALS['wpdb']->blogmeta ) ); |
| 44 | + } |
| 45 | + }, |
| 46 | + ) |
| 47 | +); |
| 48 | +WP_CLI::add_command( |
| 49 | + 'site option', |
| 50 | + 'Site_Option_Command', |
| 51 | + array( |
| 52 | + 'before_invoke' => function() { |
| 53 | + if ( ! is_multisite() ) { |
| 54 | + WP_CLI::error( 'This is not a multisite installation.' ); |
| 55 | + } |
| 56 | + }, |
| 57 | + ) |
| 58 | +); |
47 | 59 | WP_CLI::add_command( 'taxonomy', 'Taxonomy_Command' ); |
48 | 60 | WP_CLI::add_command( 'term', 'Term_Command' ); |
49 | | -WP_CLI::add_command( 'term meta', 'Term_Meta_Command', array( |
50 | | - 'before_invoke' => function() { |
51 | | - if ( \WP_CLI\Utils\wp_version_compare( '4.4', '<' ) ) { |
52 | | - WP_CLI::error( "Requires WordPress 4.4 or greater." ); |
53 | | - } |
54 | | - }) |
| 61 | +WP_CLI::add_command( |
| 62 | + 'term meta', |
| 63 | + 'Term_Meta_Command', |
| 64 | + array( |
| 65 | + 'before_invoke' => function() { |
| 66 | + if ( \WP_CLI\Utils\wp_version_compare( '4.4', '<' ) ) { |
| 67 | + WP_CLI::error( 'Requires WordPress 4.4 or greater.' ); |
| 68 | + } |
| 69 | + }, |
| 70 | + ) |
55 | 71 | ); |
56 | 72 | WP_CLI::add_command( 'user', 'User_Command' ); |
57 | 73 | WP_CLI::add_command( 'user meta', 'User_Meta_Command' ); |
58 | | -WP_CLI::add_command( 'user session', 'User_Session_Command', array( |
59 | | - 'before_invoke' => function() { |
60 | | - if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) { |
61 | | - WP_CLI::error( "Requires WordPress 4.0 or greater." ); |
62 | | - } |
63 | | - }) |
| 74 | +WP_CLI::add_command( |
| 75 | + 'user session', |
| 76 | + 'User_Session_Command', |
| 77 | + array( |
| 78 | + 'before_invoke' => function() { |
| 79 | + if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) { |
| 80 | + WP_CLI::error( 'Requires WordPress 4.0 or greater.' ); |
| 81 | + } |
| 82 | + }, |
| 83 | + ) |
64 | 84 | ); |
65 | 85 |
|
66 | 86 | WP_CLI::add_command( 'user term', 'User_Term_Command' ); |
|
0 commit comments