mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +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
3 changed files with 43 additions and 21 deletions
|
@ -102,6 +102,9 @@
|
||||||
$CFG->debug = DEBUG_MINIMAL;
|
$CFG->debug = DEBUG_MINIMAL;
|
||||||
error_reporting($CFG->debug);
|
error_reporting($CFG->debug);
|
||||||
|
|
||||||
|
/// fake some settings
|
||||||
|
$CFG->docroot = 'http://docs.moodle.org';
|
||||||
|
|
||||||
/// remove current session content completely
|
/// remove current session content completely
|
||||||
session_get_instance()->terminate_current();
|
session_get_instance()->terminate_current();
|
||||||
|
|
||||||
|
@ -116,15 +119,25 @@
|
||||||
notice_yesno(get_string('doyouagree'), "index.php?agreelicense=1&lang=$CFG->lang",
|
notice_yesno(get_string('doyouagree'), "index.php?agreelicense=1&lang=$CFG->lang",
|
||||||
"http://docs.moodle.org/en/License");
|
"http://docs.moodle.org/en/License");
|
||||||
print_footer('none');
|
print_footer('none');
|
||||||
exit;
|
die;
|
||||||
}
|
}
|
||||||
if (empty($confirmrelease)) {
|
if (empty($confirmrelease)) {
|
||||||
$strcurrentrelease = get_string("currentrelease");
|
$strcurrentrelease = get_string("currentrelease");
|
||||||
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
||||||
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
||||||
print_heading("Moodle $release");
|
print_heading("Moodle $release");
|
||||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'generalbox boxaligncenter boxwidthwide');
|
$releasenoteslink = get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes');
|
||||||
print_continue("index.php?agreelicense=1&confirmrelease=1&lang=$CFG->lang");
|
$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');
|
print_footer('none');
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
@ -209,22 +222,18 @@
|
||||||
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
||||||
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
||||||
print_heading("Moodle $release");
|
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');
|
require_once($CFG->libdir.'/environmentlib.php');
|
||||||
print_heading(get_string('environment', 'admin'));
|
print_heading(get_string('environment', 'admin'));
|
||||||
if (!check_moodle_environment($release, $environment_results, true)) {
|
if (!check_moodle_environment($release, $environment_results, true)) {
|
||||||
if (empty($CFG->skiplangupgrade)) {
|
print_upgrade_reload('index.php?confirmupgrade=1');
|
||||||
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');
|
|
||||||
} else {
|
} else {
|
||||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||||
if (empty($CFG->skiplangupgrade)) {
|
if (empty($CFG->skiplangupgrade)) {
|
||||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
print_box_start('generalbox', 'notice');
|
||||||
print_string('langpackwillbeupdated', 'admin');
|
print_string('langpackwillbeupdated', 'admin');
|
||||||
print_box_end();
|
print_box_end();
|
||||||
}
|
}
|
||||||
|
@ -239,14 +248,11 @@
|
||||||
$navigation = build_navigation(array(array('name'=>$strplugincheck, 'link'=>null, 'type'=>'misc')));
|
$navigation = build_navigation(array(array('name'=>$strplugincheck, 'link'=>null, 'type'=>'misc')));
|
||||||
print_header($strplugincheck, $strplugincheck, $navigation, "", "", false, " ", " ");
|
print_header($strplugincheck, $strplugincheck, $navigation, "", "", false, " ", " ");
|
||||||
print_heading($strplugincheck);
|
print_heading($strplugincheck);
|
||||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
print_box_start('generalbox', 'notice');
|
||||||
print_string('pluginchecknotice');
|
print_string('pluginchecknotice');
|
||||||
print_box_end();
|
print_box_end();
|
||||||
print_plugin_tables();
|
print_plugin_tables();
|
||||||
echo "<br />";
|
print_upgrade_reload('index.php?confirmupgrade=1&confirmrelease=1');
|
||||||
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_continue('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
|
print_continue('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
|
||||||
print_footer('none');
|
print_footer('none');
|
||||||
die();
|
die();
|
||||||
|
@ -297,8 +303,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/// upgrade all plugins types
|
/// upgrade all plugins types
|
||||||
$plugintypes = get_plugin_types();
|
|
||||||
try {
|
try {
|
||||||
|
$plugintypes = get_plugin_types();
|
||||||
foreach ($plugintypes as $type=>$location) {
|
foreach ($plugintypes as $type=>$location) {
|
||||||
upgrade_plugins($type, $location, 'print_upgrade_part_start', 'print_upgrade_part_end');
|
upgrade_plugins($type, $location, 'print_upgrade_part_start', 'print_upgrade_part_end');
|
||||||
}
|
}
|
||||||
|
@ -309,6 +315,7 @@
|
||||||
/// Check for changes to RPC functions
|
/// Check for changes to RPC functions
|
||||||
if ($CFG->mnet_dispatcher_mode != 'off') {
|
if ($CFG->mnet_dispatcher_mode != 'off') {
|
||||||
try {
|
try {
|
||||||
|
// this needs a full rewrite, sorry to mention that :-(
|
||||||
require_once("$CFG->dirroot/$CFG->admin/mnet/adminlib.php");
|
require_once("$CFG->dirroot/$CFG->admin/mnet/adminlib.php");
|
||||||
upgrade_RPC_functions(); // Return here afterwards
|
upgrade_RPC_functions(); // Return here afterwards
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
|
|
|
@ -122,6 +122,8 @@ function check_moodle_environment($version, &$environment_results, $print_table=
|
||||||
* @param array environment_results array of results gathered
|
* @param array environment_results array of results gathered
|
||||||
*/
|
*/
|
||||||
function print_moodle_environment($result, $environment_results) {
|
function print_moodle_environment($result, $environment_results) {
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
/// Get some strings
|
/// Get some strings
|
||||||
$strname = get_string('name');
|
$strname = get_string('name');
|
||||||
$strinfo = get_string('info');
|
$strinfo = get_string('info');
|
||||||
|
@ -159,6 +161,7 @@ function print_moodle_environment($result, $environment_results) {
|
||||||
foreach ($environment_results as $environment_result) {
|
foreach ($environment_results as $environment_result) {
|
||||||
$errorline = false;
|
$errorline = false;
|
||||||
$warningline = false;
|
$warningline = false;
|
||||||
|
$stringtouse = '';
|
||||||
if ($continue) {
|
if ($continue) {
|
||||||
$type = $environment_result->getPart();
|
$type = $environment_result->getPart();
|
||||||
$info = $environment_result->getInfo();
|
$info = $environment_result->getInfo();
|
||||||
|
@ -227,7 +230,11 @@ function print_moodle_environment($result, $environment_results) {
|
||||||
if (!empty($info)){
|
if (!empty($info)){
|
||||||
$linkparts[] = $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
|
/// 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
|
* @return array array of results encapsulated in one environment_result object
|
||||||
*/
|
*/
|
||||||
function environment_check($version) {
|
function environment_check($version) {
|
||||||
|
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
/// Normalize the version requested
|
/// Normalize the version requested
|
||||||
|
@ -439,7 +445,7 @@ function environment_check($version) {
|
||||||
$results = array(); //To store all the results
|
$results = array(); //To store all the results
|
||||||
|
|
||||||
/// Only run the moodle versions checker on upgrade, not on install
|
/// 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_moodle($version);
|
||||||
}
|
}
|
||||||
$results[] = environment_check_unicode($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() {
|
function print_upgrade_separator() {
|
||||||
if (!CLI_SCRIPT) {
|
if (!CLI_SCRIPT) {
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue