mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
Merge branch 'MDL-32610-hide-updates' of git://github.com/mudrd8mz/moodle
This commit is contained in:
commit
1220843c02
@ -240,7 +240,9 @@ if ($version > $CFG->version) { // upgrade
|
||||
|
||||
if ($fetchupdates) {
|
||||
// no sesskey support guaranteed here
|
||||
available_update_checker::instance()->fetch();
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
available_update_checker::instance()->fetch();
|
||||
}
|
||||
redirect($reloadurl);
|
||||
}
|
||||
|
||||
|
@ -174,6 +174,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function upgrade_plugin_check_page(plugin_manager $pluginman, available_update_checker $checker,
|
||||
$version, $showallplugins, $reloadurl, $continueurl) {
|
||||
global $CFG;
|
||||
|
||||
$output = '';
|
||||
|
||||
@ -181,14 +182,16 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->box_start('generalbox');
|
||||
$output .= $this->container_start('generalbox', 'notice');
|
||||
$output .= html_writer::tag('p', get_string('pluginchecknotice', 'core_plugin'));
|
||||
$output .= $this->container_start('checkforupdates');
|
||||
$output .= $this->single_button(new moodle_url($reloadurl, array('fetchupdates' => 1)), get_string('checkforupdates', 'core_plugin'));
|
||||
if ($timefetched = $checker->get_last_timefetched()) {
|
||||
$output .= $this->container(get_string('checkforupdateslast', 'core_plugin',
|
||||
userdate($timefetched, get_string('strftimedatetime', 'core_langconfig'))));
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
$output .= $this->container_start('checkforupdates');
|
||||
$output .= $this->single_button(new moodle_url($reloadurl, array('fetchupdates' => 1)), get_string('checkforupdates', 'core_plugin'));
|
||||
if ($timefetched = $checker->get_last_timefetched()) {
|
||||
$output .= $this->container(get_string('checkforupdateslast', 'core_plugin',
|
||||
userdate($timefetched, get_string('strftimedatetime', 'core_langconfig'))));
|
||||
}
|
||||
$output .= $this->container_end();
|
||||
}
|
||||
$output .= $this->container_end();
|
||||
$output .= $this->container_end();
|
||||
|
||||
$output .= $this->plugins_check_table($pluginman, $version, array('full' => $showallplugins));
|
||||
$output .= $this->box_end();
|
||||
@ -227,11 +230,12 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
|
||||
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch) {
|
||||
global $CFG;
|
||||
$output = '';
|
||||
|
||||
$output .= $this->header();
|
||||
$output .= $this->maturity_info($maturity);
|
||||
$output .= $this->available_updates($availableupdates, $availableupdatesfetch);
|
||||
$output .= empty($CFG->disableupdatenotifications) ? $this->available_updates($availableupdates, $availableupdatesfetch) : '';
|
||||
$output .= $this->insecure_dataroot_warning($insecuredataroot);
|
||||
$output .= $this->display_errors_warning($errorsdisplayed);
|
||||
$output .= $this->cron_overdue_warning($cronoverdue);
|
||||
@ -256,19 +260,23 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function plugin_management_page(plugin_manager $pluginman, available_update_checker $checker) {
|
||||
global $CFG;
|
||||
|
||||
$output = '';
|
||||
|
||||
$output .= $this->header();
|
||||
$output .= $this->heading(get_string('pluginsoverview', 'core_admin'));
|
||||
$output .= $this->plugins_overview_panel($pluginman);
|
||||
|
||||
$output .= $this->container_start('checkforupdates');
|
||||
$output .= $this->single_button(new moodle_url($this->page->url, array('fetchremote' => 1)), get_string('checkforupdates', 'core_plugin'));
|
||||
if ($timefetched = $checker->get_last_timefetched()) {
|
||||
$output .= $this->container(get_string('checkforupdateslast', 'core_plugin',
|
||||
userdate($timefetched, get_string('strftimedatetime', 'core_langconfig'))));
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
$output .= $this->container_start('checkforupdates');
|
||||
$output .= $this->single_button(new moodle_url($this->page->url, array('fetchremote' => 1)), get_string('checkforupdates', 'core_plugin'));
|
||||
if ($timefetched = $checker->get_last_timefetched()) {
|
||||
$output .= $this->container(get_string('checkforupdateslast', 'core_plugin',
|
||||
userdate($timefetched, get_string('strftimedatetime', 'core_langconfig'))));
|
||||
}
|
||||
$output .= $this->container_end();
|
||||
}
|
||||
$output .= $this->container_end();
|
||||
|
||||
$output .= $this->box($this->plugins_control_panel($pluginman), 'generalbox');
|
||||
$output .= $this->footer();
|
||||
@ -559,6 +567,8 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function plugins_check_table(plugin_manager $pluginman, $version, array $options = null) {
|
||||
global $CFG;
|
||||
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
@ -641,7 +651,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$status = get_string('status_' . $statuscode, 'core_plugin');
|
||||
|
||||
$availableupdates = $plugin->available_updates();
|
||||
if (!empty($availableupdates)) {
|
||||
if (!empty($availableupdates) and empty($CFG->disableupdatenotifications)) {
|
||||
foreach ($availableupdates as $availableupdate) {
|
||||
$status .= $this->plugin_available_update_info($availableupdate);
|
||||
}
|
||||
@ -771,6 +781,8 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @return string as usually
|
||||
*/
|
||||
public function plugins_overview_panel(plugin_manager $pluginman) {
|
||||
global $CFG;
|
||||
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
|
||||
$numtotal = $numdisabled = $numextension = $numupdatable = 0;
|
||||
@ -787,7 +799,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
if (!$plugin->is_standard()) {
|
||||
$numextension++;
|
||||
}
|
||||
if ($plugin->available_updates()) {
|
||||
if (empty($CFG->disableupdatenotifications) and $plugin->available_updates()) {
|
||||
$numupdatable++;
|
||||
}
|
||||
}
|
||||
@ -813,6 +825,8 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function plugins_control_panel(plugin_manager $pluginman) {
|
||||
global $CFG;
|
||||
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
@ -916,7 +930,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
$updateinfo = '';
|
||||
if (is_array($plugin->available_updates())) {
|
||||
if (empty($CFG->disableupdatenotifications) and is_array($plugin->available_updates())) {
|
||||
foreach ($plugin->available_updates() as $availableupdate) {
|
||||
$updateinfo .= $this->plugin_available_update_info($availableupdate);
|
||||
}
|
||||
|
@ -222,19 +222,21 @@ $ADMIN->add('server', $temp);
|
||||
$ADMIN->add('server', new admin_externalpage('adminregistration', new lang_string('registration','admin'), "$CFG->wwwroot/$CFG->admin/registration/index.php"));
|
||||
|
||||
// "update notifications" settingpage
|
||||
$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));
|
||||
$temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'),
|
||||
new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE,
|
||||
array(
|
||||
MATURITY_ALPHA => new lang_string('maturity'.MATURITY_ALPHA, 'core_admin'),
|
||||
MATURITY_BETA => new lang_string('maturity'.MATURITY_BETA, 'core_admin'),
|
||||
MATURITY_RC => new lang_string('maturity'.MATURITY_RC, 'core_admin'),
|
||||
MATURITY_STABLE => new lang_string('maturity'.MATURITY_STABLE, 'core_admin'),
|
||||
)));
|
||||
$temp->add(new admin_setting_configcheckbox('updatenotifybuilds', new lang_string('updatenotifybuilds', 'core_admin'),
|
||||
new lang_string('updatenotifybuilds_desc', 'core_admin'), 0));
|
||||
$ADMIN->add('server', $temp);
|
||||
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));
|
||||
$temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'),
|
||||
new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE,
|
||||
array(
|
||||
MATURITY_ALPHA => new lang_string('maturity'.MATURITY_ALPHA, 'core_admin'),
|
||||
MATURITY_BETA => new lang_string('maturity'.MATURITY_BETA, 'core_admin'),
|
||||
MATURITY_RC => new lang_string('maturity'.MATURITY_RC, 'core_admin'),
|
||||
MATURITY_STABLE => new lang_string('maturity'.MATURITY_STABLE, 'core_admin'),
|
||||
)));
|
||||
$temp->add(new admin_setting_configcheckbox('updatenotifybuilds', new lang_string('updatenotifybuilds', 'core_admin'),
|
||||
new lang_string('updatenotifybuilds_desc', 'core_admin'), 0));
|
||||
$ADMIN->add('server', $temp);
|
||||
}
|
||||
|
||||
} // end of speedup
|
||||
|
@ -431,6 +431,11 @@ $CFG->admin = 'admin';
|
||||
//
|
||||
// $CFG->cssoptimiserpretty = true;
|
||||
//
|
||||
// Use the following flag to completely disable the Available update notifications
|
||||
// feature and hide it from the server administration UI.
|
||||
//
|
||||
// $CFG->disableupdatenotifications = true;
|
||||
//
|
||||
//=========================================================================
|
||||
// 8. SETTINGS FOR DEVELOPMENT SERVERS - not intended for production use!!!
|
||||
//=========================================================================
|
||||
|
@ -382,9 +382,11 @@ function cron_run() {
|
||||
mtrace(get_string('siteupdatesend', 'hub'));
|
||||
|
||||
// If enabled, fetch information about available updates and eventually notify site admins
|
||||
require_once($CFG->libdir.'/pluginlib.php');
|
||||
$updateschecker = available_update_checker::instance();
|
||||
$updateschecker->cron();
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
require_once($CFG->libdir.'/pluginlib.php');
|
||||
$updateschecker = available_update_checker::instance();
|
||||
$updateschecker->cron();
|
||||
}
|
||||
|
||||
//cleanup old session linked tokens
|
||||
//deletes the session linked tokens that are over a day old.
|
||||
|
@ -97,6 +97,7 @@ class plugin_manager {
|
||||
* the values are the corresponding objects extending {@link plugininfo_base}
|
||||
*/
|
||||
public function get_plugins($disablecache=false) {
|
||||
global $CFG;
|
||||
|
||||
if ($disablecache or is_null($this->pluginsinfo)) {
|
||||
$this->pluginsinfo = array();
|
||||
@ -118,8 +119,7 @@ class plugin_manager {
|
||||
$this->pluginsinfo[$plugintype] = $plugins;
|
||||
}
|
||||
|
||||
// TODO: MDL-20438 verify this is the correct solution/replace
|
||||
if (!during_initial_install()) {
|
||||
if (empty($CFG->disableupdatenotifications) and !during_initial_install()) {
|
||||
// append the information about available updates provided by {@link available_update_checker()}
|
||||
$provider = available_update_checker::instance();
|
||||
foreach ($this->pluginsinfo as $plugintype => $plugins) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user