mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-49329 admin: Clean up disabling of plugins code management features
The admin setting updateautodeploy no longer exists. The two existing config.php flags $CFG->disableupdateautodeploy and $CFG->disableonclickaddoninstall merged into a single one.
This commit is contained in:
parent
d9a5b810bd
commit
b0fc789878
@ -120,6 +120,18 @@ $installupdateversion = optional_param('installupdateversion', null, PARAM_INT);
|
||||
$installupdatex = optional_param('installupdatex', false, PARAM_BOOL); // Install all available plugin updates.
|
||||
$confirminstallupdate = optional_param('confirminstallupdate', false, PARAM_BOOL); // Available update(s) install confirmed?
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
// Invalidate all requests to install plugins via the admin UI.
|
||||
$newaddonreq = null;
|
||||
$installdep = null;
|
||||
$installdepx = false;
|
||||
$abortupgrade = null;
|
||||
$abortupgradex = null;
|
||||
$installupdate = null;
|
||||
$installupdateversion = null;
|
||||
$installupdatex = false;
|
||||
}
|
||||
|
||||
// Set up PAGE.
|
||||
$url = new moodle_url('/admin/index.php');
|
||||
$url->param('cache', $cache);
|
||||
@ -130,7 +142,7 @@ $PAGE->set_url($url);
|
||||
unset($url);
|
||||
|
||||
// Are we returning from an add-on installation request at moodle.org/plugins?
|
||||
if ($newaddonreq and !$cache and empty($CFG->disableonclickaddoninstall)) {
|
||||
if ($newaddonreq and !$cache and empty($CFG->disableupdateautodeploy)) {
|
||||
$target = new moodle_url('/admin/tool/installaddon/index.php', array(
|
||||
'installaddonrequest' => $newaddonreq,
|
||||
'confirm' => 0));
|
||||
|
@ -215,10 +215,6 @@ if (empty($CFG->disableupdatenotifications)) {
|
||||
$temp = new admin_settingpage('updatenotifications', new lang_string('updatenotifications', 'core_admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('updateautocheck', new lang_string('updateautocheck', 'core_admin'),
|
||||
new lang_string('updateautocheck_desc', 'core_admin'), 1));
|
||||
if (empty($CFG->disableupdateautodeploy)) {
|
||||
$temp->add(new admin_setting_configcheckbox('updateautodeploy', new lang_string('updateautodeploy', 'core_admin'),
|
||||
new lang_string('updateautodeploy_desc', 'core_admin'), 0));
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'),
|
||||
new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE,
|
||||
array(
|
||||
|
@ -28,7 +28,7 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('tool_installaddon_index');
|
||||
|
||||
if (!empty($CFG->disableonclickaddoninstall)) {
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
notice(get_string('featuredisabled', 'tool_installaddon'));
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ if (!has_capability('moodle/site:config', context_system::instance())) {
|
||||
die();
|
||||
}
|
||||
|
||||
if (!empty($CFG->disableonclickaddoninstall)) {
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($hassiteconfig and empty($CFG->disableonclickaddoninstall)) {
|
||||
if ($hassiteconfig and empty($CFG->disableupdateautodeploy)) {
|
||||
|
||||
$ADMIN->add('modules', new admin_externalpage('tool_installaddon_index',
|
||||
get_string('installaddons', 'tool_installaddon'),
|
||||
|
@ -447,18 +447,13 @@ $CFG->admin = 'admin';
|
||||
//
|
||||
// $CFG->disableupdatenotifications = true;
|
||||
//
|
||||
// Use the following flag to completely disable the Automatic updates deployment
|
||||
// feature and hide it from the server administration UI.
|
||||
// TODO: drop this flag and use disableonclickaddoninstall instead.
|
||||
// Use the following flag to completely disable the installation of plugins
|
||||
// (new plugins, available updates and missing dependencies) and related
|
||||
// features (such as cancelling the plugin installation or upgrade) via the
|
||||
// server administration web interface.
|
||||
//
|
||||
// $CFG->disableupdateautodeploy = true;
|
||||
//
|
||||
// Use the following flag to completely disable the installation of plugins
|
||||
// (new plugins, available updates and missing dependencies) via the server
|
||||
// administration UI.
|
||||
//
|
||||
// $CFG->disableonclickaddoninstall = true;
|
||||
//
|
||||
// Use the following flag to disable modifications to scheduled tasks
|
||||
// whilst still showing the state of tasks.
|
||||
//
|
||||
|
@ -1093,8 +1093,6 @@ $string['updatenotificationfooter'] = 'Your Moodle site {$a->siteurl} is configu
|
||||
$string['updatenotificationsubject'] = 'Moodle updates are available ({$a->siteurl})';
|
||||
$string['updateautocheck'] = 'Automatically check for available updates';
|
||||
$string['updateautocheck_desc'] = 'If enabled, your site will automatically check for available updates for both Moodle code and all additional plugins. If there is a new update available, a notification will be sent to site admins.';
|
||||
$string['updateautodeploy'] = 'Enable updates deployment';
|
||||
$string['updateautodeploy_desc'] = 'If enabled, you will be able to download and install available updates directly from Moodle administration pages. Note that your web server process has to have write access into folders with Moodle installation to make this work. That can be seen as a potential security risk.';
|
||||
$string['updateminmaturity'] = 'Required code maturity';
|
||||
$string['updateminmaturity_desc'] = 'Notify about available updates only if the available code has the selected maturity level at least. Updates for plugins that do not declare their code maturity level are always reported regardless this setting.';
|
||||
$string['updatenotifybuilds'] = 'Notify about new builds';
|
||||
|
@ -946,7 +946,7 @@ class core_plugin_manager {
|
||||
global $CFG;
|
||||
|
||||
// Make sure the feature is not disabled.
|
||||
if (!empty($CFG->disableonclickaddoninstall)) {
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
$reason = 'disabled';
|
||||
return false;
|
||||
}
|
||||
@ -998,7 +998,11 @@ class core_plugin_manager {
|
||||
* @return array
|
||||
*/
|
||||
public function filter_installable($remoteinfos) {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
return array();
|
||||
}
|
||||
if (empty($remoteinfos)) {
|
||||
return array();
|
||||
}
|
||||
@ -1072,6 +1076,11 @@ class core_plugin_manager {
|
||||
* @return string|bool full path to the file, false on error
|
||||
*/
|
||||
public function get_remote_plugin_zip($url, $md5) {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
return false;
|
||||
}
|
||||
return $this->get_code_manager()->get_remote_plugin_zip($url, $md5);
|
||||
}
|
||||
|
||||
@ -1235,6 +1244,10 @@ class core_plugin_manager {
|
||||
public function install_plugins(array $plugins, $confirmed, $silent) {
|
||||
global $CFG, $OUTPUT;
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($plugins)) {
|
||||
return false;
|
||||
}
|
||||
@ -1949,6 +1962,11 @@ class core_plugin_manager {
|
||||
* @return bool
|
||||
*/
|
||||
public function can_cancel_plugin_installation(\core\plugininfo\base $plugin) {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($plugin) or $plugin->is_standard() or $plugin->is_subplugin()
|
||||
or !$this->is_plugin_folder_removable($plugin->component)) {
|
||||
@ -1973,6 +1991,13 @@ class core_plugin_manager {
|
||||
* @return bool
|
||||
*/
|
||||
public function can_cancel_plugin_upgrade(\core\plugininfo\base $plugin) {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
// Cancelling the plugin upgrade is actually installation of the
|
||||
// previously archived version.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($plugin) or $plugin->is_standard() or $plugin->is_subplugin()
|
||||
or !$this->is_plugin_folder_removable($plugin->component)) {
|
||||
@ -1998,6 +2023,11 @@ class core_plugin_manager {
|
||||
* @param string $component
|
||||
*/
|
||||
public function cancel_plugin_installation($component) {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$plugin = $this->get_plugin_info($component);
|
||||
|
||||
@ -2014,6 +2044,11 @@ class core_plugin_manager {
|
||||
* @return array [(string)component] => (\core\plugininfo\base)plugin
|
||||
*/
|
||||
public function list_cancellable_installations() {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$cancellable = array();
|
||||
foreach ($this->get_plugins() as $type => $plugins) {
|
||||
@ -2043,6 +2078,11 @@ class core_plugin_manager {
|
||||
* @return array [(string)component] => {(string)->component, (string)->zipfilepath}
|
||||
*/
|
||||
public function list_restorable_archives() {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$codeman = $this->get_code_manager();
|
||||
$restorable = array();
|
||||
|
@ -4599,5 +4599,12 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2015100600.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015100800.01) {
|
||||
// The only flag for preventing all plugins installation features is
|
||||
// now $CFG->disableupdateautodeploy in config.php.
|
||||
unset_config('updateautodeploy');
|
||||
upgrade_main_savepoint(true, 2015100800.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -364,6 +364,11 @@ $CFG->yuipatchlevel = 0;
|
||||
$CFG->yuipatchedmodules = array(
|
||||
);
|
||||
|
||||
if (!empty($CFG->disableonclickaddoninstall)) {
|
||||
// This config.php flag has been merged into another one.
|
||||
$CFG->disableupdateautodeploy = true;
|
||||
}
|
||||
|
||||
// Store settings from config.php in array in $CFG - we can use it later to detect problems and overrides.
|
||||
if (!isset($CFG->config_php_settings)) {
|
||||
$CFG->config_php_settings = (array)$CFG;
|
||||
|
@ -2384,12 +2384,16 @@ function check_upgrade_key($upgradekeyhash) {
|
||||
* @param moodle_url|string|null $return URL to go back on cancelling at the validation screen
|
||||
*/
|
||||
function upgrade_install_plugins(array $installable, $confirmed, $heading='', $continue=null, $return=null) {
|
||||
global $PAGE;
|
||||
global $CFG, $PAGE;
|
||||
|
||||
if (empty($return)) {
|
||||
$return = $PAGE->url;
|
||||
}
|
||||
|
||||
if (!empty($CFG->disableupdateautodeploy)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
||||
if (empty($installable)) {
|
||||
redirect($return);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2015100800.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2015100800.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user