/** * 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 \core\update\info $updateinfo information about the available update for the plugin */ protected function plugin_available_update_info(\core\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 = \core\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; }
$strplugincheck = get_string('plugincheck'); $PAGE->navbar->add($strplugincheck); $PAGE->set_title($strplugincheck); $PAGE->set_heading($strplugincheck); $PAGE->set_cacheable(false); if ($fetchupdates) { require_sesskey(); $updateschecker = \core\update\checker::instance(); if ($updateschecker->enabled()) { $updateschecker->fetch(); } redirect($PAGE->url); } /** @var core_admin_renderer $output */ $output = $PAGE->get_renderer('core', 'admin'); $deployer = \core\update\deployer::instance(); if ($deployer->enabled()) { $deployer->initialize($PAGE->url, $PAGE->url); $deploydata = $deployer->submitted_data(); if (!empty($deploydata)) { require_sesskey(); echo $output->upgrade_plugin_confirm_deploy_page($deployer, $deploydata); die; } } // Show plugins info. echo $output->upgrade_plugin_check_page(core_plugin_manager::instance(), \core\update\checker::instance(), $version, $showallplugins, new moodle_url($PAGE->url), new moodle_url('/admin/index.php', array('confirmplugincheck' => 1, 'cache' => 0))); die; } // Make sure plugin dependencies are always checked. $failed = array();