Example #1
0
                 $installable = array($installable[$installdep]);
                 upgrade_install_plugins($installable, $confirminstalldep, get_string('dependencyinstallhead', 'core_plugin'), new moodle_url($PAGE->url, array('installdep' => $installdep, 'confirminstalldep' => 1)));
             }
         }
         // Install all available updates.
         if ($installupdatex) {
             require_sesskey();
             $installable = $pluginman->filter_installable($pluginman->available_updates());
             upgrade_install_plugins($installable, $confirminstallupdate, get_string('updateavailableinstallallhead', 'core_admin'), new moodle_url($PAGE->url, array('installupdatex' => 1, 'confirminstallupdate' => 1)));
         }
         // Install single available update.
         if ($installupdate and $installupdateversion) {
             require_sesskey();
             if ($pluginman->is_remote_plugin_installable($installupdate, $installupdateversion)) {
                 $installable = array($pluginman->get_remote_plugin_info($installupdate, $installupdateversion, true));
                 upgrade_install_plugins($installable, $confirminstallupdate, get_string('updateavailableinstallallhead', 'core_admin'), new moodle_url($PAGE->url, array('installupdate' => $installupdate, 'installupdateversion' => $installupdateversion, 'confirminstallupdate' => 1)));
             }
         }
         // Show plugins info.
         echo $output->upgrade_plugin_check_page($pluginman, \core\update\checker::instance(), $version, $showallplugins, new moodle_url($PAGE->url), new moodle_url($PAGE->url, array('confirmplugincheck' => 1, 'cache' => 0)));
         die;
     }
     // Make sure plugin dependencies are always checked.
     $failed = array();
     if (!$pluginman->all_plugins_ok($version, $failed)) {
         $output = $PAGE->get_renderer('core', 'admin');
         echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url);
         die;
     }
     unset($failed);
 }
Example #2
0
        upgrade_install_plugins($installable, $installremoteconfirm, get_string('installfromrepo', 'tool_installaddon'), new moodle_url($PAGE->url, array('installremote' => $installremote, 'installremoteversion' => $installremoteversion, 'installremoteconfirm' => 1)));
    }
    // We should never get here.
    throw new moodle_exception('installing_non_installable_component', 'tool_installaddon');
}
// Handle installation of a plugin from the ZIP file.
$installzipcomponent = optional_param('installzipcomponent', null, PARAM_COMPONENT);
$installzipstorage = optional_param('installzipstorage', null, PARAM_FILE);
$installzipconfirm = optional_param('installzipconfirm', false, PARAM_BOOL);
if ($installzipcomponent and $installzipstorage) {
    require_sesskey();
    require_once $CFG->libdir . '/upgradelib.php';
    $PAGE->set_pagelayout('maintenance');
    $PAGE->set_popup_notification_allowed(false);
    $installable = array((object) array('component' => $installzipcomponent, 'zipfilepath' => make_temp_directory('tool_installaddon') . '/' . $installzipstorage . '/plugin.zip'));
    upgrade_install_plugins($installable, $installzipconfirm, get_string('installfromzip', 'tool_installaddon'), new moodle_url($installer->index_url(), array('installzipcomponent' => $installzipcomponent, 'installzipstorage' => $installzipstorage, 'installzipconfirm' => 1)));
}
$form = $installer->get_installfromzip_form();
if ($form->is_cancelled()) {
    redirect($PAGE->url);
} else {
    if ($data = $form->get_data()) {
        $storage = $installer->make_installfromzip_storage();
        $form->save_file('zipfile', $storage . '/plugin.zip');
        $ziprootdir = $pluginman->get_plugin_zip_root_dir($storage . '/plugin.zip');
        if (empty($ziprootdir)) {
            echo $output->zip_not_valid_plugin_package_page($installer->index_url());
            die;
        }
        $component = $installer->detect_plugin_component($storage . '/plugin.zip');
        if (!empty($component) and !empty($data->plugintype)) {