* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(dirname(__FILE__)) . '/config.php'; require_once $CFG->libdir . '/adminlib.php'; require_once $CFG->libdir . '/pluginlib.php'; admin_externalpage_setup('pluginsoverview'); require_capability('moodle/site:config', context_system::instance()); $fetchremote = optional_param('fetchremote', false, PARAM_BOOL); $updatesonly = optional_param('updatesonly', false, PARAM_BOOL); $contribonly = optional_param('contribonly', false, PARAM_BOOL); $pluginman = plugin_manager::instance(); $checker = available_update_checker::instance(); // Filtering options. $options = array('updatesonly' => $updatesonly, 'contribonly' => $contribonly); if ($fetchremote) { require_sesskey(); $checker->fetch(); redirect(new moodle_url($PAGE->url, $options)); } $output = $PAGE->get_renderer('core', 'admin'); $deployer = available_update_deployer::instance(); if ($deployer->enabled()) { $myurl = new moodle_url($PAGE->url, array('updatesonly' => $updatesonly, 'contribonly' => $contribonly)); $deployer->initialize($myurl, $myurl); $deploydata = $deployer->submitted_data(); if (!empty($deploydata)) { echo $output->upgrade_plugin_confirm_deploy_page($deployer, $deploydata); die; } } echo $output->plugin_management_page($pluginman, $checker, $options);
/** * Helper method to render the information about the available plugin update * * The passed objects always provides at least the 'version' property containing * the (higher) version of the plugin available. * * @param available_update_info $updateinfo information about the available update for the plugin */ protected function plugin_available_update_info(available_update_info $updateinfo) { $boxclasses = 'pluginupdateinfo'; $info = array(); if (isset($updateinfo->release)) { $info[] = html_writer::tag('span', get_string('updateavailable_release', 'core_plugin', $updateinfo->release), array('class' => 'info release')); } if (isset($updateinfo->maturity)) { $info[] = html_writer::tag('span', get_string('maturity' . $updateinfo->maturity, 'core_admin'), array('class' => 'info maturity')); $boxclasses .= ' maturity' . $updateinfo->maturity; } if (isset($updateinfo->download)) { $info[] = html_writer::link($updateinfo->download, get_string('download'), array('class' => 'info download')); } if (isset($updateinfo->url)) { $info[] = html_writer::link($updateinfo->url, get_string('updateavailable_moreinfo', 'core_plugin'), array('class' => 'info more')); } $box = $this->output->box_start($boxclasses); $box .= html_writer::tag('div', get_string('updateavailable', 'core_plugin', $updateinfo->version), array('class' => 'version')); $box .= $this->output->box(implode(html_writer::tag('span', ' ', array('class' => 'separator')), $info), ''); $deployer = available_update_deployer::instance(); if ($deployer->initialized()) { $impediments = $deployer->deployment_impediments($updateinfo); if (empty($impediments)) { $widget = $deployer->make_confirm_widget($updateinfo); $box .= $this->output->render($widget); } else { if (isset($impediments['notwritable'])) { $box .= $this->output->help_icon('notwritable', 'core_plugin', get_string('notwritable', 'core_plugin')); } if (isset($impediments['notdownloadable'])) { $box .= $this->output->help_icon('notdownloadable', 'core_plugin', get_string('notdownloadable', 'core_plugin')); } } } $box .= $this->output->box_end(); return $box; }