$id = optional_param('id', '', PARAM_ALPHANUM);
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
- $agreelicence = optional_param('agreelicence',0, PARAM_BOOL);
+ $confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
+ $agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
+ $autopilot = optional_param('autopilot', 0, PARAM_BOOL);
$ignoreupgradewarning = optional_param('ignoreupgradewarning', 0, PARAM_BOOL);
/// check upgrade status first
}
upgrade_check_running("Upgrade already running in this session, please wait!<br />Click on the exclamation marks to ignore this warning (<a href=\"index.php?ignoreupgradewarning=1\">!!!</a>).", 10);
+/// set install/upgrade autocontinue session flag
+ if ($autopilot) {
+ $_SESSION['installautopilot'] = $autopilot;
+ }
+
/// Check some PHP server settings
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
}
}
}
-
- $linktoscrolltoerrors = '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>';
if (! $maintables) {
/// hide errors from headers in case debug enabled in config.php
$origdebug = $CFG->debug;
$CFG->debug = DEBUG_MINIMAL;
error_reporting($CFG->debug);
- if (empty($agreelicence)) {
+ if (empty($agreelicense)) {
$strlicense = get_string('license');
print_header($strlicense, $strlicense, $strlicense, "", "", false, " ", " ");
print_heading("<a href=\"http://moodle.org\">Moodle</a> - Modular Object-Oriented Dynamic Learning Environment");
print_heading(get_string('copyrightnotice'));
print_box(text_to_html(get_string('gpl')), 'copyrightnotice');
echo "<br />";
- notice_yesno(get_string('doyouagree'), "index.php?agreelicence=true",
+ notice_yesno(get_string('doyouagree'), "index.php?agreelicense=1",
"http://docs.moodle.org/en/License");
exit;
}
+ if (empty($confirmrelease)) {
+ $strcurrentrelease = get_string("currentrelease");
+ print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
+ print_heading("Moodle $release");
+ print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
+ echo '<form action="index.php"><fieldset class="invisiblefieldset">';
+ echo '<input type="hidden" name="agreelicense" value="1" />';
+ echo '<input type="hidden" name="confirmrelease" value="1" />';
+ echo '</fieldset>';
+ echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
+ echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
+ echo '</form>';
+ print_footer('none');
+ die;
+ }
$strdatabasesetup = get_string("databasesetup");
$strdatabasesuccess = get_string("databasesuccess");
print_header($strdatabasesetup, $strdatabasesetup, $strdatabasesetup,
- "", $linktoscrolltoerrors, false, " ", " ");
+ "", upgrade_get_javascript(), false, " ", " ");
/// return to original debugging level
$CFG->debug = $origdebug;
error_reporting($CFG->debug);
}
if (empty($confirmupgrade)) {
-
-
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
"", "", false, " ", " ");
- notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php');
+ notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
exit;
+ } else if (empty($confirmrelease)){
+ $strcurrentrelease = get_string("currentrelease");
+ print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
+ print_heading("Moodle $release");
+ print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
+ echo '<form action="index.php"><fieldset class="invisiblefieldset">';
+ echo '<input type="hidden" name="confirmupgrade" value="1" />';
+ echo '<input type="hidden" name="confirmrelease" value="1" />';
+ echo '</fieldset>';
+ echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="0" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
+ echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
+ echo '</form>';
+ print_footer('none');
+ die;
} else {
$strdatabasesuccess = get_string("databasesuccess");
print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
- "", $linktoscrolltoerrors, false, " ", " ");
+ "", upgrade_get_javascript(), false, " ", " ");
/// return to original debugging level
$CFG->debug = $origdebug;
/// Updated human-readable release version if necessary
if ($release <> $CFG->release) { // Update the release version
- $strcurrentrelease = get_string("currentrelease");
- print_header($strcurrentrelease, $strcurrentrelease, $strcurrentrelease, "", "", false, " ", " ");
- print_heading("Moodle $release");
if (!set_config("release", $release)) {
notify("ERROR: Could not update release version in database!!");
}
- notice(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'), 'index.php', 'none');
}
/// Find and check all main modules and load them up or upgrade them if necessary
/// just make sure upgrade logging is properly terminated
upgrade_log_finish();
+ unset($_SESSION['installautopilot']);
+
/// Set up the blank site - to be customized later at the end of install.
if (! $site = get_site()) {
// We are about to create the site "course"
if (empty($CFG->backup_version)) { // Backup has never been installed.
$strdatabaseupgrades = get_string("databaseupgrades");
print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, "",
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, " ", " ");
+ upgrade_get_javascript(), false, " ", " ");
upgrade_log_start();
print_heading('backup');
if ($backup_version > $CFG->backup_version) { // Upgrade tables
$strdatabaseupgrades = get_string("databaseupgrades");
- print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>');
+ print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', upgrade_get_javascript());
upgrade_log_start();
print_heading('backup');
$strdatabaseupgrades = get_string('databaseupgrades');
print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, " ", " ");
+ upgrade_get_javascript(), false, " ", " ");
upgrade_log_start();
print_heading('group');
if ($group_version > $CFG->group_version) { // Upgrade tables
$strdatabaseupgrades = get_string('databaseupgrades');
- print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>');
+ print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', upgrade_get_javascript());
upgrade_log_start();
print_heading('group');
$string['timezoneisforcedto'] = 'Force all users to use';
$string['timezonenotforced'] = 'Users can choose their own timezone';
$string['tokenizerrecommended'] = 'Installing the optional PHP Tokenizer extension is recommended -- it improves Moodle Networking functionality.';
+$string['unattendedoperation'] = 'Unattended operation';
$string['unbookmarkthispage'] = 'unbookmark this page';
$string['unicodeupgradenotice'] = 'In Moodle 1.6 we have migrated all languages to Unicode. To complete the upgrade for this site, you need to convert all the data in your database to Unicode (UTF-8) using our migration script. <a href=\"utfdbmigrate.php\">Click here to run the migration script now</a>!';
$string['unicoderecommended'] = 'Storing all your data in Unicode (UTF-8) is recommended. New installations should be performed into databases that have their default character set as Unicode. If you are upgrading, you should perform the UTF-8 migration process (see the Admin page).';
$info->requiremoodle = $plugin->requires;
if (!$updated_plugins) {
print_header($strpluginsetup, $strpluginsetup, $strpluginsetup, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, ' ', ' ');
+ upgrade_get_javascript(), false, ' ', ' ');
}
upgrade_log_start();
notify(get_string('pluginrequirementsnotmet', 'error', $info));
} else if ($CFG->$pluginversion < $plugin->version) {
if (!$updated_plugins) {
print_header($strpluginsetup, $strpluginsetup, $strpluginsetup, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, ' ', ' ');
+ upgrade_get_javascript(), false, ' ', ' ');
}
$updated_plugins = true;
upgrade_log_start();
$info->requiremoodle = $module->requires;
if (!$updated_modules) {
print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, ' ', ' ');
+ upgrade_get_javascript(), false, ' ', ' ');
}
upgrade_log_start();
notify(get_string('modulerequirementsnotmet', 'error', $info));
}
if (!$updated_modules) {
print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, ' ', ' ');
+ upgrade_get_javascript(), false, ' ', ' ');
}
upgrade_log_start();
print_heading($module->name .' module needs upgrading');
} else { // module not installed yet, so install it
if (!$updated_modules) {
print_header($strmodulesetup, $strmodulesetup, $strmodulesetup, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, ' ', ' ');
+ upgrade_get_javascript(), false, ' ', ' ');
}
upgrade_log_start();
print_heading($module->name);
}
}
+function upgrade_get_javascript() {
+ global $CFG;
+
+ if (!empty($_SESSION['installautopilot'])) {
+ $linktoscrolltoerrors = '<script type="text/javascript">var installautopilot = true;</script>'."\n";
+ } else {
+ $linktoscrolltoerrors = '<script type="text/javascript">var installautopilot = false;</script>'."\n";
+ }
+ $linktoscrolltoerrors .= '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>';
+
+ return $linktoscrolltoerrors;
+}
////////////////////////////////////////////////
/// upgrade logging functions
////////////////////////////////////////////////
if (empty($CFG->blocks_version)) { // Blocks have never been installed.
$strdatabaseupgrades = get_string('databaseupgrades');
print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, ' ', ' ');
+ upgrade_get_javascript(), false, ' ', ' ');
upgrade_log_start();
print_heading('blocks');
if ($blocks_version > $CFG->blocks_version) { // Upgrade tables
$strdatabaseupgrades = get_string('databaseupgrades');
- print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>');
+ print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', upgrade_get_javascript());
upgrade_log_start();
print_heading('blocks');
if (empty($updated_blocks)) {
$strblocksetup = get_string('blocksetup');
print_header($strblocksetup, $strblocksetup, $strblocksetup, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, ' ', ' ');
+ upgrade_get_javascript(), false, ' ', ' ');
}
$updated_blocks = true;
upgrade_log_start();
if (empty($updated_blocks)) {
$strblocksetup = get_string('blocksetup');
print_header($strblocksetup, $strblocksetup, $strblocksetup, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
- false, ' ', ' ');
+ upgrade_get_javascript(), false, ' ', ' ');
}
$updated_blocks = true;
upgrade_log_start();
if ($local_version > $CFG->local_version) { // upgrade!
$strdatabaseupgrades = get_string('databaseupgrades');
- print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '',
- '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>');
+ print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', upgrade_get_javascript());
upgrade_log_start();
require_once ($CFG->dirroot .'/local/db/upgrade.php');
warnings[warnings.length] = continueBtn; // then add the continue button to the array
var link;
+ var statusOk = false;
for (var i = 0; i < n; ++i) {
// add a "next" link to all warnings except the last one on the page
if (i < n - 1) {
link = createWarningSkipLink('Scroll to the continue button', 0);
p.appendChild(document.createTextNode('No warnings - '));
p.className = 'notifysuccess';
+ statusOk = true;
}
p.appendChild(link);
contentDiv.insertBefore(p, contentDiv.firstChild);
// automatically scroll to the first warning or continue button
initScroll(warnings[0]);
+ if (statusOk && installautopilot) {//global JS variable
+ document.forms[0].submit();//auto submit
+ }
};
// load should be a document event, but most browsers use window