You need to sign in or sign up before continuing.
Newer
Older
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
<?php
/**
* Install the CiviCRM plugin.
*
* ## EXAMPLES
*
* $ wp civicrm install --zipfile=~/civicrm-5.57.1-wordpress.zip
*
* @since 5.69
*/
class CLI_Tools_CiviCRM_Command_Install extends CLI_Tools_CiviCRM_Command {
/**
* Install the CiviCRM plugin. Deprecated: use `wp civicrm core install` instead.
*
* ## OPTIONS
*
* [--dbname=<dbname>]
* : MySQL database name of your CiviCRM database. Defaults to the WordPress database name.
*
* [--dbpass=<dbpass>]
* : MySQL password for your CiviCRM database. Defaults to the WordPress MySQL database password.
*
* [--dbuser=<dbuser>]
* : MySQL username for your CiviCRM database. Defaults to the WordPress MySQL database username.
*
* [--dbhost=<dbhost>]
* : MySQL host for your CiviCRM database. Defaults to the WordPress MySQL host.
*
* [--zipfile=<zipfile>]
* : Path to your CiviCRM zip file. If specified --version is ignored.
*
* [--tarfile=<tarfile>]
* : Path to your CiviCRM .tar.gz file. Not currently available.
*
* [--lang=<lang>]
* : Locale to use for installation. Defaults to "en_US".
*
* [--langtarfile=<langtarfile>]
* : Path to your CiviCRM localization .tar.gz file.
*
* [--ssl=<ssl>]
* : The SSL setting for your website, e.g. '--ssl=on'. Defaults to "on".
*
* [--site_url=<site_url>]
* : Domain for your website, e.g. 'mysite.com'.
*
* [--yes]
* : Answer yes to the confirmation message.
*
* ## EXAMPLES
*
* $ wp civicrm install --zipfile=~/civicrm-5.57.1-wordpress.zip
*
* @since 5.69
*
* @param array $args The WP-CLI positional arguments.
* @param array $assoc_args The WP-CLI associative arguments.
*/
public function __invoke($args, $assoc_args) {
WP_CLI::log(WP_CLI::colorize('%CDeprecated command:%n %cuse `wp civicrm core install` instead.%n'));
// Grab associative arguments.
$dbuser = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'dbuser', (defined('DB_USER') ? DB_USER : ''));
$dbpass = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'dbpass', (defined('DB_PASSWORD') ? DB_PASSWORD : ''));
$dbhost = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'dbhost', (defined('DB_HOST') ? DB_HOST : ''));
$dbname = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'dbname', (defined('DB_NAME') ? DB_NAME : ''));
$locale = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'locale', 'en_US');
$zipfile = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'zipfile', '');
$tarfile = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'tarfile', '');
$lang = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'lang', '');
$langtarfile = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'langtarfile', '');
$ssl = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'ssl', '');
$site_url = (string) \WP_CLI\Utils\get_flag_value($assoc_args, 'site_url', '');
$yes = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'yes', FALSE);
// Bail when .tar.gz archive is specified.
if (!empty($tarfile)) {
WP_CLI::error('CiviCRM .tar.gz archives are not supported.');
}
// Bail when no .zip archive is specified.
if (empty($zipfile)) {
WP_CLI::error('You must supply a CiviCRM zip archive.');
}
// Build install command.
$command = 'civicrm core install --zipfile=' . $zipfile .
(empty($langtarfile) ? '' : ' --l10n-tarfile=' . $langtarfile);
// Run "wp civicrm core install".
$options = ['launch' => FALSE, 'return' => FALSE];
WP_CLI::runcommand($command, $options);
// Build activate command.
$command = 'civicrm core activate' .
(empty($dbuser) ? '' : ' --dbuser=' . $dbuser) .
(empty($dbpass) ? '' : ' --dbpass=' . $dbpass) .
(empty($dbhost) ? '' : ' --dbhost=' . $dbhost) .
(empty($dbname) ? '' : ' --dbname=' . $dbname) .
(empty($lang) ? '' : ' --locale=' . $lang) .
(empty($ssl) ? '' : ' --ssl=' . $ssl) .
(empty($site_url) ? '' : ' --site-url=' . $site_url) .
(empty($yes) ? '' : ' --yes');
// Run "wp civicrm core activate".
$options = ['launch' => FALSE, 'return' => FALSE];
WP_CLI::runcommand($command, $options);
}
}