mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
MDL-10275 moving all installation time environment tests into /admin/index.php - this will simplify install.php a LOT and will make installation/upgrade more consistent + fixed a bug in enviroment if docroot not set
This commit is contained in:
parent
cd3acbf27e
commit
9050958240
@ -102,6 +102,9 @@
|
||||
$CFG->debug = DEBUG_MINIMAL;
|
||||
error_reporting($CFG->debug);
|
||||
|
||||
/// fake some settings
|
||||
$CFG->docroot = 'http://docs.moodle.org';
|
||||
|
||||
/// remove current session content completely
|
||||
session_get_instance()->terminate_current();
|
||||
|
||||
@ -116,15 +119,25 @@
|
||||
notice_yesno(get_string('doyouagree'), "index.php?agreelicense=1&lang=$CFG->lang",
|
||||
"http://docs.moodle.org/en/License");
|
||||
print_footer('none');
|
||||
exit;
|
||||
die;
|
||||
}
|
||||
if (empty($confirmrelease)) {
|
||||
$strcurrentrelease = get_string("currentrelease");
|
||||
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'generalbox boxaligncenter boxwidthwide');
|
||||
print_continue("index.php?agreelicense=1&confirmrelease=1&lang=$CFG->lang");
|
||||
$releasenoteslink = get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes');
|
||||
$releasenoteslink = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $releasenoteslink); // extremely ugly validation hack
|
||||
print_box($releasenoteslink, 'generalbox boxaligncenter boxwidthwide');
|
||||
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
if (!check_moodle_environment($release, $environment_results, true)) {
|
||||
print_upgrade_reload("index.php?agreelicense=1&lang=$CFG->lang");
|
||||
} else {
|
||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||
print_continue("index.php?agreelicense=1confirmrelease=1&lang=$CFG->lang");
|
||||
}
|
||||
|
||||
print_footer('none');
|
||||
die;
|
||||
}
|
||||
@ -209,22 +222,18 @@
|
||||
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
||||
print_heading("Moodle $release");
|
||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
|
||||
$releasenoteslink = get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes');
|
||||
$releasenoteslink = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $releasenoteslink); // extremely ugly validation hack
|
||||
print_box($releasenoteslink);
|
||||
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
print_heading(get_string('environment', 'admin'));
|
||||
if (!check_moodle_environment($release, $environment_results, true)) {
|
||||
if (empty($CFG->skiplangupgrade)) {
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_string('langpackwillbeupdated', 'admin');
|
||||
print_box_end();
|
||||
}
|
||||
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
|
||||
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
|
||||
print_upgrade_reload('index.php?confirmupgrade=1');
|
||||
} else {
|
||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||
if (empty($CFG->skiplangupgrade)) {
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_box_start('generalbox', 'notice');
|
||||
print_string('langpackwillbeupdated', 'admin');
|
||||
print_box_end();
|
||||
}
|
||||
@ -239,14 +248,11 @@
|
||||
$navigation = build_navigation(array(array('name'=>$strplugincheck, 'link'=>null, 'type'=>'misc')));
|
||||
print_header($strplugincheck, $strplugincheck, $navigation, "", "", false, " ", " ");
|
||||
print_heading($strplugincheck);
|
||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||
print_box_start('generalbox', 'notice');
|
||||
print_string('pluginchecknotice');
|
||||
print_box_end();
|
||||
print_plugin_tables();
|
||||
echo "<br />";
|
||||
echo '<div class="continuebutton">';
|
||||
echo '<a href="index.php?confirmupgrade=1&confirmrelease=1" title="'.get_string('reload').'" ><img src="'.$CFG->pixpath.'/i/reload.gif" alt="" /> '.get_string('reload').'</a>';
|
||||
echo '</div><br />';
|
||||
print_upgrade_reload('index.php?confirmupgrade=1&confirmrelease=1');
|
||||
print_continue('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
|
||||
print_footer('none');
|
||||
die();
|
||||
@ -297,8 +303,8 @@
|
||||
}
|
||||
|
||||
/// upgrade all plugins types
|
||||
$plugintypes = get_plugin_types();
|
||||
try {
|
||||
$plugintypes = get_plugin_types();
|
||||
foreach ($plugintypes as $type=>$location) {
|
||||
upgrade_plugins($type, $location, 'print_upgrade_part_start', 'print_upgrade_part_end');
|
||||
}
|
||||
@ -309,6 +315,7 @@
|
||||
/// Check for changes to RPC functions
|
||||
if ($CFG->mnet_dispatcher_mode != 'off') {
|
||||
try {
|
||||
// this needs a full rewrite, sorry to mention that :-(
|
||||
require_once("$CFG->dirroot/$CFG->admin/mnet/adminlib.php");
|
||||
upgrade_RPC_functions(); // Return here afterwards
|
||||
} catch (Exception $ex) {
|
||||
|
@ -122,6 +122,8 @@ function check_moodle_environment($version, &$environment_results, $print_table=
|
||||
* @param array environment_results array of results gathered
|
||||
*/
|
||||
function print_moodle_environment($result, $environment_results) {
|
||||
global $CFG;
|
||||
|
||||
/// Get some strings
|
||||
$strname = get_string('name');
|
||||
$strinfo = get_string('info');
|
||||
@ -159,6 +161,7 @@ function print_moodle_environment($result, $environment_results) {
|
||||
foreach ($environment_results as $environment_result) {
|
||||
$errorline = false;
|
||||
$warningline = false;
|
||||
$stringtouse = '';
|
||||
if ($continue) {
|
||||
$type = $environment_result->getPart();
|
||||
$info = $environment_result->getInfo();
|
||||
@ -227,7 +230,11 @@ function print_moodle_environment($result, $environment_results) {
|
||||
if (!empty($info)){
|
||||
$linkparts[] = $info;
|
||||
}
|
||||
$report = doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec));
|
||||
if (empty($CFG->docroot)) {
|
||||
$report = get_string($stringtouse, 'admin', $rec);
|
||||
} else {
|
||||
$report = doc_link(join($linkparts, '/'), get_string($stringtouse, 'admin', $rec));
|
||||
}
|
||||
|
||||
|
||||
/// Format error or warning line
|
||||
@ -430,7 +437,6 @@ function get_environment_for_version($version) {
|
||||
* @return array array of results encapsulated in one environment_result object
|
||||
*/
|
||||
function environment_check($version) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
/// Normalize the version requested
|
||||
@ -439,7 +445,7 @@ function environment_check($version) {
|
||||
$results = array(); //To store all the results
|
||||
|
||||
/// Only run the moodle versions checker on upgrade, not on install
|
||||
if (empty($CFG->running_installer)) {
|
||||
if (!empty($CFG->version)) {
|
||||
$results[] = environment_check_moodle($version);
|
||||
}
|
||||
$results[] = environment_check_unicode($version);
|
||||
|
@ -817,6 +817,15 @@ function upgrade_setup_debug($starting) {
|
||||
}
|
||||
}
|
||||
|
||||
function print_upgrade_reload($url) {
|
||||
global $CFG;
|
||||
|
||||
echo "<br />";
|
||||
echo '<div class="continuebutton">';
|
||||
echo '<a href="'.$url.'" title="'.get_string('reload').'" ><img src="'.$CFG->pixpath.'/i/reload.gif" alt="" /> '.get_string('reload').'</a>';
|
||||
echo '</div><br />';
|
||||
}
|
||||
|
||||
function print_upgrade_separator() {
|
||||
if (!CLI_SCRIPT) {
|
||||
echo '<hr />';
|
||||
|
Loading…
x
Reference in New Issue
Block a user