-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathBuild_Command.php
More file actions
108 lines (96 loc) · 2.68 KB
/
Build_Command.php
File metadata and controls
108 lines (96 loc) · 2.68 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
<?php namespace WP_CLI_Build;
use WP_CLI;
use WP_CLI_Build\Processor\Core;
use WP_CLI_Build\Processor\Item;
use WP_CLI_Build\Helper\Utils;
class Build_Command extends \WP_CLI_Command {
/**
* Installs WordPress, plugins and themes.
*
* ## OPTIONS
*
* [--file=<file>]
* : Specify custom build file (default: build.json)
*
* [--clean]
* : Deletes and re-download all plugins and themes listed in build file
*
* [--ignore-core]
* : Don't process core
*
* [--ignore-plugins]
* : Don't process plugins
*
* [--ignore-themes]
* : Don't process themes
*
* [--dbname]
* : Database name for wp-config.php (if WP is not installed)
*
* [--dbuser]
* : Database user for wp-config.php (if WP is not installed)
*
* [--dbpass]
* : Database pass for wp-config.php (if WP is not installed)
*
* [--dbhost]
* : Database host for wp-config.php (if WP is not installed)
*
* [--dbprefix]
* : Database prefix for wp-config.php (if WP is not installed)
*
* [--dbcharset]
* : Database charset for wp-config.php (if WP is not installed)
*
* [--dbcollate]
* : Database collate for wp-config.php (if WP is not installed)
*
* [--locale]
* : Locale for wp-config.php (if WP is not installed)
*
* [--skip-salts]
* : If set, keys and salts won't be generated for wp-config.php (if WP is not installed)
*
* [--skip-check]
* : If set, the database connection is not checked.
*
* [--force]
* : Overwrites existing wp-config.php
*
* ## EXAMPLES
*
* wp build
* wp build --file=production.json --no-plugins
*
* @when before_wp_load
*/
public function __invoke( $args = null, $assoc_args = null ) {
$build_filename = Utils::get_build_filename( $assoc_args );
WP_CLI::line( WP_CLI::colorize( "%GParsing %W$build_filename%n%G, please wait...%n" ) );
// Clean mode check
if ( ! empty( $assoc_args['clean'] ) ) {
WP_CLI::confirm( WP_CLI::colorize( "\n%RItems will be deleted! => This will delete and re-download all plugins and themes listed in build file.\n%n%YAre you sure you want to continue?%n" ) );
}
// Process core.
if ( empty( $assoc_args['no-core'] ) ) {
$core = new Core( $assoc_args );
$core = $core->process();
}
// Item processor.
$item = new Item( $assoc_args );
// Process plugins.
if ( empty( $assoc_args['no-plugins'] ) ) {
$plugins = $item->run( 'plugin' );
}
// Process themes.
if ( empty( $assoc_args['no-themes'] ) ) {
$themes = $item->run( 'theme' );
}
// Nothing to do!
if ( empty( $core ) && empty( $plugins ) && empty( $themes ) ) {
WP_CLI::line( WP_CLI::colorize( "%WNothing to do.%n" ) );
} else {
WP_CLI::line( WP_CLI::colorize( "%WFinished.%n" ) );
}
}
}