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
<?php
/**
* Upgrade the CiviCRM database schema.
*
* ## EXAMPLES
*
* $ wp civicrm upgrade-db
* $ wp civicrm upgrade-db --dry-run
*
* @since 5.69
*/
class CLI_Tools_CiviCRM_Command_Upgrade_DB extends CLI_Tools_CiviCRM_Command {
/**
* Upgrade the CiviCRM database schema. Deprecated: use `wp civicrm core update-db` instead.
*
* ## OPTIONS
*
* [--dry-run]
* : Preview the list of upgrade tasks.
*
* [--retry]
* : Resume a failed upgrade, retrying the last step.
*
* [--skip]
* : Resume a failed upgrade, skipping the last step.
*
* [--step]
* : Run the upgrade queue in steps, pausing before each step.
*
* [--v]
* : Run the upgrade queue with verbose output.
*
* [--vv]
* : Run the upgrade queue with extra verbose output.
*
* [--vvv]
* : An alias of --vv for old timers more used to cv syntax.
*
* [--yes]
* : Answer yes to the confirmation message. Does not apply to step messages.
*
* ## EXAMPLES
*
* $ wp civicrm upgrade-db --dry-run --v
* Deprecated command: use `wp civicrm core update-db` instead.
* Found CiviCRM code version: 5.57.1
* Found CiviCRM database version: 5.57.0
* Checking pre-upgrade messages.
* (No messages)
* Dropping SQL triggers.
* Preparing upgrade.
* Executing upgrade.
* Cleanup old files
* Cleanup old upgrade snapshots
* Checking extensions
* Finish Upgrade DB to 5.57.1
* Update all reserved message templates
* Finish core DB updates 5.57.1
* Assess extension upgrades
* Generate final messages
* Finishing upgrade.
* Upgrade to 5.57.1 completed.
* Checking post-upgrade messages.
* (No messages)
* Have a nice day.
*
* @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 update-db` instead.%n'));
// Grab associative arguments.
$dry_run = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'dry-run', FALSE);
$retry = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'retry', FALSE);
$skip = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'skip', FALSE);
$step = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'step', FALSE);
$v = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'v', FALSE);
$vv = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'vv', FALSE);
$vvv = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'vvv', FALSE);
$yes = (bool) \WP_CLI\Utils\get_flag_value($assoc_args, 'yes', FALSE);
// Build command.
$command = 'civicrm core update-db' .
(empty($dry_run) ? '' : ' --dry-run') .
(empty($retry) ? '' : ' --retry') .
(empty($skip) ? '' : ' --skip') .
(empty($step) ? '' : ' --step') .
(empty($v) ? '' : ' --v') .
(empty($vv) ? '' : ' --vv') .
(empty($vvv) ? '' : ' --vvv') .
(empty($yes) ? '' : ' --yes');
// Pass on to "wp civicrm core update-db".
$options = ['launch' => FALSE, 'return' => FALSE];
WP_CLI::runcommand($command, $options);
}
}