mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 18:04:43 +02:00
MDL-35238 Warn the admin if they are about to overwrite a SCM checkout
This commit is contained in:
parent
292dbeac9b
commit
08c3bc006d
@ -255,7 +255,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->container_start('generalbox', 'notice');
|
||||
$output .= $this->container_start('generalbox updateplugin', 'notice');
|
||||
|
||||
$a = new stdClass();
|
||||
if (get_string_manager()->string_exists('pluginname', $updateinfo->component)) {
|
||||
@ -272,10 +272,12 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$a->url = $updateinfo->download;
|
||||
|
||||
$output .= $this->output->heading(get_string('updatepluginconfirm', 'core_plugin'));
|
||||
$output .= $this->output->container(format_text(
|
||||
get_string('updatepluginconfirminfo', 'core_plugin', $a) . PHP_EOL . PHP_EOL .
|
||||
get_string('updatepluginconfirmwarning', 'core_plugin')
|
||||
));
|
||||
$output .= $this->output->container(format_text(get_string('updatepluginconfirminfo', 'core_plugin', $a)), 'updatepluginconfirminfo');
|
||||
$output .= $this->output->container(get_string('updatepluginconfirmwarning', 'core_plugin', 'updatepluginconfirmwarning'));
|
||||
|
||||
if ($repotype = $deployer->plugin_external_source($data['updateinfo'])) {
|
||||
$output .= $this->output->container(get_string('updatepluginconfirmexternal', 'core_plugin', $repotype), 'updatepluginconfirmexternal');
|
||||
}
|
||||
|
||||
$widget = $deployer->make_execution_widget($data['updateinfo']);
|
||||
$output .= $this->output->render($widget);
|
||||
|
@ -133,6 +133,7 @@ $string['updateavailable_moreinfo'] = 'More info...';
|
||||
$string['updateavailable_release'] = 'Release {$a}';
|
||||
$string['updatepluginconfirm'] = 'Plugin update confirmation';
|
||||
$string['updatepluginconfirminfo'] = 'You are about to install a new version of the plugin <strong>{$a->name}</strong>. A zip package with version {$a->version} of the plugin will be downloaded from <a href="{$a->url}">{$a->url}</a> and extracted to your Moodle installation so it can upgrade your installation.';
|
||||
$string['updatepluginconfirmexternal'] = 'It appears that the current version of the plugin has been obtained via source code management system ({$a}) checkout. If you install this update, you will no longer be able to obtain plugin updates from the source code management system. Please ensure that you definitely want to update the plugin before continuing.';
|
||||
$string['updatepluginconfirmwarning'] = 'Please note that Moodle will not automatically make a backup of your database before the upgrade. We strongly recommend that you make a full snapshot backup now, to cope with the rare case that the new code has bugs that make your site unavailable or even corrupts your database. Proceed at your own risk.';
|
||||
$string['uninstall'] = 'Uninstall';
|
||||
$string['version'] = 'Version';
|
||||
|
@ -1543,6 +1543,33 @@ class available_update_deployer {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the current version of the plugin seems to be a checkout of an external repository.
|
||||
*
|
||||
* @param available_update_info $info
|
||||
* @return false|string
|
||||
*/
|
||||
public function plugin_external_source(available_update_info $info) {
|
||||
|
||||
$paths = get_plugin_types(true);
|
||||
list($plugintype, $pluginname) = normalize_component($info->component);
|
||||
$pluginroot = $paths[$plugintype].'/'.$pluginname;
|
||||
|
||||
if (is_dir($pluginroot.'/.git')) {
|
||||
return 'git';
|
||||
}
|
||||
|
||||
if (is_dir($pluginroot.'/CVS')) {
|
||||
return 'cvs';
|
||||
}
|
||||
|
||||
if (is_dir($pluginroot.'/.svn')) {
|
||||
return 'svn';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares a renderable widget to confirm installation of an available update.
|
||||
*
|
||||
|
@ -102,6 +102,11 @@
|
||||
#page-admin-index .adminwarning.availableupdatesinfo .moodleupdateinfo a {padding-right:1em;}
|
||||
#page-admin-index .adminwarning.availableupdatesinfo .moodleupdateinfo .separator {border-left:1px dotted #333;}
|
||||
|
||||
#page-admin-index .updateplugin div,
|
||||
#page-admin-plugins .updateplugin div {margin-bottom:0.5em;}
|
||||
#page-admin-index .updateplugin .updatepluginconfirmexternal,
|
||||
#page-admin-plugins .updateplugin .updatepluginconfirmexternal {padding:1em;background-color:#ffd3d9;border:1px solid #EEAAAA}
|
||||
|
||||
#page-admin-user-user_bulk #users .fgroup {white-space: nowrap;}
|
||||
#page-admin-report-stats-index .graph {text-align: center;margin-bottom: 1em;}
|
||||
#page-admin-report-courseoverview-index .graph {text-align: center;margin-bottom: 1em;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user