Skip to content

Commit

Permalink
MDL-65208 admin: Add upgrade cli --is-pending option
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanheywood committed Jun 3, 2019
1 parent 29c3951 commit 8918cc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion admin/cli/upgrade.php
Expand Up @@ -52,7 +52,8 @@
'allow-unstable' => false,
'help' => false,
'lang' => $lang,
'verbose-settings' => false
'verbose-settings' => false,
'is-pending' => false,
),
array(
'h' => 'help'
Expand Down Expand Up @@ -88,6 +89,8 @@
--verbose-settings Show new settings values. By default only the name of
new core or plugin settings are displayed. This option
outputs the new values as well as the setting name.
--is-pending If an upgrade is needed it exits with an error code of
2 so it distinct from other types of errors.
-h, --help Print out this help
Example:
Expand Down Expand Up @@ -116,6 +119,10 @@
cli_error(get_string('cliupgradenoneed', 'core_admin', $newversion), 0);
}

if ($options['is-pending']) {
cli_error(get_string('cliupgradepending', 'core_admin'), 2);
}

// Test environment first.
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
if (!$envstatus) {
Expand Down
1 change: 1 addition & 0 deletions lang/en/admin.php
Expand Up @@ -132,6 +132,7 @@
$string['cliupgradedefaultverbose'] = 'New setting: {$a->name}, Default value: {$a->defaultsetting}';
$string['cliupgradefinished'] = 'Command line upgrade from {$a->oldversion} to {$a->newversion} completed successfully.';
$string['cliupgradenoneed'] = 'No upgrade needed for the installed version {$a}. Thanks for coming anyway!';
$string['cliupgradepending'] = 'An upgrade is pending';
$string['cliyesnoprompt'] = 'type y (means yes) or n (means no)';
$string['commentsperpage'] = 'Comments displayed per page';
$string['commonactivitysettings'] = 'Common activity settings';
Expand Down

0 comments on commit 8918cc7

Please sign in to comment.