2009-05-26 09:52:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Main administration script.
|
|
|
|
*
|
|
|
|
* @package moodlecore
|
|
|
|
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
// Check that config.php exists, if not then call the install script
|
|
|
|
if (!file_exists('../config.php')) {
|
|
|
|
header('Location: ../install.php');
|
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that PHP is of a sufficient version as soon as possible
|
2009-05-26 10:21:56 +00:00
|
|
|
if (version_compare(phpversion(), '5.2.0') < 0) {
|
2009-05-26 09:56:35 +00:00
|
|
|
$phpversion = phpversion();
|
|
|
|
// do NOT localise - lang strings would not work here and we CAN NOT move it to later place
|
|
|
|
echo "Sorry, Moodle 2.0 requires PHP 5.2.8 or later (currently using version $phpversion). ";
|
|
|
|
echo "Please upgrade your server software or use latest Moodle 1.9.x instead.";
|
|
|
|
die;
|
|
|
|
}
|
|
|
|
|
|
|
|
// try to flush everything all the time
|
|
|
|
@ob_implicit_flush(true);
|
2009-06-07 08:46:13 +00:00
|
|
|
while(@ob_end_clean()); // ob_end_flush prevents sending of headers
|
2009-05-26 09:56:35 +00:00
|
|
|
|
|
|
|
require('../config.php');
|
2009-05-26 10:21:56 +00:00
|
|
|
require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions
|
|
|
|
require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions
|
2009-05-26 09:56:35 +00:00
|
|
|
|
|
|
|
$id = optional_param('id', '', PARAM_TEXT);
|
|
|
|
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
|
|
|
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
|
|
|
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
|
|
|
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
|
|
|
|
|
|
|
// Check some PHP server settings
|
|
|
|
|
2010-01-16 15:39:56 +00:00
|
|
|
$PAGE->set_url('/admin/index.php');
|
2009-07-28 04:00:33 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
|
|
|
|
|
|
|
|
if (ini_get_bool('session.auto_start')) {
|
|
|
|
print_error('phpvaroff', 'debug', '', (object)array('name'=>'session.auto_start', 'link'=>$documentationlink));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ini_get_bool('magic_quotes_runtime')) {
|
|
|
|
print_error('phpvaroff', 'debug', '', (object)array('name'=>'magic_quotes_runtime', 'link'=>$documentationlink));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ini_get_bool('file_uploads')) {
|
|
|
|
print_error('phpvaron', 'debug', '', (object)array('name'=>'file_uploads', 'link'=>$documentationlink));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_float_problem()) {
|
|
|
|
print_error('phpfloatproblem', 'admin', '', $documentationlink);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set some necessary variables during set-up to avoid PHP warnings later on this page
|
|
|
|
if (!isset($CFG->framename)) {
|
2009-05-26 10:21:56 +00:00
|
|
|
$CFG->framename = '_top';
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
|
|
|
if (!isset($CFG->release)) {
|
2009-05-26 10:21:56 +00:00
|
|
|
$CFG->release = '';
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
|
|
|
if (!isset($CFG->version)) {
|
2009-05-26 10:21:56 +00:00
|
|
|
$CFG->version = '';
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$version = null;
|
|
|
|
$release = null;
|
|
|
|
require("$CFG->dirroot/version.php"); // defines $version and $release
|
|
|
|
$CFG->target_release = $release; // used during installation and upgrades
|
|
|
|
|
|
|
|
if (!$version or !$release) {
|
|
|
|
print_error('withoutversion', 'debug'); // without version, stop
|
|
|
|
}
|
|
|
|
|
|
|
|
// Turn off xmlstrictheaders during upgrade.
|
|
|
|
$origxmlstrictheaders = !empty($CFG->xmlstrictheaders);
|
|
|
|
$CFG->xmlstrictheaders = false;
|
|
|
|
|
2009-05-26 17:44:25 +00:00
|
|
|
if (!core_tables_exist()) {
|
2009-12-16 18:00:58 +00:00
|
|
|
$PAGE->set_pagelayout('maintenance');
|
2009-05-26 09:56:35 +00:00
|
|
|
|
|
|
|
// fake some settings
|
|
|
|
$CFG->docroot = 'http://docs.moodle.org';
|
|
|
|
|
|
|
|
$strinstallation = get_string('installation', 'install');
|
|
|
|
|
|
|
|
// remove current session content completely
|
|
|
|
session_get_instance()->terminate_current();
|
|
|
|
|
|
|
|
if (empty($agreelicense)) {
|
|
|
|
$strlicense = get_string('license');
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->navbar->add($strlicense);
|
|
|
|
$PAGE->set_title($strinstallation.' - Moodle '.$CFG->target_release);
|
|
|
|
$PAGE->set_heading($strinstallation);
|
|
|
|
$PAGE->set_cacheable(false);
|
|
|
|
echo $OUTPUT->header();
|
2009-08-06 08:17:12 +00:00
|
|
|
echo $OUTPUT->heading('<a href="http://moodle.org">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment');
|
|
|
|
echo $OUTPUT->heading(get_string('copyrightnotice'));
|
2010-01-25 09:40:05 +00:00
|
|
|
$copyrightnotice = text_to_html(get_string('gpl3'));
|
2009-05-26 09:56:35 +00:00
|
|
|
$copyrightnotice = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $copyrightnotice); // extremely ugly validation hack
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box($copyrightnotice, 'copyrightnotice');
|
2009-05-26 10:21:56 +00:00
|
|
|
echo '<br />';
|
2010-08-28 14:22:26 +00:00
|
|
|
$continue = new single_button(new moodle_url('/admin/index.php', array('lang'=>$CFG->lang, 'agreelicense'=>1)), get_string('continue'), 'get');
|
|
|
|
echo $OUTPUT->confirm(get_string('doyouagree'), $continue, "http://docs.moodle.org/en/License");
|
2009-08-06 14:12:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2006-07-20 06:39:48 +00:00
|
|
|
die;
|
|
|
|
}
|
2009-05-26 09:56:35 +00:00
|
|
|
if (empty($confirmrelease)) {
|
2009-05-26 10:21:56 +00:00
|
|
|
$strcurrentrelease = get_string('currentrelease');
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->navbar->add($strcurrentrelease);
|
|
|
|
$PAGE->set_title($strinstallation.' - Moodle '.$CFG->target_release);
|
|
|
|
$PAGE->set_heading($strinstallation);
|
|
|
|
$PAGE->set_cacheable(false);
|
|
|
|
echo $OUTPUT->header();
|
2009-08-06 08:17:12 +00:00
|
|
|
echo $OUTPUT->heading("Moodle $release");
|
2009-05-26 09:56:35 +00:00
|
|
|
$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
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box($releasenoteslink, 'generalbox boxaligncenter boxwidthwide');
|
2009-05-26 09:56:35 +00:00
|
|
|
|
|
|
|
require_once($CFG->libdir.'/environmentlib.php');
|
|
|
|
if (!check_moodle_environment($release, $environment_results, true, ENV_SELECT_RELEASE)) {
|
|
|
|
print_upgrade_reload("index.php?agreelicense=1&lang=$CFG->lang");
|
|
|
|
} else {
|
2009-08-18 04:28:40 +00:00
|
|
|
echo $OUTPUT->notification(get_string('environmentok', 'admin'), 'notifysuccess');
|
2010-08-28 14:22:26 +00:00
|
|
|
echo $OUTPUT->continue_button(new moodle_url('/admin/index.php', array('agreelicense'=>1, 'confirmrelease'=>1, 'lang'=>$CFG->lang)));
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
2006-07-20 06:39:48 +00:00
|
|
|
|
2009-08-06 14:12:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2009-05-26 09:56:35 +00:00
|
|
|
die;
|
2003-05-26 14:38:41 +00:00
|
|
|
}
|
|
|
|
|
2009-05-26 10:21:56 +00:00
|
|
|
$strdatabasesetup = get_string('databasesetup');
|
2010-01-20 18:07:49 +00:00
|
|
|
upgrade_init_javascript();
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->navbar->add($strdatabasesetup);
|
|
|
|
$PAGE->set_title($strinstallation.' - Moodle '.$CFG->target_release);
|
2009-09-03 08:02:59 +00:00
|
|
|
$PAGE->set_heading($strinstallation);
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->set_cacheable(false);
|
|
|
|
echo $OUTPUT->header();
|
2007-01-22 22:32:00 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
if (!$DB->setup_is_unicodedb()) {
|
|
|
|
if (!$DB->change_db_encoding()) {
|
|
|
|
// If could not convert successfully, throw error, and prevent installation
|
|
|
|
print_error('unicoderequired', 'admin');
|
2009-01-11 11:19:52 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-01 12:52:30 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
install_core($version, true);
|
|
|
|
}
|
2009-01-11 11:19:52 +00:00
|
|
|
|
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
// Check version of Moodle code on disk compared with database
|
|
|
|
// and upgrade if possible.
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
$stradministration = get_string('administration');
|
|
|
|
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
if (empty($CFG->version)) {
|
|
|
|
print_error('missingconfigversion', 'debug');
|
|
|
|
}
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
if ($version > $CFG->version) { // upgrade
|
2009-12-16 18:00:58 +00:00
|
|
|
$PAGE->set_pagelayout('maintenance');
|
2009-07-09 07:35:03 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
$a->oldversion = "$CFG->release ($CFG->version)";
|
|
|
|
$a->newversion = "$release ($version)";
|
2009-05-26 10:21:56 +00:00
|
|
|
$strdatabasechecking = get_string('databasechecking', '', $a);
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
if (empty($confirmupgrade)) {
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->navbar->add($strdatabasechecking);
|
|
|
|
$PAGE->set_title($strdatabasechecking);
|
2009-09-03 08:05:42 +00:00
|
|
|
$PAGE->set_heading($stradministration);
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->set_cacheable(false);
|
|
|
|
echo $OUTPUT->header();
|
2010-01-03 20:54:36 +00:00
|
|
|
$continueurl = new moodle_url('index.php', array('confirmupgrade' => 1));
|
|
|
|
$cancelurl = new moodle_url('index.php');
|
|
|
|
echo $OUTPUT->confirm(get_string('upgradesure', 'admin', $a->newversion), $continueurl, $cancelurl);
|
2009-08-06 14:12:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2009-05-26 09:56:35 +00:00
|
|
|
exit;
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
} else if (empty($confirmrelease)){
|
2009-05-26 10:21:56 +00:00
|
|
|
$strcurrentrelease = get_string('currentrelease');
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->navbar->add($strcurrentrelease);
|
|
|
|
$PAGE->set_title($strcurrentrelease);
|
2009-09-03 08:05:42 +00:00
|
|
|
$PAGE->set_heading($strcurrentrelease);
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->set_cacheable(false);
|
|
|
|
echo $OUTPUT->header();
|
2009-08-06 08:17:12 +00:00
|
|
|
echo $OUTPUT->heading("Moodle $release");
|
2009-05-26 09:56:35 +00:00
|
|
|
$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
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box($releasenoteslink);
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
require_once($CFG->libdir.'/environmentlib.php');
|
|
|
|
if (!check_moodle_environment($release, $environment_results, true, ENV_SELECT_RELEASE)) {
|
|
|
|
print_upgrade_reload('index.php?confirmupgrade=1');
|
2009-01-11 11:19:52 +00:00
|
|
|
} else {
|
2009-08-18 04:28:40 +00:00
|
|
|
echo $OUTPUT->notification(get_string('environmentok', 'admin'), 'notifysuccess');
|
2009-05-26 09:56:35 +00:00
|
|
|
if (empty($CFG->skiplangupgrade)) {
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box_start('generalbox', 'notice');
|
2009-05-26 09:56:35 +00:00
|
|
|
print_string('langpackwillbeupdated', 'admin');
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box_end();
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
2009-08-18 04:28:40 +00:00
|
|
|
echo $OUTPUT->continue_button('index.php?confirmupgrade=1&confirmrelease=1');
|
2009-01-11 11:19:52 +00:00
|
|
|
}
|
|
|
|
|
2009-08-06 14:12:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2009-05-26 09:56:35 +00:00
|
|
|
die;
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
} elseif (empty($confirmplugins)) {
|
|
|
|
$strplugincheck = get_string('plugincheck');
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->navbar->add($strplugincheck);
|
|
|
|
$PAGE->set_title($strplugincheck);
|
2009-09-03 08:05:42 +00:00
|
|
|
$PAGE->set_heading($strplugincheck);
|
2009-09-03 05:11:33 +00:00
|
|
|
$PAGE->set_cacheable(false);
|
|
|
|
echo $OUTPUT->header();
|
2009-08-06 08:17:12 +00:00
|
|
|
echo $OUTPUT->heading($strplugincheck);
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box_start('generalbox', 'notice');
|
2009-05-26 09:56:35 +00:00
|
|
|
print_string('pluginchecknotice');
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box_end();
|
2009-05-26 09:56:35 +00:00
|
|
|
print_plugin_tables();
|
|
|
|
print_upgrade_reload('index.php?confirmupgrade=1&confirmrelease=1');
|
2009-08-18 04:28:40 +00:00
|
|
|
echo $OUTPUT->continue_button('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
|
2009-08-06 14:12:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2009-05-26 09:56:35 +00:00
|
|
|
die();
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
} else {
|
|
|
|
// Launch main upgrade
|
|
|
|
upgrade_core($version, true);
|
2009-01-29 22:54:41 +00:00
|
|
|
}
|
2009-05-26 09:56:35 +00:00
|
|
|
} else if ($version < $CFG->version) {
|
2010-09-05 19:16:42 +00:00
|
|
|
// better stop here, we can not continue with plugin upgrades or anything else
|
|
|
|
throw new moodle_exception('downgradedcore', 'error', new moodle_url('/admin/'));
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Updated human-readable release version if necessary
|
|
|
|
if ($release <> $CFG->release) { // Update the release version
|
2009-05-26 10:21:56 +00:00
|
|
|
set_config('release', $release);
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// upgrade all plugins and other parts
|
|
|
|
upgrade_noncore(true);
|
|
|
|
|
2009-06-24 09:17:56 +00:00
|
|
|
// If this is the first install, indicate that this site is fully configured
|
|
|
|
// except the admin password
|
|
|
|
if (during_initial_install()) {
|
|
|
|
set_config('rolesactive', 1); // after this, during_initial_install will return false.
|
2009-05-26 09:56:35 +00:00
|
|
|
set_config('adminsetuppending', 1);
|
|
|
|
// we neeed this redirect to setup proper session
|
|
|
|
upgrade_finished("index.php?sessionstarted=1&lang=$CFG->lang");
|
|
|
|
}
|
|
|
|
|
|
|
|
// make sure admin user is created - this is the last step because we need
|
|
|
|
// session to be working properly in order to edit admin account
|
|
|
|
if (!empty($CFG->adminsetuppending)) {
|
|
|
|
$sessionstarted = optional_param('sessionstarted', 0, PARAM_BOOL);
|
|
|
|
if (!$sessionstarted) {
|
|
|
|
redirect("index.php?sessionstarted=1&lang=$CFG->lang");
|
|
|
|
} else {
|
|
|
|
$sessionverify = optional_param('sessionverify', 0, PARAM_BOOL);
|
|
|
|
if (!$sessionverify) {
|
|
|
|
$SESSION->sessionverify = 1;
|
|
|
|
redirect("index.php?sessionstarted=1&sessionverify=1&lang=$CFG->lang");
|
2009-01-29 22:54:41 +00:00
|
|
|
} else {
|
2009-05-26 09:56:35 +00:00
|
|
|
if (empty($SESSION->sessionverify)) {
|
|
|
|
print_error('installsessionerror', 'admin', "index.php?sessionstarted=1&lang=$CFG->lang");
|
2009-01-29 22:54:41 +00:00
|
|
|
}
|
2009-05-26 09:56:35 +00:00
|
|
|
unset($SESSION->sessionverify);
|
2009-01-29 22:54:41 +00:00
|
|
|
}
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
2009-01-29 22:54:41 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
$adminuser = get_complete_user_data('username', 'admin');
|
2009-01-29 22:54:41 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
if ($adminuser->password === 'adminsetuppending') {
|
|
|
|
// prevent installation hijacking
|
|
|
|
if ($adminuser->lastip !== getremoteaddr()) {
|
|
|
|
print_error('installhijacked', 'admin');
|
2009-01-17 20:25:58 +00:00
|
|
|
}
|
2009-05-26 09:56:35 +00:00
|
|
|
// login user and let him set password and admin details
|
|
|
|
$adminuser->newadminuser = 1;
|
|
|
|
message_set_default_message_preferences($adminuser);
|
|
|
|
complete_user_login($adminuser, false);
|
|
|
|
redirect("$CFG->wwwroot/user/editadvanced.php?id=$adminuser->id"); // Edit thyself
|
2009-01-11 11:19:52 +00:00
|
|
|
|
2009-01-12 15:13:44 +00:00
|
|
|
} else {
|
2009-05-26 09:56:35 +00:00
|
|
|
unset_config('adminsetuppending');
|
2004-02-05 09:55:50 +00:00
|
|
|
}
|
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
} else {
|
|
|
|
// just make sure upgrade logging is properly terminated
|
|
|
|
upgrade_finished('upgradesettings.php');
|
|
|
|
}
|
2008-07-07 14:34:40 +00:00
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
// Turn xmlstrictheaders back on now.
|
|
|
|
$CFG->xmlstrictheaders = $origxmlstrictheaders;
|
|
|
|
unset($origxmlstrictheaders);
|
|
|
|
|
|
|
|
// Check for valid admin user - no guest autologin
|
|
|
|
require_login(0, false);
|
|
|
|
$context = get_context_instance(CONTEXT_SYSTEM);
|
|
|
|
require_capability('moodle/site:config', $context);
|
|
|
|
|
|
|
|
// check that site is properly customized
|
|
|
|
$site = get_site();
|
|
|
|
if (empty($site->shortname)) {
|
|
|
|
// probably new installation - lets return to frontpage after this step
|
|
|
|
// remove settings that we want uninitialised
|
|
|
|
unset_config('registerauth');
|
|
|
|
redirect('upgradesettings.php?return=site');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
|
|
|
|
if (!empty($id) and $id == $CFG->siteidentifier) {
|
|
|
|
set_config('registered', time());
|
|
|
|
}
|
|
|
|
|
|
|
|
// setup critical warnings before printing admin tree block
|
2009-05-26 10:21:56 +00:00
|
|
|
$insecuredataroot = is_dataroot_insecure(true);
|
2009-05-26 09:56:35 +00:00
|
|
|
$SESSION->admin_critical_warning = ($insecuredataroot==INSECURE_DATAROOT_ERROR);
|
|
|
|
|
|
|
|
$adminroot = admin_get_root();
|
|
|
|
|
|
|
|
// Check if there are any new admin settings which have still yet to be set
|
|
|
|
if (any_new_admin_settings($adminroot)){
|
|
|
|
redirect('upgradesettings.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Everything should now be set up, and the user is an admin
|
|
|
|
|
|
|
|
// Print default admin page with notifications.
|
|
|
|
admin_externalpage_setup('adminnotifications');
|
2010-03-31 08:05:53 +00:00
|
|
|
echo $OUTPUT->header();
|
2009-05-26 09:56:35 +00:00
|
|
|
|
|
|
|
if ($insecuredataroot == INSECURE_DATAROOT_WARNING) {
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
|
2009-05-26 09:56:35 +00:00
|
|
|
} else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box(get_string('datarootsecurityerror', 'admin', $CFG->dataroot), 'generalbox adminerror');
|
2009-05-26 09:56:35 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defined('WARN_DISPLAY_ERRORS_ENABLED')) {
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box(get_string('displayerrorswarning', 'admin'), 'generalbox adminwarning');
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// If no recently cron run
|
|
|
|
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
|
|
|
|
if (time() - $lastcron > 3600 * 24) {
|
2010-06-28 14:37:03 +00:00
|
|
|
$helpbutton = $OUTPUT->help_icon('cron', 'admin');
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box(get_string('cronwarning', 'admin').' '.$helpbutton, 'generalbox adminwarning');
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
|
|
|
|
2009-10-30 07:25:50 +00:00
|
|
|
// Hidden bloglevel upgrade
|
|
|
|
$showbloglevelupgrade = ($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL) && empty($CFG->bloglevel_upgrade_complete);
|
|
|
|
if ($showbloglevelupgrade) {
|
|
|
|
echo $OUTPUT->box(get_string('bloglevelupgradenotice', 'admin'), 'generalbox adminwarning');
|
|
|
|
}
|
|
|
|
|
2010-08-18 16:47:00 +00:00
|
|
|
// diagnose DB, especially the sloppy MyISAM tables
|
|
|
|
$diagnose = $DB->diagnose();
|
|
|
|
if ($diagnose !== NULL) {
|
|
|
|
echo $OUTPUT->box($diagnose, 'generalbox adminwarning');
|
|
|
|
}
|
|
|
|
|
2009-05-26 09:56:35 +00:00
|
|
|
// Alert if we are currently in maintenance mode
|
2009-05-31 14:42:29 +00:00
|
|
|
if (!empty($CFG->maintenance_enabled)) {
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box(get_string('sitemaintenancewarning2', 'admin', "$CFG->wwwroot/$CFG->admin/settings.php?section=maintenancemode"), 'generalbox adminwarning');
|
2009-05-26 09:56:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
|
|
|
|
$copyrighttext = '<a href="http://moodle.org/">Moodle</a> '.
|
|
|
|
'<a href="http://docs.moodle.org/en/Release" title="'.$CFG->version.'">'.$CFG->release.'</a><br />'.
|
|
|
|
'Copyright © 1999 onwards, Martin Dougiamas<br />'.
|
|
|
|
'and <a href="http://docs.moodle.org/en/Credits">many other contributors</a>.<br />'.
|
|
|
|
'<a href="http://docs.moodle.org/en/License">GNU Public License</a>';
|
2009-08-10 04:53:22 +00:00
|
|
|
echo $OUTPUT->box($copyrighttext, 'copyright');
|
2009-05-26 09:56:35 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-08-06 14:12:46 +00:00
|
|
|
echo $OUTPUT->footer();
|
2002-09-19 12:01:55 +00:00
|
|
|
|