mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-16002 rewritten upgrade locking and better upgrade progress tracking; MDL-16070 Do not use $a[0] syntax in lang packs + various other upgrade improvements and fixes
This commit is contained in:
parent
9deded341e
commit
775f811a66
@ -33,7 +33,7 @@ if ($frm = data_submitted() and confirm_sesskey()) {
|
|||||||
$plugin = "auth/$auth";
|
$plugin = "auth/$auth";
|
||||||
$name = $matches[1];
|
$name = $matches[1];
|
||||||
if (!set_config($name, $value, $plugin)) {
|
if (!set_config($name, $value, $plugin)) {
|
||||||
print_error("cannotsaveconfig", 'error', '', array($name, $value, $plugin));
|
print_error("cannotsaveconfig", 'error', '', (object)array('name'=>$name, 'value'=>$value, 'plugin'=>$plugin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -819,9 +819,6 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
|
|||||||
|
|
||||||
$DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
|
$DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
|
||||||
|
|
||||||
// all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
|
|
||||||
set_config('unicodedb', 1);
|
|
||||||
|
|
||||||
/// Continue with the instalation
|
/// Continue with the instalation
|
||||||
|
|
||||||
// Install the roles system.
|
// Install the roles system.
|
||||||
@ -868,12 +865,6 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
|
|||||||
if ($CFG->version) {
|
if ($CFG->version) {
|
||||||
if ($version > $CFG->version) { // upgrade
|
if ($version > $CFG->version) { // upgrade
|
||||||
|
|
||||||
/// If the database is not already Unicode then we do not allow upgrading!
|
|
||||||
/// Instead, we print an error telling them to upgrade to 1.7 first. MDL-6857
|
|
||||||
if (empty($CFG->unicodedb)) {
|
|
||||||
console_write(STDERR,'unicodeupgradeerror', 'error');
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->oldversion = "$CFG->release ($CFG->version)";
|
$a->oldversion = "$CFG->release ($CFG->version)";
|
||||||
$a->newversion = "$release ($version)";
|
$a->newversion = "$release ($version)";
|
||||||
$strdatabasechecking = get_string("databasechecking", "", $a);
|
$strdatabasechecking = get_string("databasechecking", "", $a);
|
||||||
|
332
admin/index.php
332
admin/index.php
@ -14,30 +14,20 @@
|
|||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Turn off time limits and try to flush everything all the time, sometimes upgrades can be slow.
|
/// try to flush everything all the time
|
||||||
|
|
||||||
@set_time_limit(0);
|
|
||||||
@ob_implicit_flush(true);
|
@ob_implicit_flush(true);
|
||||||
while(@ob_end_clean()); // ob_end_flush prevents sending of headers
|
while(@ob_end_clean()); // ob_end_flush prevents sending of headers
|
||||||
|
|
||||||
|
|
||||||
require_once('../config.php');
|
require('../config.php');
|
||||||
require_once($CFG->libdir.'/adminlib.php'); // Contains various admin-only functions
|
require_once($CFG->libdir.'/adminlib.php'); // Contains various admin-only functions
|
||||||
require_once($CFG->libdir.'/db/upgradelib.php'); // Upgrade-related functions
|
|
||||||
|
|
||||||
$id = optional_param('id', '', PARAM_TEXT);
|
$id = optional_param('id', '', PARAM_TEXT);
|
||||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||||
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
||||||
|
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
||||||
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
||||||
$autopilot = optional_param('autopilot', 0, PARAM_BOOL);
|
$autopilot = optional_param('autopilot', 0, PARAM_BOOL);
|
||||||
$ignoreupgradewarning = optional_param('ignoreupgradewarning', 0, PARAM_BOOL);
|
|
||||||
$confirmplugincheck = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
|
||||||
|
|
||||||
/// check upgrade status first
|
|
||||||
if ($ignoreupgradewarning) {
|
|
||||||
$SESSION->upgraderunning = 0;
|
|
||||||
}
|
|
||||||
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
|
/// set install/upgrade autocontinue session flag
|
||||||
if ($autopilot) {
|
if ($autopilot) {
|
||||||
@ -49,15 +39,15 @@
|
|||||||
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
|
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
|
||||||
|
|
||||||
if (ini_get_bool('session.auto_start')) {
|
if (ini_get_bool('session.auto_start')) {
|
||||||
print_error('phpvaroff', 'debug', '', array('session.auto_start', $documentationlink));
|
print_error('phpvaroff', 'debug', '', (object)array('name'=>'session.auto_start', 'link'=>$documentationlink));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ini_get_bool('magic_quotes_runtime')) {
|
if (ini_get_bool('magic_quotes_runtime')) {
|
||||||
print_error('phpvaroff', 'debug', '', array('magic_quotes_runtime', $documentationlink));
|
print_error('phpvaroff', 'debug', '', (object)array('name'=>'magic_quotes_runtime', 'link'=>$documentationlink));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ini_get_bool('file_uploads')) {
|
if (!ini_get_bool('file_uploads')) {
|
||||||
print_error('phpvaron', 'debug', '', array('file_uploads', $documentationlink));
|
print_error('phpvaron', 'debug', '', (object)array('name'=>'file_uploads', 'link'=>$documentationlink));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check that config.php has been edited
|
/// Check that config.php has been edited
|
||||||
@ -71,7 +61,7 @@
|
|||||||
|
|
||||||
$dirroot = dirname(realpath("../index.php"));
|
$dirroot = dirname(realpath("../index.php"));
|
||||||
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
|
if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
|
||||||
print_error('fixsetting', 'debug', '', array($CFG->dirroot, $dirroot));
|
print_error('fixsetting', 'debug', '', (object)array('current'=>$CFG->dirroot, 'found'=>$dirroot));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set some necessary variables during set-up to avoid PHP warnings later on this page
|
/// Set some necessary variables during set-up to avoid PHP warnings later on this page
|
||||||
@ -85,9 +75,9 @@
|
|||||||
$CFG->version = "";
|
$CFG->version = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_readable("$CFG->dirroot/version.php")) {
|
$version = null;
|
||||||
include_once("$CFG->dirroot/version.php"); // defines $version
|
$release = null;
|
||||||
}
|
include("$CFG->dirroot/version.php"); // defines $version and $release
|
||||||
|
|
||||||
if (!$version or !$release) {
|
if (!$version or !$release) {
|
||||||
print_error('withoutversion', 'debug'); // without version, stop
|
print_error('withoutversion', 'debug'); // without version, stop
|
||||||
@ -99,9 +89,7 @@
|
|||||||
|
|
||||||
} else { // Check for missing main tables
|
} else { // Check for missing main tables
|
||||||
$maintables = true;
|
$maintables = true;
|
||||||
$mtables = array("config", "course", "course_categories", "course_modules",
|
$mtables = array('config', 'course', 'groupings'); // some tables used in 1.9 and 2.0, preferable something from the start and end of install.xml
|
||||||
"course_sections", "log", "log_display", "modules",
|
|
||||||
"user");
|
|
||||||
foreach ($mtables as $mtable) {
|
foreach ($mtables as $mtable) {
|
||||||
if (!in_array($mtable, $tables)) {
|
if (!in_array($mtable, $tables)) {
|
||||||
$maintables = false;
|
$maintables = false;
|
||||||
@ -109,8 +97,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unset($mtables);
|
||||||
|
unset($tables);
|
||||||
|
|
||||||
if (! $maintables) {
|
if (!$maintables) {
|
||||||
/// hide errors from headers in case debug enabled in config.php
|
/// hide errors from headers in case debug enabled in config.php
|
||||||
$origdebug = $CFG->debug;
|
$origdebug = $CFG->debug;
|
||||||
$CFG->debug = DEBUG_MINIMAL;
|
$CFG->debug = DEBUG_MINIMAL;
|
||||||
@ -156,9 +146,6 @@
|
|||||||
upgrade_log_start();
|
upgrade_log_start();
|
||||||
$DB->set_debug(true);
|
$DB->set_debug(true);
|
||||||
|
|
||||||
/// Both old .sql files and new install.xml are supported
|
|
||||||
/// But we prioritise install.xml (XMLDB) if present
|
|
||||||
|
|
||||||
if (!$DB->setup_is_unicodedb()) {
|
if (!$DB->setup_is_unicodedb()) {
|
||||||
if (!$DB->change_db_encoding()) {
|
if (!$DB->change_db_encoding()) {
|
||||||
// If could not convert successfully, throw error, and prevent installation
|
// If could not convert successfully, throw error, and prevent installation
|
||||||
@ -166,15 +153,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
|
$DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
|
||||||
|
|
||||||
// all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
|
|
||||||
set_config('unicodedb', 1);
|
|
||||||
|
|
||||||
/// Continue with the instalation
|
/// Continue with the instalation
|
||||||
$DB->set_debug(false);
|
|
||||||
|
|
||||||
/// Groups install is now in core above.
|
|
||||||
|
|
||||||
// Install the roles system.
|
// Install the roles system.
|
||||||
moodle_install_roles();
|
moodle_install_roles();
|
||||||
@ -183,7 +164,6 @@
|
|||||||
events_update_definition();
|
events_update_definition();
|
||||||
|
|
||||||
// Install core message providers
|
// Install core message providers
|
||||||
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
|
||||||
message_update_providers();
|
message_update_providers();
|
||||||
|
|
||||||
/// This is used to handle any settings that must exist in $CFG but which do not exist in
|
/// This is used to handle any settings that must exist in $CFG but which do not exist in
|
||||||
@ -201,175 +181,180 @@
|
|||||||
// (this should only have any effect during initial install).
|
// (this should only have any effect during initial install).
|
||||||
admin_apply_default_settings(NULL, true);
|
admin_apply_default_settings(NULL, true);
|
||||||
|
|
||||||
notify($strdatabasesuccess, "green");
|
// store main version
|
||||||
|
if (!set_config('version', $version)) {
|
||||||
|
print_error('cannotupdateversion', 'debug');
|
||||||
|
}
|
||||||
|
|
||||||
|
notify($strdatabasesuccess, 'notifysuccess');
|
||||||
|
|
||||||
|
/// do not show certificates in log ;-)
|
||||||
|
$DB->set_debug(false);
|
||||||
|
|
||||||
|
// hack - set up mnet
|
||||||
require_once $CFG->dirroot.'/mnet/lib.php';
|
require_once $CFG->dirroot.'/mnet/lib.php';
|
||||||
|
|
||||||
print_continue('index.php');
|
print_continue('index.php');
|
||||||
print_footer('none');
|
print_footer('none');
|
||||||
|
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Check version of Moodle code on disk compared with database
|
/// Check version of Moodle code on disk compared with database
|
||||||
/// and upgrade if possible.
|
/// and upgrade if possible.
|
||||||
require_once("$CFG->dirroot/lib/db/upgrade.php"); # defines new upgrades
|
|
||||||
|
|
||||||
$stradministration = get_string("administration");
|
$stradministration = get_string('administration');
|
||||||
|
|
||||||
if ($CFG->version) {
|
if (empty($CFG->version)) {
|
||||||
if ($version > $CFG->version) { // upgrade
|
print_error('missingconfigversion', 'debug');
|
||||||
|
}
|
||||||
|
|
||||||
/// If the database is not already Unicode then we do not allow upgrading!
|
if ($version > $CFG->version) { // upgrade
|
||||||
/// Instead, we print an error telling them to upgrade to 1.7 first. MDL-6857
|
|
||||||
if (empty($CFG->unicodedb)) {
|
|
||||||
print_error('unicodeupgradeerror', 'error', '', $version);
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->oldversion = "$CFG->release ($CFG->version)";
|
require_once($CFG->libdir.'/db/upgrade.php'); // Defines upgrades
|
||||||
$a->newversion = "$release ($version)";
|
require_once($CFG->libdir.'/db/upgradelib.php'); // Upgrade-related functions
|
||||||
$strdatabasechecking = get_string("databasechecking", "", $a);
|
|
||||||
|
|
||||||
// hide errors from headers in case debug is enabled
|
$a->oldversion = "$CFG->release ($CFG->version)";
|
||||||
$origdebug = $CFG->debug;
|
$a->newversion = "$release ($version)";
|
||||||
$CFG->debug = DEBUG_MINIMAL;
|
$strdatabasechecking = get_string("databasechecking", "", $a);
|
||||||
error_reporting($CFG->debug);
|
|
||||||
|
|
||||||
// logo ut in case we are upgrading from pre 1.9 version in order to prevent
|
// hide errors from headers in case debug is enabled
|
||||||
// weird session/role problems caused by incorrect data in USER and SESSION
|
$origdebug = $CFG->debug;
|
||||||
if ($CFG->version < 2007101500) {
|
$CFG->debug = DEBUG_MINIMAL;
|
||||||
require_logout();
|
error_reporting($CFG->debug);
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($confirmupgrade)) {
|
// logo ut in case we are upgrading from pre 1.9 version in order to prevent
|
||||||
$navigation = build_navigation(array(array('name'=>$strdatabasechecking, 'link'=>null, 'type'=>'misc')));
|
// weird session/role problems caused by incorrect data in USER and SESSION
|
||||||
print_header($strdatabasechecking, $stradministration, $navigation,
|
if ($CFG->version < 2007101500) {
|
||||||
"", "", false, " ", " ");
|
require_logout();
|
||||||
|
}
|
||||||
|
|
||||||
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
|
if (empty($confirmupgrade)) {
|
||||||
print_footer('none');
|
$navigation = build_navigation(array(array('name'=>$strdatabasechecking, 'link'=>null, 'type'=>'misc')));
|
||||||
exit;
|
print_header($strdatabasechecking, $stradministration, $navigation,
|
||||||
|
"", "", false, " ", " ");
|
||||||
|
|
||||||
} else if (empty($confirmrelease)){
|
notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
|
||||||
$strcurrentrelease = get_string("currentrelease");
|
print_footer('none');
|
||||||
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
exit;
|
||||||
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
|
||||||
print_heading("Moodle $release");
|
|
||||||
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
|
|
||||||
|
|
||||||
require_once($CFG->libdir.'/environmentlib.php');
|
} else if (empty($confirmrelease)){
|
||||||
print_heading(get_string('environment', 'admin'));
|
$strcurrentrelease = get_string("currentrelease");
|
||||||
if (!check_moodle_environment($release, $environment_results, true)) {
|
$navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
|
||||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, " ", " ");
|
||||||
print_string('langpackwillbeupdated', 'admin');
|
print_heading("Moodle $release");
|
||||||
print_box_end();
|
print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
|
||||||
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
|
|
||||||
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
|
|
||||||
} else {
|
|
||||||
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
|
||||||
print_box_start('generalbox', 'notice'); // MDL-8330
|
|
||||||
print_string('langpackwillbeupdated', 'admin');
|
|
||||||
print_box_end();
|
|
||||||
echo '<form action="index.php"><div>';
|
|
||||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
|
||||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div class="continuebutton">';
|
|
||||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
|
||||||
echo '</form>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print_footer('none');
|
require_once($CFG->libdir.'/environmentlib.php');
|
||||||
die;
|
print_heading(get_string('environment', 'admin'));
|
||||||
} elseif (empty($confirmplugincheck)) {
|
if (!check_moodle_environment($release, $environment_results, true)) {
|
||||||
$strplugincheck = get_string('plugincheck');
|
|
||||||
$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'); // MDL-8330
|
||||||
print_string('pluginchecknotice');
|
print_string('langpackwillbeupdated', 'admin');
|
||||||
|
print_box_end();
|
||||||
|
notice_yesno(get_string('environmenterrorupgrade', 'admin'),
|
||||||
|
'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
|
||||||
|
} else {
|
||||||
|
notify(get_string('environmentok', 'admin'), 'notifysuccess');
|
||||||
|
print_box_start('generalbox', 'notice'); // MDL-8330
|
||||||
|
print_string('langpackwillbeupdated', 'admin');
|
||||||
print_box_end();
|
print_box_end();
|
||||||
print_plugin_tables();
|
|
||||||
echo "<br />";
|
|
||||||
echo '<div class="continuebutton">';
|
|
||||||
print_single_button('index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1), get_string('reload'), 'get');
|
|
||||||
echo '</div><br />';
|
|
||||||
echo '<form action="index.php"><div>';
|
echo '<form action="index.php"><div>';
|
||||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||||
echo '<input type="hidden" name="confirmplugincheck" value="1" />';
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
echo '<div class="continuebutton">';
|
||||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
print_footer('none');
|
|
||||||
die();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$strdatabasesuccess = get_string("databasesuccess");
|
|
||||||
$navigation = build_navigation(array(array('name'=>$strdatabasesuccess, 'link'=>null, 'type'=>'misc')));
|
|
||||||
print_header($strdatabasechecking, $stradministration, $navigation,
|
|
||||||
"", upgrade_get_javascript(), false, " ", " ");
|
|
||||||
|
|
||||||
/// return to original debugging level
|
|
||||||
$CFG->debug = $origdebug;
|
|
||||||
error_reporting($CFG->debug);
|
|
||||||
upgrade_log_start();
|
|
||||||
|
|
||||||
/// Upgrade current language pack if we can
|
|
||||||
upgrade_language_pack();
|
|
||||||
|
|
||||||
print_heading($strdatabasechecking);
|
|
||||||
$DB->set_debug(true);
|
|
||||||
/// Launch the old main upgrade (if exists)
|
|
||||||
$status = true;
|
|
||||||
if (function_exists('main_upgrade')) {
|
|
||||||
$status = main_upgrade($CFG->version);
|
|
||||||
}
|
|
||||||
/// If succesful and exists launch the new main upgrade (XMLDB), called xmldb_main_upgrade
|
|
||||||
if ($status && function_exists('xmldb_main_upgrade')) {
|
|
||||||
$status = xmldb_main_upgrade($CFG->version);
|
|
||||||
}
|
|
||||||
$DB->set_debug(false);
|
|
||||||
/// If successful, continue upgrading roles and setting everything properly
|
|
||||||
if ($status) {
|
|
||||||
if (!update_capabilities()) {
|
|
||||||
print_error('cannotupgradecapabilities', 'debug');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update core events
|
|
||||||
events_update_definition();
|
|
||||||
|
|
||||||
// Update core message providers
|
|
||||||
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
|
||||||
message_update_providers();
|
|
||||||
|
|
||||||
if (set_config("version", $version)) {
|
|
||||||
remove_dir($CFG->dataroot . '/cache', true); // flush cache
|
|
||||||
notify($strdatabasesuccess, "green");
|
|
||||||
print_continue("upgradesettings.php");
|
|
||||||
print_footer('none');
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
print_error('cannotupdateversion', 'debug');
|
|
||||||
}
|
|
||||||
/// Main upgrade not success
|
|
||||||
} else {
|
|
||||||
notify('Main Upgrade failed! See lib/db/upgrade.php');
|
|
||||||
print_continue('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
|
|
||||||
print_footer('none');
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
upgrade_log_finish();
|
|
||||||
}
|
}
|
||||||
} else if ($version < $CFG->version) {
|
|
||||||
|
print_footer('none');
|
||||||
|
die;
|
||||||
|
} elseif (empty($confirmplugins)) {
|
||||||
|
$strplugincheck = get_string('plugincheck');
|
||||||
|
$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_string('pluginchecknotice');
|
||||||
|
print_box_end();
|
||||||
|
print_plugin_tables();
|
||||||
|
echo "<br />";
|
||||||
|
echo '<div class="continuebutton">';
|
||||||
|
print_single_button('index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1), get_string('reload'), 'get');
|
||||||
|
echo '</div><br />';
|
||||||
|
echo '<form action="index.php"><div>';
|
||||||
|
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||||
|
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||||
|
echo '<input type="hidden" name="confirmplugincheck" value="1" />';
|
||||||
|
echo '</div>';
|
||||||
|
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();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$strdatabasesuccess = get_string("databasesuccess");
|
||||||
|
$navigation = build_navigation(array(array('name'=>$strdatabasesuccess, 'link'=>null, 'type'=>'misc')));
|
||||||
|
print_header($strdatabasechecking, $stradministration, $navigation,
|
||||||
|
"", upgrade_get_javascript(), false, " ", " ");
|
||||||
|
|
||||||
|
/// return to original debugging level
|
||||||
|
$CFG->debug = $origdebug;
|
||||||
|
error_reporting($CFG->debug);
|
||||||
upgrade_log_start();
|
upgrade_log_start();
|
||||||
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
|
|
||||||
|
/// Upgrade current language pack if we can
|
||||||
|
upgrade_language_pack();
|
||||||
|
|
||||||
|
print_heading($strdatabasechecking);
|
||||||
|
$DB->set_debug(true);
|
||||||
|
/// Launch the old main upgrade (if exists)
|
||||||
|
$status = true;
|
||||||
|
if (function_exists('main_upgrade')) {
|
||||||
|
$status = main_upgrade($CFG->version);
|
||||||
|
}
|
||||||
|
/// If succesful and exists launch the new main upgrade (XMLDB), called xmldb_main_upgrade
|
||||||
|
if ($status && function_exists('xmldb_main_upgrade')) {
|
||||||
|
$status = xmldb_main_upgrade($CFG->version);
|
||||||
|
}
|
||||||
|
$DB->set_debug(false);
|
||||||
|
/// If successful, continue upgrading roles and setting everything properly
|
||||||
|
if ($status) {
|
||||||
|
if (!update_capabilities()) {
|
||||||
|
print_error('cannotupgradecapabilities', 'debug');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update core events
|
||||||
|
events_update_definition();
|
||||||
|
|
||||||
|
// Update core message providers
|
||||||
|
message_update_providers();
|
||||||
|
|
||||||
|
if (set_config("version", $version)) {
|
||||||
|
remove_dir($CFG->dataroot . '/cache', true); // flush cache
|
||||||
|
notify($strdatabasesuccess, "green");
|
||||||
|
print_continue("upgradesettings.php");
|
||||||
|
print_footer('none');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
print_error('cannotupdateversion', 'debug');
|
||||||
|
}
|
||||||
|
/// Main upgrade not success
|
||||||
|
} else {
|
||||||
|
notify('Main Upgrade failed! See lib/db/upgrade.php');
|
||||||
|
print_continue('index.php?confirmupgrade=1&confirmrelease=1&confirmplugincheck=1');
|
||||||
|
print_footer('none');
|
||||||
|
die;
|
||||||
|
}
|
||||||
upgrade_log_finish();
|
upgrade_log_finish();
|
||||||
}
|
}
|
||||||
} else {
|
} else if ($version < $CFG->version) {
|
||||||
if (!set_config("version", $version)) {
|
upgrade_log_start();
|
||||||
print_error('cannotupdateversion', 'debug');
|
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
|
||||||
}
|
upgrade_log_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Updated human-readable release version if necessary
|
/// Updated human-readable release version if necessary
|
||||||
@ -380,9 +365,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Groups install/upgrade is now in core above.
|
|
||||||
|
|
||||||
|
|
||||||
/// Find and check all main modules and load them up or upgrade them if necessary
|
/// Find and check all main modules and load them up or upgrade them if necessary
|
||||||
/// first old *.php update and then the new upgrade.php script
|
/// first old *.php update and then the new upgrade.php script
|
||||||
upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||||
|
@ -404,7 +404,7 @@
|
|||||||
if ($location || $plugin) {
|
if ($location || $plugin) {
|
||||||
// file in an extra location
|
// file in an extra location
|
||||||
if ($currentfile != "{$prefix}{$plugin}.php") {
|
if ($currentfile != "{$prefix}{$plugin}.php") {
|
||||||
print_error('filemismatch', 'error', '', array($currectfile, $prefix, $plugin));
|
print_error('filemismatch', 'error', '', (object)array('current'=>$currectfile, 'file'=>$prefix.$plugin.'.php'));
|
||||||
}
|
}
|
||||||
if (!$uselocal) {
|
if (!$uselocal) {
|
||||||
notify($streditingnoncorelangfile);
|
notify($streditingnoncorelangfile);
|
||||||
@ -413,7 +413,7 @@
|
|||||||
} else {
|
} else {
|
||||||
// file in standard location
|
// file in standard location
|
||||||
if ($currentfile != $filename) {
|
if ($currentfile != $filename) {
|
||||||
print_error('filemismatch', 'error', '', array($currectfile, $filename, ''));
|
print_error('filemismatch', 'error', '', (object)array('current'=>$currectfile, 'file'=>$filename.'.php'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +467,7 @@
|
|||||||
if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
|
if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
|
||||||
notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
|
notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
|
||||||
} else {
|
} else {
|
||||||
print_error('cannotsavefile', 'error', 'lang.php?mode=compare&currentfile=$currentfile', array($saveinto, $currentfile));
|
print_error('cannotsavefile', 'error', 'lang.php?mode=compare&currentfile=$currentfile', $saveinto.'/'.$currentfile);
|
||||||
}
|
}
|
||||||
unset($packstring);
|
unset($packstring);
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
|||||||
|
|
||||||
// Completion system
|
// Completion system
|
||||||
require_once($CFG->libdir.'/completionlib.php');
|
require_once($CFG->libdir.'/completionlib.php');
|
||||||
$temp->add(new admin_setting_configcheckbox('enablecompletion',get_string('enablecompletion','completion'),get_string('configenablecompletion','completion'),COMPLETION_DISABLED));
|
$temp->add(new admin_setting_configcheckbox('enablecompletion', get_string('enablecompletion','completion'), get_string('configenablecompletion','completion'), COMPLETION_DISABLED));
|
||||||
$temp->add(new admin_setting_pickroles('progresstrackedroles',get_string('progresstrackedroles','completion'),get_string('configprogresstrackedroles','completion')));
|
$temp->add(new admin_setting_pickroles('progresstrackedroles', get_string('progresstrackedroles','completion'), get_string('configprogresstrackedroles', 'completion'), array('moodle/legacy:student')));
|
||||||
|
|
||||||
$ADMIN->add('misc', $temp);
|
$ADMIN->add('misc', $temp);
|
||||||
|
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_backup_upgrade($oldversion=0) {
|
function xmldb_backup_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_activity_modules_upgrade($oldversion=0) {
|
function xmldb_block_activity_modules_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_admin_upgrade($oldversion=0) {
|
function xmldb_block_admin_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_calendar_month_upgrade($oldversion=0) {
|
function xmldb_block_calendar_month_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_calendar_upcoming_upgrade($oldversion=0) {
|
function xmldb_block_calendar_upcoming_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_course_list_upgrade($oldversion=0) {
|
function xmldb_block_course_list_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_course_summary_upgrade($oldversion=0) {
|
function xmldb_block_course_summary_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_blocks_upgrade($oldversion=0) {
|
function xmldb_blocks_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager();
|
$dbman = $DB->get_manager();
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_news_items_upgrade($oldversion=0) {
|
function xmldb_block_news_items_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_online_users_upgrade($oldversion=0) {
|
function xmldb_block_online_users_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_participants_upgrade($oldversion=0) {
|
function xmldb_block_participants_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_recent_activity_upgrade($oldversion=0) {
|
function xmldb_block_recent_activity_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_rss_client_upgrade($oldversion=0) {
|
function xmldb_block_rss_client_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -107,12 +107,11 @@ $defaultfiletypes = "PDF,TXT,HTML,PPT,XML,DOC,HTM";
|
|||||||
if(isset($CFG->block_search_pdf_to_text_cmd)) {
|
if(isset($CFG->block_search_pdf_to_text_cmd)) {
|
||||||
p($CFG->block_search_pdf_to_text_cmd);
|
p($CFG->block_search_pdf_to_text_cmd);
|
||||||
} else {
|
} else {
|
||||||
$encoding = ($CFG->unicodedb) ? "-enc UTF-8" : "-enc ISO-8859-1" ;
|
|
||||||
if ($CFG->ostype == 'WINDOWS'){
|
if ($CFG->ostype == 'WINDOWS'){
|
||||||
p("lib/xpdf/win32/pdftotext.exe -eol dos $encoding -q");
|
p("lib/xpdf/win32/pdftotext.exe -eol dos -enc UTF-8 -q");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
p("lib/xpdf/linux/pdftotext $encoding -eol unix -q");
|
p("lib/xpdf/linux/pdftotext -enc UTF-8 -eol unix -q");
|
||||||
}
|
}
|
||||||
} ?>"/><br/><br/>
|
} ?>"/><br/><br/>
|
||||||
</td>
|
</td>
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_search_upgrade($oldversion=0) {
|
function xmldb_block_search_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_search_forums_upgrade($oldversion=0) {
|
function xmldb_block_search_forums_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_section_links_upgrade($oldversion=0) {
|
function xmldb_block_section_links_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_block_social_activities_upgrade($oldversion=0) {
|
function xmldb_block_social_activities_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -69,7 +69,7 @@ visit the admin page.
|
|||||||
|
|
||||||
The function must look like:
|
The function must look like:
|
||||||
|
|
||||||
function xmldb_format_yourformat_upgrade($oldversion=0) {
|
function xmldb_format_yourformat_upgrade($oldversion) {
|
||||||
...
|
...
|
||||||
|
|
||||||
* yourformat/version.php
|
* yourformat/version.php
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_enrol_authorize_upgrade($oldversion=0) {
|
function xmldb_enrol_authorize_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_enrol_paypal_upgrade($oldversion=0) {
|
function xmldb_enrol_paypal_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -733,6 +733,7 @@ $string['upgradesure'] = 'Your Moodle files have been changed, and you are about
|
|||||||
Once you do this you can not go back again. <br /><br />
|
Once you do this you can not go back again. <br /><br />
|
||||||
Please note that this process can take a long time. <br /><br />
|
Please note that this process can take a long time. <br /><br />
|
||||||
Are you sure you want to upgrade this server to this version?';
|
Are you sure you want to upgrade this server to this version?';
|
||||||
|
$string['upgradetimedout'] = 'Upgrade timed out, please restart the upgrade.';
|
||||||
$string['upgradingdata'] = 'Upgrading data';
|
$string['upgradingdata'] = 'Upgrading data';
|
||||||
$string['upgradinglogs'] = 'Upgrading logs';
|
$string['upgradinglogs'] = 'Upgrading logs';
|
||||||
$string['uploaduserspreview'] = 'Upload users preview';
|
$string['uploaduserspreview'] = 'Upload users preview';
|
||||||
|
@ -29,9 +29,7 @@ $string['cannotaccesspresentsother'] = 'You are not allowed to access presets fr
|
|||||||
$string['cannotadd'] = 'Can not add entries!';
|
$string['cannotadd'] = 'Can not add entries!';
|
||||||
$string['cannotdeletepreset'] = 'Error deleting a preset!';
|
$string['cannotdeletepreset'] = 'Error deleting a preset!';
|
||||||
$string['cannotrate'] = 'Rating of items not allowed!';
|
$string['cannotrate'] = 'Rating of items not allowed!';
|
||||||
$string['cannotupdaterate'] = 'Could not update an old rating ($a[0] = $a[1])';
|
|
||||||
$string['cannotunziptopreset'] = 'Cannot unzip to the preset directory';
|
$string['cannotunziptopreset'] = 'Cannot unzip to the preset directory';
|
||||||
$string['cannotinsertrate'] = 'Could not insert a new rating ($a[0] = $a[1])';
|
|
||||||
$string['cannotinsertempty'] = 'Could not make an empty record!';
|
$string['cannotinsertempty'] = 'Could not make an empty record!';
|
||||||
$string['cancel'] = 'Cancel';
|
$string['cancel'] = 'Cancel';
|
||||||
$string['checkbox'] = 'Checkbox';
|
$string['checkbox'] = 'Checkbox';
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
* debug information for developer only
|
* debug information for developer only
|
||||||
*/
|
*/
|
||||||
$string['authpluginnotfound'] = 'Authentication plugin $a not found.';
|
$string['authpluginnotfound'] = 'Authentication plugin $a not found.';
|
||||||
|
$string['blocknotexist'] = '$a block doesn\'t exist';
|
||||||
$string['cannotbenull'] = '$a cannot be null!';
|
$string['cannotbenull'] = '$a cannot be null!';
|
||||||
$string['cannotcreateadminuser'] = 'SERIOUS ERROR: Could not create admin user record !!!';
|
$string['cannotcreateadminuser'] = 'SERIOUS ERROR: Could not create admin user record !!!';
|
||||||
$string['cannotdowngrade'] = 'Cannot downgrade from $a[0] to $a[1].';
|
$string['cannotdowngrade'] = 'Cannot downgrade from $a->oldversion to $a->newversion.';
|
||||||
$string['cannotinitpage'] = 'Cannot fully initialize page: invalid $a[0] id $a[1]';
|
$string['cannotinitpage'] = 'Cannot fully initialize page: invalid $a->name id $a->id';
|
||||||
$string['cannotupgradecapabilities'] = 'Had trouble upgrading the core capabilities for the Roles System';
|
$string['cannotupgradecapabilities'] = 'Had trouble upgrading the core capabilities for the Roles System';
|
||||||
$string['cannotupdateversion'] = 'Upgrade failed! (Could not update version in config table)';
|
$string['cannotupdateversion'] = 'Upgrade failed! (Could not update version in config table)';
|
||||||
$string['cannotupdaterelease'] = 'ERROR: Could not update release version in database!!';
|
$string['cannotupdaterelease'] = 'ERROR: Could not update release version in database!!';
|
||||||
@ -21,9 +22,10 @@ $string['dbnotsupport'] = 'Error: Your database ($a) is not yet fully supported
|
|||||||
$string['dbnotsetup'] = 'Error: Main databases NOT set up successfully';
|
$string['dbnotsetup'] = 'Error: Main databases NOT set up successfully';
|
||||||
$string['doesnotworkwitholdversion'] = 'This script does not work with this old version of Moodle';
|
$string['doesnotworkwitholdversion'] = 'This script does not work with this old version of Moodle';
|
||||||
$string['erroroccur'] = 'An error has occurred during this process';
|
$string['erroroccur'] = 'An error has occurred during this process';
|
||||||
$string['fixsetting'] = 'Please fix your settings in config.php: <p>You have:</p> <p>\$CFG->dirroot = \"$a[0]\";</p> <p>but it should be:</p> <p>\$CFG->dirroot = \"$a[1]\"</p>';
|
$string['fixsetting'] = 'Please fix your settings in config.php: <p>You have:</p> <p>\$CFG->dirroot = \"$a->current\";</p> <p>but it should be:</p> <p>\$CFG->dirroot = \"$a->found\"</p>';
|
||||||
$string['invalideventdata'] = 'Incorrect eventadata submitted: $a';
|
$string['invalideventdata'] = 'Incorrect eventadata submitted: $a';
|
||||||
$string['invalidarraysize'] = 'Incorrect size of arrays in params of $a';
|
$string['invalidarraysize'] = 'Incorrect size of arrays in params of $a';
|
||||||
|
$string['missingconfigversion'] = 'Config table does not contain version, can not continue, sorry.';
|
||||||
$string['mustbeoveride'] = 'Abstract $a method must be overriden.';
|
$string['mustbeoveride'] = 'Abstract $a method must be overriden.';
|
||||||
$string['morethanonerecordinfetch'] = 'Found more than one record in fetch() !';
|
$string['morethanonerecordinfetch'] = 'Found more than one record in fetch() !';
|
||||||
$string['noadminrole'] = 'No admin role could be found';
|
$string['noadminrole'] = 'No admin role could be found';
|
||||||
@ -37,16 +39,13 @@ $string['nopageclass'] = 'Imported $a but found no page classes';
|
|||||||
$string['noreports'] = 'No reports accessible';
|
$string['noreports'] = 'No reports accessible';
|
||||||
$string['nomodules'] = 'No modules found!!';
|
$string['nomodules'] = 'No modules found!!';
|
||||||
$string['modulenotexist'] = '$a module doesn\'t exist';
|
$string['modulenotexist'] = '$a module doesn\'t exist';
|
||||||
$string['phpvaroff'] = 'The PHP server variable \'$a[0]\' should be Off - $a[1]';
|
$string['phpvaroff'] = 'The PHP server variable \'$a->name\' should be Off - $a->link';
|
||||||
$string['phpvaron'] = 'The PHP server variable \'$a[0]\' is not turned On - $a[1]';
|
$string['phpvaron'] = 'The PHP server variable \'$a->name\' is not turned On - $a->link';
|
||||||
$string['prefixcannotbeempty'] = 'Table prefix \"$a[0]\" cannot be empty for your target DB ($a[1])'; // obsoleted 2.0
|
|
||||||
$string['prefixlimit'] = 'Table prefix \"$a\" maximum allowed length for Oracle DBs is 2cc.'; // obsoleted in 2.0
|
|
||||||
$string['withoutversion'] = 'Main version.php was not readable or specified';
|
|
||||||
$string['sessionmissing'] = '$a object missing from session';
|
$string['sessionmissing'] = '$a object missing from session';
|
||||||
$string['siteisnotdefined'] = 'Site is not defined!';
|
$string['siteisnotdefined'] = 'Site is not defined!';
|
||||||
$string['sqlrelyonobsoletetable'] = 'This SQL relies on obsolete table(s): $a! Your code must be fixed by a developer.';
|
$string['sqlrelyonobsoletetable'] = 'This SQL relies on obsolete table(s): $a! Your code must be fixed by a developer.';
|
||||||
$string['upgradefail'] = 'Upgrade failed! see: $a';
|
$string['upgradefail'] = 'Upgrade failed! see: $a';
|
||||||
$string['withoutversion'] = 'Main version.php was not readable or specified';
|
$string['withoutversion'] = 'Main version.php file is missing, not readable or broken.';
|
||||||
$string['xmlizeunavailable'] = 'xmlize functions are not available';
|
$string['xmlizeunavailable'] = 'xmlize functions are not available';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -8,10 +8,10 @@ $string['blockdoesnotexist'] = 'This block does not exist';
|
|||||||
$string['blockcannotinistantiate'] = 'Problem in instantiating block object';
|
$string['blockcannotinistantiate'] = 'Problem in instantiating block object';
|
||||||
$string['blockcannotread'] = 'Could not read data for blockid= $a ';
|
$string['blockcannotread'] = 'Could not read data for blockid= $a ';
|
||||||
$string['blockcannotconfig'] = 'This block does not support global configuration';
|
$string['blockcannotconfig'] = 'This block does not support global configuration';
|
||||||
$string['blocknameconflict'] = 'Naming conflict: block $a[0] has the same title with an existing block: $a[1]!';
|
$string['blocknameconflict'] = 'Naming conflict: block $a->name has the same title with an existing block: $a->conflict!';
|
||||||
$string['backupcontainexternal'] = 'This backup file contains external Moodle Network Hosts that are not configured locally';
|
$string['backupcontainexternal'] = 'This backup file contains external Moodle Network Hosts that are not configured locally';
|
||||||
$string['backuptablefail'] = 'Backup tables could NOT be set up successfully!';
|
$string['backuptablefail'] = 'Backup tables could NOT be set up successfully!';
|
||||||
$string['boundsyntaxnotsupport'] = 'Pg $1, $2 bound syntax not supported yet :-(';
|
$string['boundsyntaxnotsupport'] = 'Pg \$1, \$2 bound syntax not supported yet :-(';
|
||||||
$string['cannotassignanthing'] = 'Cannot assign moodle/site:doanything';
|
$string['cannotassignanthing'] = 'Cannot assign moodle/site:doanything';
|
||||||
$string['cannotassignrole'] = 'Cannot assign role in course';
|
$string['cannotassignrole'] = 'Cannot assign role in course';
|
||||||
$string['cannotassignselfasparent'] = 'Cannot assign self as parent!';
|
$string['cannotassignselfasparent'] = 'Cannot assign self as parent!';
|
||||||
@ -23,9 +23,9 @@ $string['cannotaddrss'] = 'You do not have permission to add rss feeds';
|
|||||||
$string['cannotaddmodule'] = '$a module could not be added to the module list!';
|
$string['cannotaddmodule'] = '$a module could not be added to the module list!';
|
||||||
$string['cannotaddnewmodule'] = 'Could not add a new module of $a';
|
$string['cannotaddnewmodule'] = 'Could not add a new module of $a';
|
||||||
$string['cannotaddnewinstance'] = 'Could not add a new instance of $a';
|
$string['cannotaddnewinstance'] = 'Could not add a new instance of $a';
|
||||||
$string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"';
|
$string['cannotsaveconfig'] = 'Problem saving config \"$a->name\" as \"$a=>value\" for plugin \"$a->plugin\"';
|
||||||
$string['cannotsavecomment'] = 'Cannot save comment';
|
$string['cannotsavecomment'] = 'Cannot save comment';
|
||||||
$string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!';
|
$string['cannotsavefile'] = 'Cannot save the file \"$a\"!';
|
||||||
$string['cannotsavedata'] = 'Cannot save data';
|
$string['cannotsavedata'] = 'Cannot save data';
|
||||||
$string['cannotsaveagreement'] = 'Could not save your agreement';
|
$string['cannotsaveagreement'] = 'Could not save your agreement';
|
||||||
$string['cannotcallscript'] = 'You cannot call this script in that way';
|
$string['cannotcallscript'] = 'You cannot call this script in that way';
|
||||||
@ -103,12 +103,11 @@ $string['cannotresetguestpwd'] = 'You cannot reset the guest password';
|
|||||||
$string['cannotresetmail'] = 'Error resetting password and mailing you';
|
$string['cannotresetmail'] = 'Error resetting password and mailing you';
|
||||||
$string['cannotsaveblock'] = 'Error saving block configuration';
|
$string['cannotsaveblock'] = 'Error saving block configuration';
|
||||||
$string['cannotsavefile'] = 'Cannot save the file \"$a\"';
|
$string['cannotsavefile'] = 'Cannot save the file \"$a\"';
|
||||||
$string['cannotinitpage'] = 'Cannot quickly initialize page, course id: $a';
|
|
||||||
$string['cannotinsertcategory'] = 'Weird error. The category was not inserted.';
|
$string['cannotinsertcategory'] = 'Weird error. The category was not inserted.';
|
||||||
$string['cannotinsertcomment'] = 'Could not insert this new comment';
|
$string['cannotinsertcomment'] = 'Could not insert this new comment';
|
||||||
$string['cannotinsertgrade'] = 'Cannot insert grade item without course id!';
|
$string['cannotinsertgrade'] = 'Cannot insert grade item without course id!';
|
||||||
$string['cannotinsertrecord'] = 'Could not insert new record ID $a';
|
$string['cannotinsertrecord'] = 'Could not insert new record ID $a';
|
||||||
$string['cannotinsertrate'] = 'Could not insert a new rating ($a[0] = $a[1])';
|
$string['cannotinsertrate'] = 'Could not insert a new rating ($a->id = $a->rating)';
|
||||||
$string['cannotinsertkey'] = 'Cannot insert new key';
|
$string['cannotinsertkey'] = 'Cannot insert new key';
|
||||||
$string['cannotsavecomment'] = 'Error while saving comment';
|
$string['cannotsavecomment'] = 'Error while saving comment';
|
||||||
$string['cannotsavemd5file'] = 'Cannot save md5 file';
|
$string['cannotsavemd5file'] = 'Cannot save md5 file';
|
||||||
@ -133,6 +132,7 @@ $string['cannotupdatecm'] = 'Could not update the course module with the correct
|
|||||||
$string['cannotupdatefield'] = 'Error updating field';
|
$string['cannotupdatefield'] = 'Error updating field';
|
||||||
$string['cannotupdatelevel'] = 'Could not update the indent level on that course module';
|
$string['cannotupdatelevel'] = 'Could not update the indent level on that course module';
|
||||||
$string['cannotupdategroup'] = 'Error updating group';
|
$string['cannotupdategroup'] = 'Error updating group';
|
||||||
|
$string['cannotupdaterate'] = 'Could not update an old rating ($a->id = $a->rating)';
|
||||||
$string['cannotupdaterecord'] = 'Could not update record ID $a';
|
$string['cannotupdaterecord'] = 'Could not update record ID $a';
|
||||||
$string['cannotupdaterole'] = 'Cannot update role!';
|
$string['cannotupdaterole'] = 'Cannot update role!';
|
||||||
$string['cannotupdatemod'] = 'Could not update $a';
|
$string['cannotupdatemod'] = 'Could not update $a';
|
||||||
@ -152,7 +152,7 @@ $string['cannotuploadfile'] = 'Error processing upload file';
|
|||||||
$string['cannotuseadmin'] = 'You need to be an admin user to use this page';
|
$string['cannotuseadmin'] = 'You need to be an admin user to use this page';
|
||||||
$string['cannotuseadminadminorteacher'] = 'You need to be a teacher or admin user to use this page';
|
$string['cannotuseadminadminorteacher'] = 'You need to be a teacher or admin user to use this page';
|
||||||
$string['cannotunassignrolefrom'] = 'Cannot unassign this user from role id: $a';
|
$string['cannotunassignrolefrom'] = 'Cannot unassign this user from role id: $a';
|
||||||
$string['cannotunassigncap'] = 'Could not unassign deprecated capability $a[0] from role $a[1]';
|
$string['cannotunassigncap'] = 'Could not unassign deprecated capability $a->cap from role $a->role';
|
||||||
$string['cannotrestoreadminorcreator'] = 'You need to be a creator or admin user to restore into new course!';
|
$string['cannotrestoreadminorcreator'] = 'You need to be a creator or admin user to restore into new course!';
|
||||||
$string['cannotrestoreadminoredit'] = 'You need to be a editing teacher or admin user to restore into selected course!';
|
$string['cannotrestoreadminoredit'] = 'You need to be a editing teacher or admin user to restore into selected course!';
|
||||||
$string['cannotusepage'] = 'Only teachers and administrators can use this page';
|
$string['cannotusepage'] = 'Only teachers and administrators can use this page';
|
||||||
@ -207,7 +207,7 @@ $string['expiredkey'] = 'Expired key';
|
|||||||
$string['failtoloadblocks'] = 'One or more blocks are registered in the database, but they all failed to load!';
|
$string['failtoloadblocks'] = 'One or more blocks are registered in the database, but they all failed to load!';
|
||||||
$string['fieldrequired'] = '\"$a\" is a required field';
|
$string['fieldrequired'] = '\"$a\" is a required field';
|
||||||
$string['filenotfound'] = 'Sorry, the requested file could not be found';
|
$string['filenotfound'] = 'Sorry, the requested file could not be found';
|
||||||
$string['filemismatch'] = 'Non-core file name mismatch. The file \"$a[0]\" should be {$a[1]}{$a[2]}.php';
|
$string['filemismatch'] = 'Non-core file name mismatch. The file \"$a->current\" should be $a->file';
|
||||||
$string['filternotinstalled'] = 'Filter $a is not currently installed';
|
$string['filternotinstalled'] = 'Filter $a is not currently installed';
|
||||||
$string['filternotactive'] = 'Filter $a is not currently active';
|
$string['filternotactive'] = 'Filter $a is not currently active';
|
||||||
$string['forumblockingtoomanyposts'] = 'You have exceeded the posting threshold set for this forum';
|
$string['forumblockingtoomanyposts'] = 'You have exceeded the posting threshold set for this forum';
|
||||||
@ -436,6 +436,7 @@ $string['usernotupdatednotexists'] = 'User not updated - does not exist';
|
|||||||
$string['updatersserror'] = 'There was an error trying to update RSS feed with id: $a';
|
$string['updatersserror'] = 'There was an error trying to update RSS feed with id: $a';
|
||||||
$string['upgradeversionfail'] = 'Upgrade of backup system failed! (Could not update version in config table.)';
|
$string['upgradeversionfail'] = 'Upgrade of backup system failed! (Could not update version in config table.)';
|
||||||
$string['upgradefail'] = 'Upgrade failed! $a';
|
$string['upgradefail'] = 'Upgrade failed! $a';
|
||||||
|
$string['upgraderunning'] = 'Site is being upgraded, please retry later.';
|
||||||
$string['younotteacher'] = 'You are not a teacher!';
|
$string['younotteacher'] = 'You are not a teacher!';
|
||||||
$string['wrongcall'] = 'This script is called wrongly';
|
$string['wrongcall'] = 'This script is called wrongly';
|
||||||
$string['wrongcontextid'] = 'Context ID was incorrect (cannot find it)';
|
$string['wrongcontextid'] = 'Context ID was incorrect (cannot find it)';
|
||||||
|
@ -37,8 +37,6 @@ $string['cannotaddsubscriber'] = 'Could not add subscriber with id $a to this fo
|
|||||||
$string['cannotremovesubscriber'] = 'Could not remove subscriber with id $a from this forum!';
|
$string['cannotremovesubscriber'] = 'Could not remove subscriber with id $a from this forum!';
|
||||||
$string['cannotfindorcreateforum'] = 'Could not find or create a main news forum for the site';
|
$string['cannotfindorcreateforum'] = 'Could not find or create a main news forum for the site';
|
||||||
$string['cannotfindfirstpost'] = 'Could not find the first post in this forum';
|
$string['cannotfindfirstpost'] = 'Could not find the first post in this forum';
|
||||||
$string['cannotupdaterate'] = 'Could not update an old rating ($a[0] = $a[1])';
|
|
||||||
$string['cannotinsertrate'] = 'Could not insert a new rating ($a[0] = $a[1])';
|
|
||||||
$string['cannottrack'] = 'Could not stop tracking that forum';
|
$string['cannottrack'] = 'Could not stop tracking that forum';
|
||||||
$string['cleanreadtime'] = 'Mark old posts as read hour';
|
$string['cleanreadtime'] = 'Mark old posts as read hour';
|
||||||
$string['completiondiscussions'] = 'User must create discussions:';
|
$string['completiondiscussions'] = 'User must create discussions:';
|
||||||
|
@ -3184,7 +3184,7 @@ function capabilities_cleanup($component, $newcapdef=NULL) {
|
|||||||
if ($roles = get_roles_with_capability($cachedcap->name)) {
|
if ($roles = get_roles_with_capability($cachedcap->name)) {
|
||||||
foreach($roles as $role) {
|
foreach($roles as $role) {
|
||||||
if (!unassign_capability($cachedcap->name, $role->id)) {
|
if (!unassign_capability($cachedcap->name, $role->id)) {
|
||||||
print_error('cannotunassigncap', '', '', array($cachedcap->name, $role->name));
|
print_error('cannotunassigncap', 'error', '', (object)array('cap'=>$cachedcap->name, 'role'=>$role->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
217
lib/adminlib.php
217
lib/adminlib.php
@ -26,20 +26,55 @@ require_once($CFG->libdir.'/xmldb/xmldb_statement.php');
|
|||||||
require_once($CFG->libdir.'/xmlize.php');
|
require_once($CFG->libdir.'/xmlize.php');
|
||||||
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
||||||
|
|
||||||
|
global $upgradeloghandle, $upgradelogbuffer;
|
||||||
|
|
||||||
|
$upgradeloghandle = false;
|
||||||
|
$upgradelogbuffer = '';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upgrade savepoint, marks end of each upgrade block.
|
||||||
|
* It stores new main version, resets upgrade timeout
|
||||||
|
* and abort upgrade if user cancels page loading.
|
||||||
|
*
|
||||||
|
* Please do not make large upgrade blocks with lots of operations,
|
||||||
|
* for example when adding tables keep only one table operation per block.
|
||||||
|
*
|
||||||
|
* @param bool $result false if upgrade step failed, true if completed
|
||||||
|
* @param string or float $version main version
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function upgrade_main_savepoint($result, $version) {
|
function upgrade_main_savepoint($result, $version) {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
if ($CFG->version >= $version) {
|
if ($CFG->version >= $version) {
|
||||||
// something really wrong is going on in main upgrade script
|
// something really wrong is going on in main upgrade script
|
||||||
print_error('cannotdowngrade', 'debug', '', array($CFG->version, $version));
|
print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$CFG->version, 'newversion'=>$version));
|
||||||
}
|
}
|
||||||
set_config('version', $version);
|
set_config('version', $version);
|
||||||
} else {
|
} else {
|
||||||
notify ("Upgrade savepoint: Error during main upgrade to version $version");
|
notify ("Upgrade savepoint: Error during main upgrade to version $version");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset upgrade timeout to default
|
||||||
|
upgrade_set_timeout();
|
||||||
|
|
||||||
|
// this is a safe place to stop upgrades if user aborts page loading
|
||||||
|
if (connection_aborted()) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module upgrade savepoint, marks end of module upgrade blocks
|
||||||
|
* It stores module version, resets upgrade timeout
|
||||||
|
* and abort upgrade if usercancels page loading.
|
||||||
|
*
|
||||||
|
* @param bool $result false if upgrade step failed, true if completed
|
||||||
|
* @param string or float $version main version
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function upgrade_mod_savepoint($result, $version, $modname) {
|
function upgrade_mod_savepoint($result, $version, $modname) {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
@ -50,13 +85,48 @@ function upgrade_mod_savepoint($result, $version, $modname) {
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
if ($module->version >= $version) {
|
if ($module->version >= $version) {
|
||||||
// something really wrong is going on in upgrade script
|
// something really wrong is going on in upgrade script
|
||||||
print_error('cannotdowngrade', 'debug', '', array($module->version, $version));
|
print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$module->version, 'newversion'=>$version));
|
||||||
}
|
}
|
||||||
$module->verions = $version;
|
$module->verions = $version;
|
||||||
$DB->update_record('modules', $module);
|
$DB->update_record('modules', $module);
|
||||||
} else {
|
} else {
|
||||||
notify ("Upgrade savepoint: Error during mod upgrade to version $version");
|
notify ("Upgrade savepoint: Error during mod upgrade to version $version");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset upgrade timeout to default
|
||||||
|
upgrade_set_timeout();
|
||||||
|
|
||||||
|
// this is a safe place to stop upgrades if user aborts page loading
|
||||||
|
if (connection_aborted()) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function upgrade_blocks_savepoint($result, $version, $blockname) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
if (!$block = $DB->get_record('block', array('name'=>$blockname))) {
|
||||||
|
print_error('blocknotexist', 'debug', '', $blockname);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
if ($block->version >= $version) {
|
||||||
|
// something really wrong is going on in upgrade script
|
||||||
|
print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$block->version, 'newversion'=>$version));
|
||||||
|
}
|
||||||
|
$block->verions = $version;
|
||||||
|
$DB->update_record('block', $block);
|
||||||
|
} else {
|
||||||
|
notify ("Upgrade savepoint: Error during mod upgrade to version $version");
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset upgrade timeout to default
|
||||||
|
upgrade_set_timeout();
|
||||||
|
|
||||||
|
// this is a safe place to stop upgrades if user aborts page loading
|
||||||
|
if (connection_aborted()) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_plugin_savepoint($result, $version, $type, $dir) {
|
function upgrade_plugin_savepoint($result, $version, $type, $dir) {
|
||||||
@ -67,10 +137,6 @@ function upgrade_backup_savepoint($result, $version) {
|
|||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_blocks_savepoint($result, $version, $type) {
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all plugin tables
|
* Delete all plugin tables
|
||||||
* @name string name of plugin, used as table prefix
|
* @name string name of plugin, used as table prefix
|
||||||
@ -382,7 +448,7 @@ function upgrade_plugins($type, $dir, $return) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
upgrade_log_start();
|
upgrade_log_start();
|
||||||
print_error('cannotdowngrade', 'debug', '', array($CFG->pluginversion, $plugin->version));
|
print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$CFG->pluginversion, 'newversion'=>$plugin->version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,14 +456,14 @@ function upgrade_plugins($type, $dir, $return) {
|
|||||||
|
|
||||||
if ($updated_plugins && !$embedded) {
|
if ($updated_plugins && !$embedded) {
|
||||||
if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
|
if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
|
||||||
print_continue($return);
|
print_continue($return);
|
||||||
print_footer('none');
|
print_footer('none');
|
||||||
die;
|
die;
|
||||||
} else if (CLI_UPGRADE && ($interactive > CLI_SEMI )) {
|
} else if (CLI_UPGRADE && ($interactive > CLI_SEMI )) {
|
||||||
console_write(STDOUT,'askcontinue');
|
console_write(STDOUT,'askcontinue');
|
||||||
if (read_boolean()){
|
if (read_boolean()){
|
||||||
return ;
|
return ;
|
||||||
}else {
|
} else {
|
||||||
console_write(STDERR,'','',false);
|
console_write(STDERR,'','',false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -517,7 +583,7 @@ function upgrade_activity_modules($return) {
|
|||||||
remove_dir($CFG->dataroot . '/cache', true); // flush cache
|
remove_dir($CFG->dataroot . '/cache', true); // flush cache
|
||||||
notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
|
notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
|
||||||
if (!defined('CLI_UPGRADE') || !CLI_UPGRADE) {
|
if (!defined('CLI_UPGRADE') || !CLI_UPGRADE) {
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notify('Upgrading '. $module->name .' from '. $currmodule->version .' to '. $module->version .' FAILED!');
|
notify('Upgrading '. $module->name .' from '. $currmodule->version .' to '. $module->version .' FAILED!');
|
||||||
@ -538,16 +604,16 @@ function upgrade_activity_modules($return) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
upgrade_log_start();
|
upgrade_log_start();
|
||||||
print_error('cannotdowngrade', 'debug', '', array($currmodule->version, $module->version));
|
print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$currmodule->version, 'newversion'=>$module->version));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // module not installed yet, so install it
|
} else { // module not installed yet, so install it
|
||||||
if (!$updated_modules) {
|
if (!$updated_modules) {
|
||||||
if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
|
if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
|
||||||
print_header($strmodulesetup, $strmodulesetup,
|
print_header($strmodulesetup, $strmodulesetup,
|
||||||
build_navigation(array(array('name' => $strmodulesetup, 'link' => null, 'type' => 'misc'))), '',
|
build_navigation(array(array('name' => $strmodulesetup, 'link' => null, 'type' => 'misc'))), '',
|
||||||
upgrade_get_javascript(), false, ' ', ' ');
|
upgrade_get_javascript(), false, ' ', ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
upgrade_log_start();
|
upgrade_log_start();
|
||||||
print_heading($module->name);
|
print_heading($module->name);
|
||||||
@ -593,7 +659,7 @@ function upgrade_activity_modules($return) {
|
|||||||
|
|
||||||
notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
|
notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
|
||||||
if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
|
if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
|
||||||
echo '<hr />';
|
echo '<hr />';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print_error('cannotaddmodule', '', '', $module->name);
|
print_error('cannotaddmodule', '', '', $module->name);
|
||||||
@ -630,9 +696,9 @@ function upgrade_activity_modules($return) {
|
|||||||
|
|
||||||
if ($updated_modules) {
|
if ($updated_modules) {
|
||||||
if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
|
if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
|
||||||
print_continue($return);
|
print_continue($return);
|
||||||
print_footer('none');
|
print_footer('none');
|
||||||
die;
|
die;
|
||||||
} else if ( CLI_UPGRADE && ($interactive > CLI_SEMI) ) {
|
} else if ( CLI_UPGRADE && ($interactive > CLI_SEMI) ) {
|
||||||
console_write(STDOUT,'askcontinue');
|
console_write(STDOUT,'askcontinue');
|
||||||
if (read_boolean()){
|
if (read_boolean()){
|
||||||
@ -794,7 +860,7 @@ function create_admin_user($user_input=NULL) {
|
|||||||
foreach ($adminroles as $adminrole) {
|
foreach ($adminroles as $adminrole) {
|
||||||
role_assign($adminrole->id, $user->id, 0, $sitecontext->id);
|
role_assign($adminrole->id, $user->id, 0, $sitecontext->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set default message preferences
|
//set default message preferences
|
||||||
if (!message_set_default_message_preferences( $user )){
|
if (!message_set_default_message_preferences( $user )){
|
||||||
print_error('cannotsavemessageprefs', 'message');
|
print_error('cannotsavemessageprefs', 'message');
|
||||||
@ -808,7 +874,7 @@ function create_admin_user($user_input=NULL) {
|
|||||||
load_all_capabilities();
|
load_all_capabilities();
|
||||||
|
|
||||||
if (!defined('CLI_UPGRADE')||!CLI_UPGRADE) {
|
if (!defined('CLI_UPGRADE')||!CLI_UPGRADE) {
|
||||||
redirect("$CFG->wwwroot/user/editadvanced.php?id=$user->id"); // Edit thyself
|
redirect("$CFG->wwwroot/user/editadvanced.php?id=$user->id"); // Edit thyself
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print_error('cannotcreateadminuser', 'debug');
|
print_error('cannotcreateadminuser', 'debug');
|
||||||
@ -819,28 +885,38 @@ function create_admin_user($user_input=NULL) {
|
|||||||
/// upgrade logging functions
|
/// upgrade logging functions
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
|
|
||||||
$upgradeloghandle = false;
|
/**
|
||||||
$upgradelogbuffer = '';
|
* Marks start of upgrade, blocks any other access to site.
|
||||||
// I did not find out how to use static variable in callback function,
|
* The upgrade is finished at the end of script or after timeout.
|
||||||
// the problem was that I could not flush the static buffer :-(
|
*/
|
||||||
global $upgradeloghandle, $upgradelogbuffer;
|
function start_upgrade() {
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
|
static $started = false;
|
||||||
|
|
||||||
|
if ($started) {
|
||||||
|
upgrade_set_timeout(120);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ignore_user_abort(true);
|
||||||
|
register_shutdown_function('upgrade_finished_handler');
|
||||||
|
if ($CFG->version === '') {
|
||||||
|
// db not installed yet
|
||||||
|
$CFG->upgraderunning = time()+300;
|
||||||
|
} else {
|
||||||
|
set_config('upgraderunning', time()+300);
|
||||||
|
}
|
||||||
|
$started = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if upgrade is already running.
|
* Internal function - executed at the very end of each upgrade.
|
||||||
*
|
|
||||||
* If anything goes wrong due to missing call to upgrade_log_finish()
|
|
||||||
* just restart the browser.
|
|
||||||
*
|
|
||||||
* @param string warning message indicating upgrade is already running
|
|
||||||
* @param int page reload timeout
|
|
||||||
*/
|
*/
|
||||||
function upgrade_check_running($message, $timeout) {
|
function upgrade_finished_handler() {
|
||||||
global $SESSION;
|
upgrade_log_finish();
|
||||||
|
unset_config('upgraderunning');
|
||||||
if (!empty($SESSION->upgraderunning)) {
|
ignore_user_abort(false);
|
||||||
print_header();
|
|
||||||
redirect(me(), $message, $timeout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -852,25 +928,20 @@ function upgrade_check_running($message, $timeout) {
|
|||||||
* This function may be called repeatedly.
|
* This function may be called repeatedly.
|
||||||
*/
|
*/
|
||||||
function upgrade_log_start() {
|
function upgrade_log_start() {
|
||||||
global $CFG, $upgradeloghandle, $SESSION;
|
global $upgradeloghandle;
|
||||||
|
|
||||||
if (!empty($SESSION->upgraderunning)) {
|
start_upgrade(); // make sure the upgrade is started
|
||||||
return; // logging already started
|
|
||||||
|
if ($upgradeloghandle and ($upgradeloghandle !== 'error')) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ignore_user_abort(true); // ignore if user stops or otherwise aborts page loading
|
|
||||||
$SESSION->upgraderunning = 1; // set upgrade indicator
|
|
||||||
if (empty($CFG->dbsessions)) { // workaround for bug in adodb, db session can not be restarted
|
|
||||||
session_write_close(); // from now on user can reload page - will be displayed warning
|
|
||||||
}
|
|
||||||
make_upload_directory('upgradelogs');
|
make_upload_directory('upgradelogs');
|
||||||
ob_start('upgrade_log_callback', 2); // function for logging to disk; flush each line of text ASAP
|
ob_start('upgrade_log_callback', 2); // function for logging to disk; flush each line of text ASAP
|
||||||
register_shutdown_function('upgrade_log_finish'); // in case somebody forgets to stop logging
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate logging of output, flush all data, allow script aborting
|
* Terminate logging of output, flush all data.
|
||||||
* and reopen session for writing. Function print_error() does terminate the logging too.
|
|
||||||
*
|
*
|
||||||
* Please make sure that each upgrade_log_start() is properly terminated by
|
* Please make sure that each upgrade_log_start() is properly terminated by
|
||||||
* this function or print_error().
|
* this function or print_error().
|
||||||
@ -878,11 +949,7 @@ function upgrade_log_start() {
|
|||||||
* This function may be called repeatedly.
|
* This function may be called repeatedly.
|
||||||
*/
|
*/
|
||||||
function upgrade_log_finish() {
|
function upgrade_log_finish() {
|
||||||
global $CFG, $upgradeloghandle, $upgradelogbuffer, $SESSION;
|
global $CFG, $upgradeloghandle, $upgradelogbuffer;
|
||||||
|
|
||||||
if (empty($SESSION->upgraderunning)) {
|
|
||||||
return; // logging already terminated
|
|
||||||
}
|
|
||||||
|
|
||||||
@ob_end_flush();
|
@ob_end_flush();
|
||||||
if ($upgradelogbuffer !== '') {
|
if ($upgradelogbuffer !== '') {
|
||||||
@ -893,14 +960,6 @@ function upgrade_log_finish() {
|
|||||||
@fclose($upgradeloghandle);
|
@fclose($upgradeloghandle);
|
||||||
$upgradeloghandle = false;
|
$upgradeloghandle = false;
|
||||||
}
|
}
|
||||||
@session_start(); // ignore header errors, we only need to reopen session
|
|
||||||
|
|
||||||
$SESSION->upgraderunning = 0; // clear upgrade indicator
|
|
||||||
|
|
||||||
if (connection_aborted()) {
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
@ignore_user_abort(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1658,9 +1717,7 @@ class admin_settingpage extends part_of_admin_tree {
|
|||||||
$data = $adminroot->errors[$fullname]->data;
|
$data = $adminroot->errors[$fullname]->data;
|
||||||
} else {
|
} else {
|
||||||
$data = $setting->get_setting();
|
$data = $setting->get_setting();
|
||||||
if (is_null($data)) {
|
// do not use defaults if settings not available - upgrdesettings handles the defaults!
|
||||||
$data = $setting->get_defaultsetting();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$return .= $setting->output_html($data);
|
$return .= $setting->output_html($data);
|
||||||
}
|
}
|
||||||
@ -2237,13 +2294,8 @@ class admin_setting_configmulticheckbox extends admin_setting {
|
|||||||
$default = array();
|
$default = array();
|
||||||
}
|
}
|
||||||
if (is_null($data)) {
|
if (is_null($data)) {
|
||||||
foreach ($default as $value) {
|
$data = array();
|
||||||
if ($value) {
|
|
||||||
$data[] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
$defaults = array();
|
$defaults = array();
|
||||||
foreach($this->choices as $key=>$description) {
|
foreach($this->choices as $key=>$description) {
|
||||||
@ -3423,9 +3475,9 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
|
|||||||
* which identify roles that will be enabled by default. Default is the
|
* which identify roles that will be enabled by default. Default is the
|
||||||
* student role
|
* student role
|
||||||
*/
|
*/
|
||||||
function admin_setting_pickroles($name, $visiblename, $description,$types=array('moodle/legacy:student')) {
|
function admin_setting_pickroles($name, $visiblename, $description, $types) {
|
||||||
parent::admin_setting_configmulticheckbox($name, $visiblename, $description, NULL, NULL);
|
parent::admin_setting_configmulticheckbox($name, $visiblename, $description, NULL, NULL);
|
||||||
$this->types=$types;
|
$this->types = $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_choices() {
|
function load_choices() {
|
||||||
@ -3450,13 +3502,13 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
|
|||||||
function get_defaultsetting() {
|
function get_defaultsetting() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
if (empty($CFG->rolesactive)) {
|
if (empty($CFG->rolesactive)) {
|
||||||
return array(0);
|
return null;
|
||||||
}
|
}
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach($this->types as $capability) {
|
foreach($this->types as $capability) {
|
||||||
if ($caproles = get_roles_with_capability($capability, CAP_ALLOW)) {
|
if ($caproles = get_roles_with_capability($capability, CAP_ALLOW)) {
|
||||||
foreach ($caproles as $caprole) {
|
foreach ($caproles as $caprole) {
|
||||||
if(!in_array($caprole->id,$result)) {
|
if (!in_array($caprole->id, $result)) {
|
||||||
$result[] = $caprole->id;
|
$result[] = $caprole->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3472,7 +3524,8 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
|
|||||||
class admin_setting_special_gradebookroles extends admin_setting_pickroles {
|
class admin_setting_special_gradebookroles extends admin_setting_pickroles {
|
||||||
function admin_setting_special_gradebookroles() {
|
function admin_setting_special_gradebookroles() {
|
||||||
parent::admin_setting_pickroles('gradebookroles', get_string('gradebookroles', 'admin'),
|
parent::admin_setting_pickroles('gradebookroles', get_string('gradebookroles', 'admin'),
|
||||||
get_string('configgradebookroles', 'admin'));
|
get_string('configgradebookroles', 'admin'),
|
||||||
|
array('moodle/legacy:student'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3501,7 +3554,7 @@ class admin_setting_special_coursemanager extends admin_setting_pickroles {
|
|||||||
function admin_setting_special_coursemanager() {
|
function admin_setting_special_coursemanager() {
|
||||||
parent::admin_setting_pickroles('coursemanager', get_string('coursemanager', 'admin'),
|
parent::admin_setting_pickroles('coursemanager', get_string('coursemanager', 'admin'),
|
||||||
get_string('configcoursemanager', 'admin'),
|
get_string('configcoursemanager', 'admin'),
|
||||||
'moodle/legacy:editingteacher');
|
array('moodle/legacy:editingteacher'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4674,9 +4727,7 @@ function admin_search_settings_html($query) {
|
|||||||
$data = $adminroot->errors[$fullname]->data;
|
$data = $adminroot->errors[$fullname]->data;
|
||||||
} else {
|
} else {
|
||||||
$data = $setting->get_setting();
|
$data = $setting->get_setting();
|
||||||
if (is_null($data)) {
|
// do not use defaults if settings not available - upgrdesettings handles the defaults!
|
||||||
$data = $setting->get_defaultsetting();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$return .= $setting->output_html($data, $query);
|
$return .= $setting->output_html($data, $query);
|
||||||
}
|
}
|
||||||
@ -5090,7 +5141,7 @@ class admin_setting_managerepository extends admin_setting {
|
|||||||
parent::admin_setting('managerepository', get_string('managerepository', 'repository'), '', '');
|
parent::admin_setting('managerepository', get_string('managerepository', 'repository'), '', '');
|
||||||
$this->baseurl = $CFG->wwwroot . '/' . $CFG->admin . '/repository.php?sesskey=' . sesskey();
|
$this->baseurl = $CFG->wwwroot . '/' . $CFG->admin . '/repository.php?sesskey=' . sesskey();
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_setting() {
|
function get_setting() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1326,7 +1326,7 @@ function upgrade_blocks_plugins($continueto) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
upgrade_log_start();
|
upgrade_log_start();
|
||||||
print_error('cannotdowngrade', 'debug', '', array($currblock->version, $block->version));
|
print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$currblock->version, 'newversion'=>$block->version));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else { // block not installed yet, so install it
|
} else { // block not installed yet, so install it
|
||||||
@ -1345,11 +1345,7 @@ function upgrade_blocks_plugins($continueto) {
|
|||||||
if($conflictblock !== false && $conflictblock !== NULL) {
|
if($conflictblock !== false && $conflictblock !== NULL) {
|
||||||
// Duplicate block titles are not allowed, they confuse people
|
// Duplicate block titles are not allowed, they confuse people
|
||||||
// AND PHP's associative arrays ;)
|
// AND PHP's associative arrays ;)
|
||||||
if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
|
print_error('blocknameconflict', '', '', (object)array('name'=>$block->name, 'conflict'=>$conflictblock));
|
||||||
print_error('blocknameconflict', '', '', array($block->name, $conflictblock));
|
|
||||||
} else if (CLI_UPGRADE) {
|
|
||||||
print_error('blocknameconflict', '', '', array($block->name, $conflictblock));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (empty($updated_blocks)) {
|
if (empty($updated_blocks)) {
|
||||||
$strblocksetup = get_string('blocksetup');
|
$strblocksetup = get_string('blocksetup');
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
|
function xmldb_main_upgrade($oldversion) {
|
||||||
function xmldb_main_upgrade($oldversion=0) {
|
|
||||||
global $CFG, $THEME, $USER, $DB;
|
global $CFG, $THEME, $USER, $DB;
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
@ -29,6 +31,7 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
|
||||||
if ($result && $oldversion < 2008030700) {
|
if ($result && $oldversion < 2008030700) {
|
||||||
|
upgrade_set_timeout(60*20); // this may take a while
|
||||||
|
|
||||||
/// Define index contextid-lowerboundary (not unique) to be dropped form grade_letters
|
/// Define index contextid-lowerboundary (not unique) to be dropped form grade_letters
|
||||||
$table = new xmldb_table('grade_letters');
|
$table = new xmldb_table('grade_letters');
|
||||||
@ -61,6 +64,8 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result && $oldversion < 2008050700) {
|
if ($result && $oldversion < 2008050700) {
|
||||||
|
upgrade_set_timeout(60*20); // this may take a while
|
||||||
|
|
||||||
/// Fix minor problem caused by MDL-5482.
|
/// Fix minor problem caused by MDL-5482.
|
||||||
require_once($CFG->dirroot . '/question/upgrade.php');
|
require_once($CFG->dirroot . '/question/upgrade.php');
|
||||||
$result = $result && question_fix_random_question_parents();
|
$result = $result && question_fix_random_question_parents();
|
||||||
@ -85,6 +90,7 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
|
|
||||||
if ($result && $oldversion < 2008051201) {
|
if ($result && $oldversion < 2008051201) {
|
||||||
notify('Increasing size of user idnumber field, this may take a while...', 'notifysuccess');
|
notify('Increasing size of user idnumber field, this may take a while...', 'notifysuccess');
|
||||||
|
upgrade_set_timeout(60*20); // this may take a while
|
||||||
|
|
||||||
/// Under MySQL and Postgres... detect old NULL contents and change them by correct empty string. MDL-14859
|
/// Under MySQL and Postgres... detect old NULL contents and change them by correct empty string. MDL-14859
|
||||||
if ($CFG->dbfamily == 'mysql' || $CFG->dbfamily == 'postgres') {
|
if ($CFG->dbfamily == 'mysql' || $CFG->dbfamily == 'postgres') {
|
||||||
@ -135,6 +141,8 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result && $oldversion < 2008063001) {
|
if ($result && $oldversion < 2008063001) {
|
||||||
|
upgrade_set_timeout(60*20); // this may take a while
|
||||||
|
|
||||||
// table to be modified
|
// table to be modified
|
||||||
$table = new xmldb_table('tag_instance');
|
$table = new xmldb_table('tag_instance');
|
||||||
// add field
|
// add field
|
||||||
@ -262,28 +270,15 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
/// Main savepoint reached
|
/// Main savepoint reached
|
||||||
upgrade_main_savepoint($result, 2008070701);
|
upgrade_main_savepoint($result, 2008070701);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result && $oldversion < 2008072400) {
|
|
||||||
/// Create the database tables for message_processors and message_providers
|
|
||||||
$table = new xmldb_table('message_providers');
|
|
||||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
|
||||||
$table->add_field('modulename', XMLDB_TYPE_CHAR, '166', null, XMLDB_NOTNULL, null, null, null, null);
|
|
||||||
$table->add_field('modulefile', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
|
|
||||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
|
||||||
$dbman->create_table($table);
|
|
||||||
|
|
||||||
|
if ($result && $oldversion < 2008072400) {
|
||||||
|
/// Create the database tables for message_processors
|
||||||
$table = new xmldb_table('message_processors');
|
$table = new xmldb_table('message_processors');
|
||||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||||
$table->add_field('name', XMLDB_TYPE_CHAR, '166', null, XMLDB_NOTNULL, null, null, null, null);
|
$table->add_field('name', XMLDB_TYPE_CHAR, '166', null, XMLDB_NOTNULL, null, null, null, null);
|
||||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||||
$dbman->create_table($table);
|
$dbman->create_table($table);
|
||||||
|
|
||||||
|
|
||||||
$provider = new object();
|
|
||||||
$provider->modulename = 'moodle';
|
|
||||||
$provider->modulefile = 'index.php';
|
|
||||||
$DB->insert_record('message_providers', $provider);
|
|
||||||
|
|
||||||
/// delete old and create new fields
|
/// delete old and create new fields
|
||||||
$table = new xmldb_table('message');
|
$table = new xmldb_table('message');
|
||||||
$field = new xmldb_field('messagetype');
|
$field = new xmldb_field('messagetype');
|
||||||
@ -355,17 +350,17 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'defaultrole');
|
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'defaultrole');
|
||||||
|
|
||||||
/// Launch add field enablecompletion
|
/// Launch add field enablecompletion
|
||||||
if(!$dbman->field_exists($table,$field)) {
|
if (!$dbman->field_exists($table,$field)) {
|
||||||
$dbman->add_field($table, $field);
|
$dbman->add_field($table, $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Define field completion to be added to course_modules
|
/// Define field completion to be added to course_modules
|
||||||
$table = new xmldb_table('course_modules');
|
$table = new xmldb_table('course_modules');
|
||||||
$field = new xmldb_field('completion');
|
$field = new xmldb_field('completion');
|
||||||
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'groupmembersonly');
|
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'groupmembersonly');
|
||||||
|
|
||||||
/// Launch add field completion
|
/// Launch add field completion
|
||||||
if(!$dbman->field_exists($table,$field)) {
|
if (!$dbman->field_exists($table,$field)) {
|
||||||
$dbman->add_field($table, $field);
|
$dbman->add_field($table, $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +369,7 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'completion');
|
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'completion');
|
||||||
|
|
||||||
/// Launch add field completiongradeitemnumber
|
/// Launch add field completiongradeitemnumber
|
||||||
if(!$dbman->field_exists($table,$field)) {
|
if (!$dbman->field_exists($table,$field)) {
|
||||||
$dbman->add_field($table, $field);
|
$dbman->add_field($table, $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +378,7 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'completiongradeitemnumber');
|
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'completiongradeitemnumber');
|
||||||
|
|
||||||
/// Launch add field completionview
|
/// Launch add field completionview
|
||||||
if(!$dbman->field_exists($table,$field)) {
|
if (!$dbman->field_exists($table,$field)) {
|
||||||
$dbman->add_field($table, $field);
|
$dbman->add_field($table, $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,13 +387,13 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'completionview');
|
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'completionview');
|
||||||
|
|
||||||
/// Launch add field completionexpected
|
/// Launch add field completionexpected
|
||||||
if(!$dbman->field_exists($table,$field)) {
|
if (!$dbman->field_exists($table,$field)) {
|
||||||
$dbman->add_field($table, $field);
|
$dbman->add_field($table, $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Define table course_modules_completion to be created
|
/// Define table course_modules_completion to be created
|
||||||
$table = new xmldb_table('course_modules_completion');
|
$table = new xmldb_table('course_modules_completion');
|
||||||
if(!$dbman->table_exists($table)) {
|
if (!$dbman->table_exists($table)) {
|
||||||
|
|
||||||
/// Adding fields to table course_modules_completion
|
/// Adding fields to table course_modules_completion
|
||||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||||
@ -407,14 +402,14 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
$table->add_field('completionstate', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
$table->add_field('completionstate', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||||
$table->add_field('viewed', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null);
|
$table->add_field('viewed', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null);
|
||||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||||
|
|
||||||
/// Adding keys to table course_modules_completion
|
/// Adding keys to table course_modules_completion
|
||||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||||
|
|
||||||
/// Adding indexes to table course_modules_completion
|
/// Adding indexes to table course_modules_completion
|
||||||
$table->add_index('coursemoduleid', XMLDB_INDEX_NOTUNIQUE, array('coursemoduleid'));
|
$table->add_index('coursemoduleid', XMLDB_INDEX_NOTUNIQUE, array('coursemoduleid'));
|
||||||
$table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
|
$table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
|
||||||
|
|
||||||
/// Launch create table for course_modules_completion
|
/// Launch create table for course_modules_completion
|
||||||
$dbman->create_table($table);
|
$dbman->create_table($table);
|
||||||
}
|
}
|
||||||
@ -422,7 +417,7 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
/// Main savepoint reached
|
/// Main savepoint reached
|
||||||
upgrade_main_savepoint($result, 2008072800);
|
upgrade_main_savepoint($result, 2008072800);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result && $oldversion < 2008073000) {
|
if ($result && $oldversion < 2008073000) {
|
||||||
|
|
||||||
/// Define table portfolio_log to be created
|
/// Define table portfolio_log to be created
|
||||||
@ -602,6 +597,7 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
/// Main savepoint reached
|
/// Main savepoint reached
|
||||||
upgrade_main_savepoint($result, 2008080600);
|
upgrade_main_savepoint($result, 2008080600);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result && $oldversion < 2008080701) {
|
if ($result && $oldversion < 2008080701) {
|
||||||
|
|
||||||
/// Define field visible to be added to repository
|
/// Define field visible to be added to repository
|
||||||
@ -667,6 +663,15 @@ function xmldb_main_upgrade($oldversion=0) {
|
|||||||
upgrade_main_savepoint($result, 2008081506);
|
upgrade_main_savepoint($result, 2008081506);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($result && $oldversion < 2008081600) {
|
||||||
|
|
||||||
|
/// all 1.9 sites and fresh installs must already be unicode, not needed anymore
|
||||||
|
unset_config('unicodedb');
|
||||||
|
|
||||||
|
/// Main savepoint reached
|
||||||
|
upgrade_main_savepoint($result, 2008081600);
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ function upgrade_migrate_files_courses() {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($rs as $course) {
|
foreach ($rs as $course) {
|
||||||
$i++;
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||||
upgrade_migrate_files_course($context, '/', true);
|
upgrade_migrate_files_course($context, '/', true);
|
||||||
$pbar->update($i, $count, "Migrated course files - course $i/$count.");
|
$pbar->update($i, $count, "Migrated course files - course $i/$count.");
|
||||||
@ -102,7 +103,7 @@ function upgrade_migrate_files_course($context, $path, $delete) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($item->isLink()) {
|
if ($item->isLink()) {
|
||||||
// do not delete symbolic links or its children
|
// do not delete symbolic links or its children
|
||||||
$delete_this = false;
|
$delete_this = false;
|
||||||
} else {
|
} else {
|
||||||
$delete_this = $delete;
|
$delete_this = $delete;
|
||||||
@ -174,6 +175,8 @@ function upgrade_migrate_files_blog() {
|
|||||||
|
|
||||||
if ($rs = $DB->get_recordset_select('post', "module='blog' AND attachment IS NOT NULL AND attachment <> 1")) {
|
if ($rs = $DB->get_recordset_select('post', "module='blog' AND attachment IS NOT NULL AND attachment <> 1")) {
|
||||||
|
|
||||||
|
upgrade_set_timeout(60*20); // set up timeout, may also abort execution
|
||||||
|
|
||||||
$pbar = new progress_bar('migrateblogfiles', 500, true);
|
$pbar = new progress_bar('migrateblogfiles', 500, true);
|
||||||
|
|
||||||
$olddebug = $DB->get_debug();
|
$olddebug = $DB->get_debug();
|
||||||
@ -183,9 +186,8 @@ function upgrade_migrate_files_blog() {
|
|||||||
$i++;
|
$i++;
|
||||||
$pathname = "$CFG->dataroot/blog/attachments/$entry->id/$entry->attachment";
|
$pathname = "$CFG->dataroot/blog/attachments/$entry->id/$entry->attachment";
|
||||||
if (!file_exists($pathname)) {
|
if (!file_exists($pathname)) {
|
||||||
// hmm, we could set atatchment NULL here, but it would break badly in concurrent ugprades, disabling for now
|
$entry->attachment = NULL;
|
||||||
//$entry->attachment = NULL;
|
$DB->update_record('post', $entry);
|
||||||
//$DB->update_record('post', $entry);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +206,7 @@ function upgrade_migrate_files_blog() {
|
|||||||
|
|
||||||
if (!$fs->file_exists(SYSCONTEXTID, 'blog', $entry->id, '/', $filename)) {
|
if (!$fs->file_exists(SYSCONTEXTID, 'blog', $entry->id, '/', $filename)) {
|
||||||
$file_record = array('contextid'=>SYSCONTEXTID, 'filearea'=>'blog', 'itemid'=>$entry->id, 'filepath'=>'/', 'filename'=>$filename,
|
$file_record = array('contextid'=>SYSCONTEXTID, 'filearea'=>'blog', 'itemid'=>$entry->id, 'filepath'=>'/', 'filename'=>$filename,
|
||||||
'timecreated'=>filectime($pathname), 'timemodified'=>filemtime($pathname), 'userid'=>$post->userid);
|
'timecreated'=>filectime($pathname), 'timemodified'=>filemtime($pathname), 'userid'=>$entry->userid);
|
||||||
$fs->create_file_from_pathname($file_record, $pathname);
|
$fs->create_file_from_pathname($file_record, $pathname);
|
||||||
}
|
}
|
||||||
@unlink($pathname);
|
@unlink($pathname);
|
||||||
@ -217,7 +219,7 @@ function upgrade_migrate_files_blog() {
|
|||||||
$DB->set_debug($olddebug); // reset debug level
|
$DB->set_debug($olddebug); // reset debug level
|
||||||
$rs->close();
|
$rs->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@rmdir("$CFG->dataroot/blog/attachments/");
|
@rmdir("$CFG->dataroot/blog/attachments/");
|
||||||
@rmdir("$CFG->dataroot/blog/");
|
@rmdir("$CFG->dataroot/blog/");
|
||||||
}
|
}
|
||||||
|
@ -2597,7 +2597,7 @@ function fullname($user, $override=false) {
|
|||||||
$CFG->fullnamedisplay = $SESSION->fullnamedisplay;
|
$CFG->fullnamedisplay = $SESSION->fullnamedisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($CFG->fullnamedisplay == 'firstname lastname') {
|
if (!isset($CFG->fullnamedisplay) or $CFG->fullnamedisplay === 'firstname lastname') {
|
||||||
return $user->firstname .' '. $user->lastname;
|
return $user->firstname .' '. $user->lastname;
|
||||||
|
|
||||||
} else if ($CFG->fullnamedisplay == 'lastname firstname') {
|
} else if ($CFG->fullnamedisplay == 'lastname firstname') {
|
||||||
@ -6418,6 +6418,45 @@ function moodle_needs_upgrading() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets maximum expected time needed for upgrade task.
|
||||||
|
* Please always make sure that upgrade will not run longer!
|
||||||
|
*
|
||||||
|
* The script may be automatically aborted if upgrade times out.
|
||||||
|
*
|
||||||
|
* @param int $max_execution_time in seconds (can not be less than 60 s)
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function upgrade_set_timeout($max_execution_time=300) {
|
||||||
|
global $CFG;
|
||||||
|
|
||||||
|
if (!isset($CFG->upgraderunning) or $CFG->upgraderunning < time()) {
|
||||||
|
$upgraderunning = get_config(null, 'upgraderunning');
|
||||||
|
} else {
|
||||||
|
$upgraderunning = $CFG->upgraderunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$upgraderunning) {
|
||||||
|
// upgrade not running or aborted
|
||||||
|
print_error('upgradetimedout', 'admin', "$CFG->wwroot/$CFG->admin/");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($max_execution_time < 60) {
|
||||||
|
// protection against 0 here
|
||||||
|
$max_execution_time = 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
$expected_end = time() + $max_execution_time;
|
||||||
|
|
||||||
|
if ($expected_end < $upgraderunning + 10 and $expected_end > $upgraderunning - 10) {
|
||||||
|
// no need to store new end, it is nearly the same ;-)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_time_limit($max_execution_time);
|
||||||
|
set_config('upgraderunning', $expected_end); // keep upgrade locked until this time
|
||||||
|
}
|
||||||
|
|
||||||
/// MISCELLANEOUS ////////////////////////////////////////////////////////////////////
|
/// MISCELLANEOUS ////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ class page_course extends page_base {
|
|||||||
// Do NOT load up "expensive" resouces (e.g. SQL data) here!
|
// Do NOT load up "expensive" resouces (e.g. SQL data) here!
|
||||||
function init_quick($data) {
|
function init_quick($data) {
|
||||||
if(empty($data->pageid) && !defined('ADMIN_STICKYBLOCKS')) {
|
if(empty($data->pageid) && !defined('ADMIN_STICKYBLOCKS')) {
|
||||||
print_error('cannotinitpage', '', '', null);
|
print_error('cannotinitpage', 'debug', '', (object)array('name'=>'course', 'id'=>'?'));
|
||||||
}
|
}
|
||||||
parent::init_quick($data);
|
parent::init_quick($data);
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ class page_course extends page_base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(empty($this->courserecord) && !defined('ADMIN_STICKYBLOCKS')) {
|
if(empty($this->courserecord) && !defined('ADMIN_STICKYBLOCKS')) {
|
||||||
print_error('cannotinitpage', '', '', $this->id);
|
print_error('cannotinitpage', 'debug', '', (object)array('name'=>'course', 'id'=>$this->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context = get_context_instance(CONTEXT_COURSE, $this->id);
|
$this->context = get_context_instance(CONTEXT_COURSE, $this->id);
|
||||||
@ -594,7 +594,7 @@ class page_generic_activity extends page_base {
|
|||||||
print_error('noactivityname', 'debug');
|
print_error('noactivityname', 'debug');
|
||||||
}
|
}
|
||||||
if (!$this->modulerecord = get_coursemodule_from_instance($this->activityname, $this->id)) {
|
if (!$this->modulerecord = get_coursemodule_from_instance($this->activityname, $this->id)) {
|
||||||
print_error('cannotinitpager', 'debug', '', array($this->activityname, $this->id));
|
print_error('cannotinitpager', 'debug', '', (object)array('name'=>$this->activityname, 'id'=>$this->id));
|
||||||
}
|
}
|
||||||
$this->courserecord = $DB->get_record('course', array('id'=>$this->modulerecord->course));
|
$this->courserecord = $DB->get_record('course', array('id'=>$this->modulerecord->course));
|
||||||
if(empty($this->courserecord)) {
|
if(empty($this->courserecord)) {
|
||||||
@ -602,7 +602,7 @@ class page_generic_activity extends page_base {
|
|||||||
}
|
}
|
||||||
$this->activityrecord = $DB->get_record($this->activityname, array('id'=>$this->id));
|
$this->activityrecord = $DB->get_record($this->activityname, array('id'=>$this->id));
|
||||||
if(empty($this->activityrecord)) {
|
if(empty($this->activityrecord)) {
|
||||||
print_error('cannotinitpager', 'debug', '', array($this->activityname, $this->id));
|
print_error('cannotinitpager', 'debug', '', (object)array('name'=>$this->activityname, 'id'=>$this->id));
|
||||||
}
|
}
|
||||||
$this->full_init_done = true;
|
$this->full_init_done = true;
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,15 @@ global $HTTPSPAGEREQUIRED;
|
|||||||
/// Load up any configuration from the config table
|
/// Load up any configuration from the config table
|
||||||
$CFG = get_config();
|
$CFG = get_config();
|
||||||
|
|
||||||
|
/// Verify upgrade is not running
|
||||||
|
if (isset($CFG->upgraderunning)) {
|
||||||
|
if ($CFG->upgraderunning < time()) {
|
||||||
|
unset_config('upgraderunning');
|
||||||
|
} else {
|
||||||
|
print_error('upgraderunning');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Turn on SQL logging if required
|
/// Turn on SQL logging if required
|
||||||
if (!empty($CFG->logsql)) {
|
if (!empty($CFG->logsql)) {
|
||||||
$DB->set_logging(true);
|
$DB->set_logging(true);
|
||||||
|
@ -5677,7 +5677,7 @@ function print_error($errorcode, $module='', $link='', $a=NULL) {
|
|||||||
$module = 'error';
|
$module = 'error';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($CFG->theme)) {
|
if (!isset($CFG->theme) or !isset($CFG->stylesheets)) {
|
||||||
// error found before setup.php finished
|
// error found before setup.php finished
|
||||||
_print_early_error($errorcode, $module, $a);
|
_print_early_error($errorcode, $module, $a);
|
||||||
} else {
|
} else {
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
* @package
|
* @package
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function xmldb_message_email_upgrade($oldversion=0) {
|
function xmldb_message_email_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
if ($result && $oldversion < 2008072401) {
|
if ($result && $oldversion < 2008072401) {
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
* @package
|
* @package
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function xmldb_message_jabber_upgrade($oldversion=0) {
|
function xmldb_message_jabber_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
if ($result && $oldversion < 2008072401) {
|
if ($result && $oldversion < 2008072401) {
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
* @package
|
* @package
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function xmldb_message_popup_upgrade($oldversion=0) {
|
function xmldb_message_popup_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
if ($result && $oldversion < 2008072401) {
|
if ($result && $oldversion < 2008072401) {
|
||||||
|
@ -16,23 +16,22 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_assignment_upgrade($oldversion=0) {
|
function xmldb_assignment_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
if ($result && $oldversion < 2007101511) {
|
if ($result && $oldversion < 2007101511) {
|
||||||
notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
|
|
||||||
// change grade typo to text if no grades MDL-13920
|
// change grade typo to text if no grades MDL-13920
|
||||||
require_once $CFG->dirroot.'/mod/assignment/lib.php';
|
require_once $CFG->dirroot.'/mod/assignment/lib.php';
|
||||||
// too much debug output
|
assignment_upgrade_grades();
|
||||||
$DB->set_debug(false);
|
|
||||||
assignment_update_grades();
|
|
||||||
$DB->set_debug(true);
|
|
||||||
upgrade_mod_savepoint($result, 2007101511, 'assignment');
|
upgrade_mod_savepoint($result, 2007101511, 'assignment');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,10 +58,11 @@ function xmldb_assignment_upgrade($oldversion=0) {
|
|||||||
$pbar = new progress_bar('migrateassignmentfiles', 500, true);
|
$pbar = new progress_bar('migrateassignmentfiles', 500, true);
|
||||||
|
|
||||||
$olddebug = $DB->get_debug();
|
$olddebug = $DB->get_debug();
|
||||||
// $DB->set_debug(false); // lower debug level, there might be many files
|
$DB->set_debug(false); // lower debug level, there might be many files
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($rs as $submission) {
|
foreach ($rs as $submission) {
|
||||||
$i++;
|
$i++;
|
||||||
|
upgrade_set_timeout(180); // set up timeout, may also abort execution
|
||||||
$basepath = "$CFG->dataroot/$submission->course/$CFG->moddata/assignment/$submission->assignment/$submission->userid/";
|
$basepath = "$CFG->dataroot/$submission->course/$CFG->moddata/assignment/$submission->assignment/$submission->userid/";
|
||||||
if (!file_exists($basepath)) {
|
if (!file_exists($basepath)) {
|
||||||
//no files
|
//no files
|
||||||
|
@ -2212,41 +2212,60 @@ function assignment_get_user_grades($assignment, $userid=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update grades by firing grade_updated event
|
* Update activity grades
|
||||||
*
|
*
|
||||||
* @param object $assignment null means all assignments
|
* @param object $assignment
|
||||||
* @param int $userid specific user only, 0 mean all
|
* @param int $userid specific user only, 0 means all
|
||||||
*/
|
*/
|
||||||
function assignment_update_grades($assignment=null, $userid=0, $nullifnone=true) {
|
function assignment_update_grades($assignment, $userid=0, $nullifnone=true) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
require_once($CFG->libdir.'/gradelib.php');
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
|
|
||||||
if ($assignment != null) {
|
if ($assignment->grade == 0) {
|
||||||
if ($grades = assignment_get_user_grades($assignment, $userid)) {
|
assignment_grade_item_update($assignment);
|
||||||
foreach($grades as $k=>$v) {
|
|
||||||
if ($v->rawgrade == -1) {
|
} else if ($grades = assignment_get_user_grades($assignment, $userid)) {
|
||||||
$grades[$k]->rawgrade = null;
|
foreach($grades as $k=>$v) {
|
||||||
}
|
if ($v->rawgrade == -1) {
|
||||||
|
$grades[$k]->rawgrade = null;
|
||||||
}
|
}
|
||||||
assignment_grade_item_update($assignment, $grades);
|
|
||||||
} else {
|
|
||||||
assignment_grade_item_update($assignment);
|
|
||||||
}
|
}
|
||||||
|
assignment_grade_item_update($assignment, $grades);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid
|
assignment_grade_item_update($assignment);
|
||||||
FROM {assignment} a, {course_modules} cm, {modules} m
|
}
|
||||||
WHERE m.name='assignment' AND m.id=cm.module AND cm.instance=a.id";
|
}
|
||||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
|
||||||
foreach ($rs as $assignment) {
|
/**
|
||||||
if ($assignment->grade != 0) {
|
* Update all grades in gradebook.
|
||||||
assignment_update_grades($assignment);
|
*/
|
||||||
} else {
|
function assignment_upgrade_grades() {
|
||||||
assignment_grade_item_update($assignment);
|
global $DB;
|
||||||
}
|
|
||||||
}
|
$sql = "SELECT COUNT('x')
|
||||||
$rs->close();
|
FROM {assignment} a, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='assignment' AND m.id=cm.module AND cm.instance=a.id";
|
||||||
|
$count = $DB->count_records_sql($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT a.*, cm.idnumber AS cmidnumber, a.course AS courseid
|
||||||
|
FROM {assignment} a, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='assignment' AND m.id=cm.module AND cm.instance=a.id";
|
||||||
|
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||||
|
// too much debug output
|
||||||
|
$prevdebug = $DB->get_debug();
|
||||||
|
$DB->set_debug(false);
|
||||||
|
$pbar = new progress_bar('assignmentupgradegrades', 500, true);
|
||||||
|
$i=0;
|
||||||
|
foreach ($rs as $assignment) {
|
||||||
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
|
assignment_update_grades($assignment);
|
||||||
|
$pbar->update($i, $count, "Updating Assignment grades ($i/$count).");
|
||||||
}
|
}
|
||||||
|
$DB->set_debug($prevdebug);
|
||||||
|
$rs->close();
|
||||||
|
upgrade_set_timeout(); // reset to default timeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,15 +16,18 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_chat_upgrade($oldversion=0) {
|
function xmldb_chat_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager();
|
$dbman = $DB->get_manager();
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
if ($result && $oldversion < 2008072400) {
|
if ($result && $oldversion < 2008072400) {
|
||||||
|
|
||||||
/// Define table chat_messages_current to be created
|
/// Define table chat_messages_current to be created
|
||||||
@ -48,10 +51,8 @@ function xmldb_chat_upgrade($oldversion=0) {
|
|||||||
$table->add_index('groupid', XMLDB_INDEX_NOTUNIQUE, array('groupid'));
|
$table->add_index('groupid', XMLDB_INDEX_NOTUNIQUE, array('groupid'));
|
||||||
$table->add_index('timestamp-chatid', XMLDB_INDEX_NOTUNIQUE, array('timestamp', 'chatid'));
|
$table->add_index('timestamp-chatid', XMLDB_INDEX_NOTUNIQUE, array('timestamp', 'chatid'));
|
||||||
|
|
||||||
/// Conditionally launch create table for chat_messages_current
|
/// create table for chat_messages_current
|
||||||
if (!$dbman->table_exists($table)) {
|
$dbman->create_table($table);
|
||||||
$dbman->create_table($table);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// chat savepoint reached
|
/// chat savepoint reached
|
||||||
upgrade_mod_savepoint($result, 2008072400, 'chat');
|
upgrade_mod_savepoint($result, 2008072400, 'chat');
|
||||||
|
@ -16,22 +16,16 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_choice_upgrade($oldversion=0) {
|
function xmldb_choice_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
|
||||||
/// block of code similar to the next one. Please, delete
|
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
|
||||||
/// $result = result of database_manager methods
|
|
||||||
/// }
|
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_data_upgrade($oldversion=0) {
|
function xmldb_data_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager();
|
$dbman = $DB->get_manager();
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
@ -798,43 +798,60 @@ function data_get_user_grades($data, $userid=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update grades by firing grade_updated event
|
* Update activity grades
|
||||||
*
|
*
|
||||||
* @param object $data null means all databases
|
* @param object $data
|
||||||
* @param int $userid specific user only, 0 mean all
|
* @param int $userid specific user only, 0 means all
|
||||||
*/
|
*/
|
||||||
function data_update_grades($data=null, $userid=0, $nullifnone=true) {
|
function data_update_grades($data, $userid=0, $nullifnone=true) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
require_once($CFG->libdir.'/gradelib.php');
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
|
|
||||||
if ($data != null) {
|
if (!$data->assessed) {
|
||||||
if ($grades = data_get_user_grades($data, $userid)) {
|
data_grade_item_update($data);
|
||||||
data_grade_item_update($data, $grades);
|
|
||||||
|
|
||||||
} else if ($userid and $nullifnone) {
|
} else if ($grades = data_get_user_grades($data, $userid)) {
|
||||||
$grade = new object();
|
data_grade_item_update($data, $grades);
|
||||||
$grade->userid = $userid;
|
|
||||||
$grade->rawgrade = NULL;
|
|
||||||
data_grade_item_update($data, $grade);
|
|
||||||
|
|
||||||
} else {
|
} else if ($userid and $nullifnone) {
|
||||||
data_grade_item_update($data);
|
$grade = new object();
|
||||||
}
|
$grade->userid = $userid;
|
||||||
|
$grade->rawgrade = NULL;
|
||||||
|
data_grade_item_update($data, $grade);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT d.*, cm.idnumber as cmidnumber
|
data_grade_item_update($data);
|
||||||
FROM {data} d, {course_modules} cm, {modules} m
|
}
|
||||||
WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";
|
}
|
||||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
|
||||||
foreach ($rs as $data) {
|
/**
|
||||||
if ($data->assessed) {
|
* Update all grades in gradebook.
|
||||||
data_update_grades($data, 0, false);
|
*/
|
||||||
} else {
|
function data_upgrade_grades() {
|
||||||
data_grade_item_update($data);
|
global $DB;
|
||||||
}
|
|
||||||
}
|
$sql = "SELECT COUNT('x')
|
||||||
$rs->close();
|
FROM {data} d, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";
|
||||||
|
$count = $DB->count_records_sql($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT d.*, cm.idnumber AS cmidnumber, d.course AS courseid
|
||||||
|
FROM {data} d, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";
|
||||||
|
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||||
|
// too much debug output
|
||||||
|
$prevdebug = $DB->get_debug();
|
||||||
|
$DB->set_debug(false);
|
||||||
|
$pbar = new progress_bar('dataupgradegrades', 500, true);
|
||||||
|
$i=0;
|
||||||
|
foreach ($rs as $data) {
|
||||||
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
|
data_update_grades($data, 0, false);
|
||||||
|
$pbar->update($i, $count, "Updating Database grades ($i/$count).");
|
||||||
}
|
}
|
||||||
|
$DB->set_debug($prevdebug);
|
||||||
|
$rs->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
} else if ($rating != $oldrating->rating) {
|
} else if ($rating != $oldrating->rating) {
|
||||||
$oldrating->rating = $rating;
|
$oldrating->rating = $rating;
|
||||||
if (!$DB->update_record('data_ratings', $oldrating)) {
|
if (!$DB->update_record('data_ratings', $oldrating)) {
|
||||||
print_error('cannotupdaterate', 'data', '', array($record->id, $rating));
|
print_error('cannotupdaterate', 'error', '', (object)array('id'=>$record->id, 'rating'=>$rating));
|
||||||
}
|
}
|
||||||
data_update_grades($data, $record->userid);
|
data_update_grades($data, $record->userid);
|
||||||
|
|
||||||
@ -76,7 +76,7 @@
|
|||||||
$newrating->recordid = $record->id;
|
$newrating->recordid = $record->id;
|
||||||
$newrating->rating = $rating;
|
$newrating->rating = $rating;
|
||||||
if (! $DB->insert_record('data_ratings', $newrating)) {
|
if (! $DB->insert_record('data_ratings', $newrating)) {
|
||||||
print_error('cannotinsertrate', 'data', '', array($record->id, $rating));
|
print_error('cannotinsertrate', 'error', '', (object)array('id'=>$record->id, 'rating'=>$rating));
|
||||||
}
|
}
|
||||||
data_update_grades($data, $record->userid);
|
data_update_grades($data, $record->userid);
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_feedback_upgrade($oldversion=0) {
|
function xmldb_feedback_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager();
|
$dbman = $DB->get_manager();
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
if ($result && $oldversion < 2007012310) {
|
if ($result && $oldversion < 2007012310) {
|
||||||
|
@ -16,35 +16,22 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_forum_upgrade($oldversion=0) {
|
function xmldb_forum_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
|
$dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
|
||||||
/// block of code similar to the next one. Please, delete
|
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
|
||||||
/// $result = result of database_manager methods
|
|
||||||
/// }
|
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
if ($result and $oldversion < 2007101511) {
|
if ($result and $oldversion < 2007101511) {
|
||||||
notify('Processing forum grades, this may take a while if there are many forums...', 'notifysuccess');
|
|
||||||
//MDL-13866 - send forum ratins to gradebook again
|
//MDL-13866 - send forum ratins to gradebook again
|
||||||
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
||||||
// too much debug output
|
forum_upgrade_grades();
|
||||||
$DB->set_debug(false);
|
|
||||||
forum_update_grades();
|
|
||||||
$DB->set_debug(true);
|
|
||||||
|
|
||||||
upgrade_mod_savepoint($result, 2007101511, 'forum');
|
upgrade_mod_savepoint($result, 2007101511, 'forum');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,45 +1424,62 @@ function forum_get_user_grades($forum, $userid=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update grades by firing grade_updated event
|
* Update activity grades
|
||||||
*
|
*
|
||||||
* @param object $forum null means all forums
|
* @param object $forum
|
||||||
* @param int $userid specific user only, 0 mean all
|
* @param int $userid specific user only, 0 means all
|
||||||
* @param boolean $nullifnone return null if grade does not exist
|
* @param boolean $nullifnone return null if grade does not exist
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function forum_update_grades($forum=null, $userid=0, $nullifnone=true) {
|
function forum_update_grades($forum, $userid=0, $nullifnone=true) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
|
|
||||||
if ($forum != null) {
|
if (!$forum->assessed) {
|
||||||
require_once($CFG->libdir.'/gradelib.php');
|
forum_grade_item_update($forum);
|
||||||
if ($grades = forum_get_user_grades($forum, $userid)) {
|
|
||||||
forum_grade_item_update($forum, $grades);
|
|
||||||
|
|
||||||
} else if ($userid and $nullifnone) {
|
} else if ($grades = forum_get_user_grades($forum, $userid)) {
|
||||||
$grade = new object();
|
forum_grade_item_update($forum, $grades);
|
||||||
$grade->userid = $userid;
|
|
||||||
$grade->rawgrade = NULL;
|
|
||||||
forum_grade_item_update($forum, $grade);
|
|
||||||
|
|
||||||
} else {
|
} else if ($userid and $nullifnone) {
|
||||||
forum_grade_item_update($forum);
|
$grade = new object();
|
||||||
}
|
$grade->userid = $userid;
|
||||||
|
$grade->rawgrade = NULL;
|
||||||
|
forum_grade_item_update($forum, $grade);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT f.*, cm.idnumber as cmidnumber
|
forum_grade_item_update($forum);
|
||||||
FROM {forum} f, {course_modules} cm, {modules} m
|
}
|
||||||
WHERE m.name='forum' AND m.id=cm.module AND cm.instance=f.id";
|
}
|
||||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
|
||||||
foreach ($rs as $forum) {
|
/**
|
||||||
if ($forum->assessed) {
|
* Update all grades in gradebook.
|
||||||
forum_update_grades($forum, 0, false);
|
*/
|
||||||
} else {
|
function forum_upgrade_grades() {
|
||||||
forum_grade_item_update($forum);
|
global $DB;
|
||||||
}
|
|
||||||
}
|
$sql = "SELECT COUNT('x')
|
||||||
$rs->close();
|
FROM {forum} f, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='forum' AND m.id=cm.module AND cm.instance=f.id";
|
||||||
|
$count = $DB->count_records_sql($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT f.*, cm.idnumber AS cmidnumber, f.course AS courseid
|
||||||
|
FROM {forum} f, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='forum' AND m.id=cm.module AND cm.instance=f.id";
|
||||||
|
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||||
|
// too much debug output
|
||||||
|
$prevdebug = $DB->get_debug();
|
||||||
|
$DB->set_debug(false);
|
||||||
|
$pbar = new progress_bar('forumupgradegrades', 500, true);
|
||||||
|
$i=0;
|
||||||
|
foreach ($rs as $forum) {
|
||||||
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
|
forum_update_grades($forum, 0, false);
|
||||||
|
$pbar->update($i, $count, "Updating Forum grades ($i/$count).");
|
||||||
}
|
}
|
||||||
|
$DB->set_debug($prevdebug);
|
||||||
|
$rs->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +71,7 @@
|
|||||||
$oldrating->rating = $rating;
|
$oldrating->rating = $rating;
|
||||||
$oldrating->time = time();
|
$oldrating->time = time();
|
||||||
if (!$DB->update_record('forum_ratings', $oldrating)) {
|
if (!$DB->update_record('forum_ratings', $oldrating)) {
|
||||||
print_error('cannotupdaterate', 'forum', '',
|
print_error('cannotupdaterate', 'error', '', (object)array('id'=>$post->id, 'rating'=>$rating));
|
||||||
array($post->id, $rating));
|
|
||||||
}
|
}
|
||||||
forum_update_grades($forum, $post->userid);
|
forum_update_grades($forum, $post->userid);
|
||||||
}
|
}
|
||||||
@ -85,8 +84,7 @@
|
|||||||
$newrating->rating = $rating;
|
$newrating->rating = $rating;
|
||||||
|
|
||||||
if (! $DB->insert_record('forum_ratings', $newrating)) {
|
if (! $DB->insert_record('forum_ratings', $newrating)) {
|
||||||
print_error('cannotinsertrate', 'forum', '',
|
print_error('cannotinsertrate', 'error', '', (object)array('id'=>$postid, 'rating'=>$rating));
|
||||||
array($postid, $rating));
|
|
||||||
}
|
}
|
||||||
forum_update_grades($forum, $post->userid);
|
forum_update_grades($forum, $post->userid);
|
||||||
}
|
}
|
||||||
|
@ -16,22 +16,16 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_glossary_upgrade($oldversion=0) {
|
function xmldb_glossary_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
|
||||||
/// block of code similar to the next one. Please, delete
|
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
|
||||||
/// $result = result of database_manager methods
|
|
||||||
/// }
|
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -323,43 +323,59 @@ function glossary_get_user_grades($glossary, $userid=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update grades by firing grade_updated event
|
* Update activity grades
|
||||||
*
|
*
|
||||||
* @param object $glossary null means all glossaries
|
* @param object $glossary null means all glossaries
|
||||||
* @param int $userid specific user only, 0 mean all
|
* @param int $userid specific user only, 0 means all
|
||||||
*/
|
*/
|
||||||
function glossary_update_grades($glossary=null, $userid=0, $nullifnone=true) {
|
function glossary_update_grades($glossary=null, $userid=0, $nullifnone=true) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
require_once($CFG->libdir.'/gradelib.php');
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
|
|
||||||
if ($glossary != null) {
|
if (!$glossary->assessed) {
|
||||||
if ($grades = glossary_get_user_grades($glossary, $userid)) {
|
glossary_grade_item_update($glossary);
|
||||||
glossary_grade_item_update($glossary, $grades);
|
|
||||||
|
|
||||||
} else if ($userid and $nullifnone) {
|
} else if ($grades = glossary_get_user_grades($glossary, $userid)) {
|
||||||
$grade = new object();
|
glossary_grade_item_update($glossary, $grades);
|
||||||
$grade->userid = $userid;
|
|
||||||
$grade->rawgrade = NULL;
|
|
||||||
glossary_grade_item_update($glossary, $grade);
|
|
||||||
|
|
||||||
} else {
|
} else if ($userid and $nullifnone) {
|
||||||
glossary_grade_item_update($glossary);
|
$grade = new object();
|
||||||
}
|
$grade->userid = $userid;
|
||||||
|
$grade->rawgrade = NULL;
|
||||||
|
glossary_grade_item_update($glossary, $grade);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT g.*, cm.idnumber as cmidnumber
|
glossary_grade_item_update($glossary);
|
||||||
FROM {glossary} g, {course_modules} cm, {modules} m
|
}
|
||||||
WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
|
}
|
||||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
|
||||||
foreach ($rs as $glossary) {
|
/**
|
||||||
if ($glossary->assessed) {
|
* Update all grades in gradebook.
|
||||||
glossary_update_grades($glossary, 0, false);
|
*/
|
||||||
} else {
|
function glossary_upgrade_grades() {
|
||||||
glossary_grade_item_update($glossary);
|
global $DB;
|
||||||
}
|
|
||||||
}
|
$sql = "SELECT COUNT('x')
|
||||||
$rs->close();
|
FROM {glossary} g, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
|
||||||
|
$count = $DB->count_records_sql($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT g.*, cm.idnumber AS cmidnumber, g.course AS courseid
|
||||||
|
FROM {glossary} g, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
|
||||||
|
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||||
|
$prevdebug = $DB->get_debug();
|
||||||
|
$DB->set_debug(false);
|
||||||
|
$pbar = new progress_bar('glossaryupgradegrades', 500, true);
|
||||||
|
$i=0;
|
||||||
|
foreach ($rs as $glossary) {
|
||||||
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
|
glossary_update_grades($glossary, 0, false);
|
||||||
|
$pbar->update($i, $count, "Updating Glossary grades ($i/$count).");
|
||||||
}
|
}
|
||||||
|
$DB->set_debug($prevdebug);
|
||||||
|
$rs->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
$oldrating->rating = $rating;
|
$oldrating->rating = $rating;
|
||||||
$oldrating->time = time();
|
$oldrating->time = time();
|
||||||
if (! $DB->update_record("glossary_ratings", $oldrating)) {
|
if (! $DB->update_record("glossary_ratings", $oldrating)) {
|
||||||
print_error('cannotinsertrate', '', '', array($entry, $rating));
|
print_error('cannotinsertrate', 'error', '', (object)array('id'=>$entry->id, 'rating'=>$rating));
|
||||||
}
|
}
|
||||||
glossary_update_grades($glossary, $entry->userid);
|
glossary_update_grades($glossary, $entry->userid);
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@
|
|||||||
$newrating->rating = $rating;
|
$newrating->rating = $rating;
|
||||||
|
|
||||||
if (! $DB->insert_record("glossary_ratings", $newrating)) {
|
if (! $DB->insert_record("glossary_ratings", $newrating)) {
|
||||||
print_error('cannotinsertrate', '', '', array($entry->id, $rating));
|
print_error('cannotinsertrate', 'error', '', (object)array('id'=>$entry->id, 'rating'=>$rating));
|
||||||
}
|
}
|
||||||
glossary_update_grades($glossary, $entry->userid);
|
glossary_update_grades($glossary, $entry->userid);
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,23 @@
|
|||||||
<?php //$Id$
|
<?php //$Id$
|
||||||
|
|
||||||
// This file keeps track of upgrades to the hotpot module
|
// This file keeps track of upgrades to the hotpot module
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_hotpot_upgrade($oldversion=0) {
|
function xmldb_hotpot_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
// update hotpot grades from sites earlier than Moodle 1.9, 27th March 2008
|
// update hotpot grades from sites earlier than Moodle 1.9, 27th March 2008
|
||||||
if ($result && $oldversion < 2007101511) {
|
if ($result && $oldversion < 2007101511) {
|
||||||
|
// ensure "hotpot_upgrade_grades" function is available
|
||||||
// ensure "hotpot_update_grades" function is available
|
|
||||||
require_once $CFG->dirroot.'/mod/hotpot/lib.php';
|
require_once $CFG->dirroot.'/mod/hotpot/lib.php';
|
||||||
|
hotpot_upgrade_grades();
|
||||||
// disable display of debugging messages
|
|
||||||
$DB->set_debug(false);
|
|
||||||
|
|
||||||
notify('Processing hotpot grades, this may take a while if there are many hotpots...', 'notifysuccess');
|
|
||||||
hotpot_update_grades();
|
|
||||||
|
|
||||||
// restore debug
|
|
||||||
$DB->set_debug(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -1256,46 +1256,63 @@ function hotpot_get_user_grades($hotpot, $userid=0) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update grades in central gradebook
|
* Update grades in central gradebook
|
||||||
* this function is called from db/upgrade.php
|
* @param object $hotpot
|
||||||
* it is initially called with no arguments, which forces it to get a list of all hotpots
|
|
||||||
* it then iterates through the hotpots, calling itself to create a grade record for each hotpot
|
|
||||||
*
|
|
||||||
* @param object $hotpot null means all hotpots
|
|
||||||
* @param int $userid specific user only, 0 means all users
|
* @param int $userid specific user only, 0 means all users
|
||||||
*/
|
*/
|
||||||
function hotpot_update_grades($hotpot=null, $userid=0, $nullifnone=true) {
|
function hotpot_update_grades($hotpot, $userid=0, $nullifnone=true) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
require_once($CFG->libdir.'/gradelib.php');
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
|
|
||||||
if (is_null($hotpot)) {
|
// update (=create) grade for a single hotpot
|
||||||
// update (=create) grades for all hotpots
|
if ($grades = hotpot_get_user_grades($hotpot, $userid)) {
|
||||||
$sql = "
|
hotpot_grade_item_update($hotpot, $grades);
|
||||||
SELECT h.*, cm.idnumber as cmidnumber
|
|
||||||
FROM {hotpot} h, {course_modules} cm, {modules} m
|
} else if ($userid && $nullifnone) {
|
||||||
WHERE m.name='hotpot' AND m.id=cm.module AND cm.instance=h.id"
|
// no grades for this user, but we must force the creation of a "null" grade record
|
||||||
;
|
$grade = new object();
|
||||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
$grade->userid = $userid;
|
||||||
foreach ($rs as $hotpot) {
|
$grade->rawgrade = null;
|
||||||
hotpot_update_grades($hotpot, 0, false);
|
hotpot_grade_item_update($hotpot, $grade);
|
||||||
}
|
|
||||||
$rs->close();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// update (=create) grade for a single hotpot
|
// no grades and no userid
|
||||||
if ($grades = hotpot_get_user_grades($hotpot, $userid)) {
|
hotpot_grade_item_update($hotpot);
|
||||||
hotpot_grade_item_update($hotpot, $grades);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else if ($userid && $nullifnone) {
|
/**
|
||||||
// no grades for this user, but we must force the creation of a "null" grade record
|
* Update all grades in gradebook.
|
||||||
$grade = new object();
|
* this function is called from db/upgrade.php
|
||||||
$grade->userid = $userid;
|
* it iterates through the hotpots, calling hotpot_update_grades() to create a grade record for each hotpot
|
||||||
$grade->rawgrade = null;
|
*/
|
||||||
hotpot_grade_item_update($hotpot, $grade);
|
function hotpot_upgrade_grades() {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
} else {
|
// upgrade (=create) grades for all hotpots
|
||||||
// no grades and no userid
|
$sql = "
|
||||||
hotpot_grade_item_update($hotpot);
|
SELECT COUNT('x')
|
||||||
|
FROM {hotpot} h, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='hotpot' AND m.id=cm.module AND cm.instance=h.id";
|
||||||
|
$count = $DB->count_records_sql($sql);
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
SELECT h.*, cm.idnumber AS cmidnumber
|
||||||
|
FROM {hotpot} h, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='hotpot' AND m.id=cm.module AND cm.instance=h.id";
|
||||||
|
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||||
|
// too much debug output
|
||||||
|
$prevdebug = $DB->get_debug();
|
||||||
|
$DB->set_debug(false);
|
||||||
|
$pbar = new progress_bar('hotpotupgradegrades', 500, true);
|
||||||
|
$i=0;
|
||||||
|
foreach ($rs as $hotpot) {
|
||||||
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
|
hotpot_update_grades($hotpot, 0, false);
|
||||||
|
$pbar->update($i, $count, "Updating Hotpot grades ($i/$count).");
|
||||||
}
|
}
|
||||||
|
$DB->set_debug($prevdebug);
|
||||||
|
$rs->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1479,9 +1496,6 @@ class hotpot_xml_tree {
|
|||||||
if (empty($str)) {
|
if (empty($str)) {
|
||||||
$this->xml = array();
|
$this->xml = array();
|
||||||
} else {
|
} else {
|
||||||
if (empty($CFG->unicodedb)) {
|
|
||||||
$str = utf8_encode($str);
|
|
||||||
}
|
|
||||||
$this->xml = xmlize($str, 0);
|
$this->xml = xmlize($str, 0);
|
||||||
}
|
}
|
||||||
$this->xml_root = $xml_root;
|
$this->xml_root = $xml_root;
|
||||||
@ -1492,9 +1506,6 @@ class hotpot_xml_tree {
|
|||||||
eval('$value = &$this->xml'.$this->xml_root.$tags.$more_tags.';');
|
eval('$value = &$this->xml'.$this->xml_root.$tags.$more_tags.';');
|
||||||
|
|
||||||
if (is_string($value)) {
|
if (is_string($value)) {
|
||||||
if (empty($CFG->unicodedb)) {
|
|
||||||
$value = utf8_decode($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// decode angle brackets
|
// decode angle brackets
|
||||||
$value = strtr($value, array('<'=>'<', '>'=>'>', '&'=>'&'));
|
$value = strtr($value, array('<'=>'<', '>'=>'>', '&'=>'&'));
|
||||||
|
@ -16,22 +16,18 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_label_upgrade($oldversion=0) {
|
function xmldb_label_upgrade($oldversion) {
|
||||||
global $CFG, $THEME, $DB;
|
global $CFG, $DB;
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
|
||||||
/// block of code similar to the next one. Please, delete
|
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
|
||||||
/// $result = result of database_manager methods
|
|
||||||
/// }
|
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
if ($oldversion < 2007101510) {
|
if ($oldversion < 2007101510) {
|
||||||
$sql = "UPDATE {log_display} SET mtable = 'label' WHERE module = 'label'";
|
$sql = "UPDATE {log_display} SET mtable = 'label' WHERE module = 'label'";
|
||||||
$result = $DB->execute($sql);
|
$result = $DB->execute($sql);
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_lesson_upgrade($oldversion=0) {
|
function xmldb_lesson_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager();
|
$dbman = $DB->get_manager();
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
@ -385,43 +385,57 @@ function lesson_get_user_grades($lesson, $userid=0) {
|
|||||||
/**
|
/**
|
||||||
* Update grades in central gradebook
|
* Update grades in central gradebook
|
||||||
*
|
*
|
||||||
* @param object $lesson null means all lessons
|
* @param object $lesson
|
||||||
* @param int $userid specific user only, 0 mean all
|
* @param int $userid specific user only, 0 means all
|
||||||
*/
|
*/
|
||||||
function lesson_update_grades($lesson=null, $userid=0, $nullifnone=true) {
|
function lesson_update_grades($lesson, $userid=0, $nullifnone=true) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
if (!function_exists('grade_update')) { //workaround for buggy PHP versions
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
require_once($CFG->libdir.'/gradelib.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($lesson != null) {
|
if ($lesson->grade == 0) {
|
||||||
if ($grades = lesson_get_user_grades($lesson, $userid)) {
|
lesson_grade_item_update($lesson);
|
||||||
lesson_grade_item_update($lesson, $grades);
|
|
||||||
|
|
||||||
} else if ($userid and $nullifnone) {
|
} else if ($grades = lesson_get_user_grades($lesson, $userid)) {
|
||||||
$grade = new object();
|
lesson_grade_item_update($lesson, $grades);
|
||||||
$grade->userid = $userid;
|
|
||||||
$grade->rawgrade = NULL;
|
|
||||||
lesson_grade_item_update($lesson, $grade);
|
|
||||||
|
|
||||||
} else {
|
} else if ($userid and $nullifnone) {
|
||||||
lesson_grade_item_update($lesson);
|
$grade = new object();
|
||||||
}
|
$grade->userid = $userid;
|
||||||
|
$grade->rawgrade = NULL;
|
||||||
|
lesson_grade_item_update($lesson, $grade);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT l.*, cm.idnumber as cmidnumber, l.course as courseid
|
lesson_grade_item_update($lesson);
|
||||||
FROM {lesson} l, {course_modules} cm, {modules} m
|
}
|
||||||
WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
|
}
|
||||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
|
||||||
foreach ($rs as $lesson) {
|
/**
|
||||||
if ($lesson->grade != 0) {
|
* Update all grades in gradebook.
|
||||||
lesson_update_grades($lesson, 0, false);
|
*/
|
||||||
} else {
|
function lesson_upgrade_grades() {
|
||||||
lesson_grade_item_update($lesson);
|
global $DB;
|
||||||
}
|
|
||||||
}
|
$sql = "SELECT COUNT('x')
|
||||||
$rs->close();
|
FROM {lesson} l, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
|
||||||
|
$count = $DB->count_records_sql($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT l.*, cm.idnumber AS cmidnumber, l.course AS courseid
|
||||||
|
FROM {lesson} l, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
|
||||||
|
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||||
|
$prevdebug = $DB->get_debug();
|
||||||
|
$DB->set_debug(false);
|
||||||
|
$pbar = new progress_bar('lessonupgradegrades', 500, true);
|
||||||
|
$i=0;
|
||||||
|
foreach ($rs as $lesson) {
|
||||||
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
|
lesson_update_grades($lesson, 0, false);
|
||||||
|
$pbar->update($i, $count, "Updating Lesson grades ($i/$count).");
|
||||||
}
|
}
|
||||||
|
$DB->set_debug($prevdebug);
|
||||||
|
$rs->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_quiz_upgrade($oldversion=0) {
|
function xmldb_quiz_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager();
|
$dbman = $DB->get_manager();
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
@ -310,43 +310,57 @@ function quiz_format_grade($quiz, $grade) {
|
|||||||
/**
|
/**
|
||||||
* Update grades in central gradebook
|
* Update grades in central gradebook
|
||||||
*
|
*
|
||||||
* @param object $quiz null means all quizs
|
* @param object $quiz
|
||||||
* @param int $userid specific user only, 0 mean all
|
* @param int $userid specific user only, 0 means all
|
||||||
*/
|
*/
|
||||||
function quiz_update_grades($quiz=null, $userid=0, $nullifnone=true) {
|
function quiz_update_grades($quiz, $userid=0, $nullifnone=true) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
if (!function_exists('grade_update')) { //workaround for buggy PHP versions
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
require_once($CFG->libdir.'/gradelib.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($quiz != null) {
|
if ($quiz->grade == 0) {
|
||||||
if ($grades = quiz_get_user_grades($quiz, $userid)) {
|
quiz_grade_item_update($quiz);
|
||||||
quiz_grade_item_update($quiz, $grades);
|
|
||||||
|
|
||||||
} else if ($userid and $nullifnone) {
|
} else if ($grades = quiz_get_user_grades($quiz, $userid)) {
|
||||||
$grade = new object();
|
quiz_grade_item_update($quiz, $grades);
|
||||||
$grade->userid = $userid;
|
|
||||||
$grade->rawgrade = NULL;
|
|
||||||
quiz_grade_item_update($quiz, $grade);
|
|
||||||
|
|
||||||
} else {
|
} else if ($userid and $nullifnone) {
|
||||||
quiz_grade_item_update($quiz);
|
$grade = new object();
|
||||||
}
|
$grade->userid = $userid;
|
||||||
|
$grade->rawgrade = NULL;
|
||||||
|
quiz_grade_item_update($quiz, $grade);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid
|
quiz_grade_item_update($quiz);
|
||||||
FROM {quiz} a, {course_modules} cm, {modules} m
|
}
|
||||||
WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
|
}
|
||||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
|
||||||
foreach ($rs as $quiz) {
|
/**
|
||||||
if ($quiz->grade != 0) {
|
* Update all grades in gradebook.
|
||||||
quiz_update_grades($quiz, 0, false);
|
*/
|
||||||
} else {
|
function quiz_upgrade_grades() {
|
||||||
quiz_grade_item_update($quiz);
|
global $DB;
|
||||||
}
|
|
||||||
}
|
$sql = "SELECT COUNT('x')
|
||||||
$rs->close();
|
FROM {quiz} a, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
|
||||||
|
$count = $DB->count_records_sql($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT a.*, cm.idnumber AS cmidnumber, a.course AS courseid
|
||||||
|
FROM {quiz} a, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
|
||||||
|
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||||
|
$prevdebug = $DB->get_debug();
|
||||||
|
$DB->set_debug(false);
|
||||||
|
$pbar = new progress_bar('quizupgradegrades', 500, true);
|
||||||
|
$i=0;
|
||||||
|
foreach ($rs as $quiz) {
|
||||||
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
|
quiz_update_grades($quiz, 0, false);
|
||||||
|
$pbar->update($i, $count, "Updating Quiz grades ($i/$count).");
|
||||||
}
|
}
|
||||||
|
$DB->set_debug($prevdebug);
|
||||||
|
$rs->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class page_quiz extends page_generic_activity {
|
|||||||
|
|
||||||
function init_quick($data) {
|
function init_quick($data) {
|
||||||
if(empty($data->pageid)) {
|
if(empty($data->pageid)) {
|
||||||
print_error('cannotinitpage', '', '', null);
|
print_error('cannotinitpage', 'debug', '', (object)array('name'=>'quiz', 'id'=>'?'));
|
||||||
}
|
}
|
||||||
$this->activityname = 'quiz';
|
$this->activityname = 'quiz';
|
||||||
parent::init_quick($data);
|
parent::init_quick($data);
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
<?php // $Id$
|
<?php // $Id$
|
||||||
|
|
||||||
function xmldb_quizreport_overview_upgrade($oldversion=0) {
|
function xmldb_quizreport_overview_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
|
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager();
|
$dbman = $DB->get_manager();
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php // $Id$
|
<?php // $Id$
|
||||||
|
|
||||||
function xmldb_quizreport_statistics_upgrade($oldversion=0) {
|
function xmldb_quizreport_statistics_upgrade($oldversion) {
|
||||||
|
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
|
@ -16,21 +16,16 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_resource_upgrade($oldversion=0) {
|
function xmldb_resource_upgrade($oldversion) {
|
||||||
global $CFG, $THEME, $DB;
|
global $CFG, $DB;
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
|
||||||
/// block of code similar to the next one. Please, delete
|
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
|
||||||
/// $result = result of database_manager methods
|
|
||||||
/// }
|
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_scorm_upgrade($oldversion=0) {
|
function xmldb_scorm_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
$dbman = $DB->get_manager();
|
$dbman = $DB->get_manager();
|
||||||
|
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
@ -34,7 +35,7 @@ function xmldb_scorm_upgrade($oldversion=0) {
|
|||||||
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grademethod');
|
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grademethod');
|
||||||
|
|
||||||
/// Launch add field whatgrade
|
/// Launch add field whatgrade
|
||||||
if(!$dbman->field_exists($table,$field)) {
|
if (!$dbman->field_exists($table,$field)) {
|
||||||
$dbman->add_field($table, $field);
|
$dbman->add_field($table, $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,39 +441,54 @@ function scorm_get_user_grades($scorm, $userid=0) {
|
|||||||
/**
|
/**
|
||||||
* Update grades in central gradebook
|
* Update grades in central gradebook
|
||||||
*
|
*
|
||||||
* @param object $scorm null means all scormbases
|
* @param object $scorm
|
||||||
* @param int $userid specific user only, 0 mean all
|
* @param int $userid specific user only, 0 mean all
|
||||||
*/
|
*/
|
||||||
function scorm_update_grades($scorm=null, $userid=0, $nullifnone=true) {
|
function scorm_update_grades($scorm, $userid=0, $nullifnone=true) {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
if (!function_exists('grade_update')) { //workaround for buggy PHP versions
|
require_once($CFG->libdir.'/gradelib.php');
|
||||||
require_once($CFG->libdir.'/gradelib.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($scorm != null) {
|
if ($grades = scorm_get_user_grades($scorm, $userid)) {
|
||||||
if ($grades = scorm_get_user_grades($scorm, $userid)) {
|
scorm_grade_item_update($scorm, $grades);
|
||||||
scorm_grade_item_update($scorm, $grades);
|
|
||||||
|
|
||||||
} else if ($userid and $nullifnone) {
|
} else if ($userid and $nullifnone) {
|
||||||
$grade = new object();
|
$grade = new object();
|
||||||
$grade->userid = $userid;
|
$grade->userid = $userid;
|
||||||
$grade->rawgrade = NULL;
|
$grade->rawgrade = NULL;
|
||||||
scorm_grade_item_update($scorm, $grade);
|
scorm_grade_item_update($scorm, $grade);
|
||||||
|
|
||||||
} else {
|
|
||||||
scorm_grade_item_update($scorm);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT s.*, cm.idnumber as cmidnumber
|
scorm_grade_item_update($scorm);
|
||||||
FROM {scorm} s, {course_modules} cm, {modules} m
|
}
|
||||||
WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
|
}
|
||||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
|
||||||
foreach ($rs as $scorm) {
|
/**
|
||||||
scorm_update_grades($scorm, 0, false);
|
* Update all grades in gradebook.
|
||||||
}
|
*/
|
||||||
$rs->close();
|
function scorm_upgrade_grades() {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$sql = "SELECT COUNT('x')
|
||||||
|
FROM {scorm} s, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
|
||||||
|
$count = $DB->count_records_sql($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT s.*, cm.idnumber AS cmidnumber, s.course AS courseid
|
||||||
|
FROM {scorm} s, {course_modules} cm, {modules} m
|
||||||
|
WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
|
||||||
|
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||||
|
$prevdebug = $DB->get_debug();
|
||||||
|
$DB->set_debug(false);
|
||||||
|
$pbar = new progress_bar('scormupgradegrades', 500, true);
|
||||||
|
$i=0;
|
||||||
|
foreach ($rs as $scorm) {
|
||||||
|
$i++;
|
||||||
|
upgrade_set_timeout(60*5); // set up timeout, may also abort execution
|
||||||
|
scorm_update_grades($scorm, 0, false);
|
||||||
|
$pbar->update($i, $count, "Updating Scorm grades ($i/$count).");
|
||||||
}
|
}
|
||||||
|
$DB->set_debug($prevdebug);
|
||||||
|
$rs->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,22 +16,16 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_survey_upgrade($oldversion=0) {
|
function xmldb_survey_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
|
||||||
/// block of code similar to the next one. Please, delete
|
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
|
||||||
/// $result = result of database_manager methods
|
|
||||||
/// }
|
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -16,22 +16,16 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_wiki_upgrade($oldversion=0) {
|
function xmldb_wiki_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
|
||||||
/// block of code similar to the next one. Please, delete
|
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
|
||||||
/// $result = result of database_manager methods
|
|
||||||
/// }
|
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_calculated_upgrade($oldversion=0) {
|
function xmldb_qtype_calculated_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_datasetdependent_upgrade($oldversion=0) {
|
function xmldb_qtype_datasetdependent_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_essay_upgrade($oldversion=0) {
|
function xmldb_qtype_essay_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_match_upgrade($oldversion=0) {
|
function xmldb_qtype_match_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,22 +16,16 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_multianswer_upgrade($oldversion=0) {
|
function xmldb_qtype_multianswer_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
|
||||||
/// block of code similar to the next one. Please, delete
|
|
||||||
/// this comment lines once this file start handling proper
|
|
||||||
/// upgrade code.
|
|
||||||
|
|
||||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
|
||||||
/// $result = result of database_manager methods
|
|
||||||
/// }
|
|
||||||
|
|
||||||
if ($result && $oldversion < 2008050800) {
|
if ($result && $oldversion < 2008050800) {
|
||||||
question_multianswer_fix_subquestion_parents_and_categories();
|
question_multianswer_fix_subquestion_parents_and_categories();
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_multichoice_upgrade($oldversion=0) {
|
function xmldb_qtype_multichoice_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_numerical_upgrade($oldversion=0) {
|
function xmldb_qtype_numerical_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
//===== 1.9.0 upgrade line ======//
|
//===== 1.9.0 upgrade line ======//
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_randomsamatch_upgrade($oldversion=0) {
|
function xmldb_qtype_randomsamatch_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_shortanswer_upgrade($oldversion=0) {
|
function xmldb_qtype_shortanswer_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -16,11 +16,14 @@
|
|||||||
//
|
//
|
||||||
// The commands in here will all be database-neutral,
|
// The commands in here will all be database-neutral,
|
||||||
// using the methods of database_manager class
|
// using the methods of database_manager class
|
||||||
|
//
|
||||||
|
// Please do not forget to use upgrade_set_timeout()
|
||||||
|
// before any action that may take longer time to finish.
|
||||||
|
|
||||||
function xmldb_qtype_truefalse_upgrade($oldversion=0) {
|
function xmldb_qtype_truefalse_upgrade($oldversion) {
|
||||||
|
global $CFG, $DB;
|
||||||
global $CFG, $THEME, $DB;
|
|
||||||
|
|
||||||
|
$dbman = $DB->get_manager();
|
||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
/// And upgrade begins here. For each one, you'll need one
|
/// And upgrade begins here. For each one, you'll need one
|
||||||
|
@ -337,9 +337,6 @@
|
|||||||
$iconpath = $CFG->modpixpath.'/'.$listing->doctype.'/icon.gif';
|
$iconpath = $CFG->modpixpath.'/'.$listing->doctype.'/icon.gif';
|
||||||
$coursename = get_field('course', 'fullname', 'id', $listing->courseid);
|
$coursename = get_field('course', 'fullname', 'id', $listing->courseid);
|
||||||
$courseword = mb_convert_case(get_string('course', 'moodle'), MB_CASE_LOWER, 'UTF-8');
|
$courseword = mb_convert_case(get_string('course', 'moodle'), MB_CASE_LOWER, 'UTF-8');
|
||||||
//if ($CFG->unicodedb) {
|
|
||||||
//$listing->title = mb_convert_encoding($listing->title, 'auto', 'UTF8');
|
|
||||||
//}
|
|
||||||
$title_post_processing_function = $listing->doctype.'_link_post_processing';
|
$title_post_processing_function = $listing->doctype.'_link_post_processing';
|
||||||
$searchable_instance = $searchables[$listing->doctype];
|
$searchable_instance = $searchables[$listing->doctype];
|
||||||
if ($searchable_instance->location == 'internal'){
|
if ($searchable_instance->location == 'internal'){
|
||||||
|
@ -100,7 +100,7 @@ function useredit_shared_definition(&$mform) {
|
|||||||
$mform->setType('lastname', PARAM_NOTAGS);
|
$mform->setType('lastname', PARAM_NOTAGS);
|
||||||
|
|
||||||
// Do not show email field if change confirmation is pending
|
// Do not show email field if change confirmation is pending
|
||||||
if ($CFG->emailchangeconfirmation && !empty($user->preference_newemail)) {
|
if (!empty($CFG->emailchangeconfirmation) and !empty($user->preference_newemail)) {
|
||||||
$notice = get_string('auth_emailchangepending', 'auth', $user);
|
$notice = get_string('auth_emailchangepending', 'auth', $user);
|
||||||
$notice .= '<br /><a href="edit.php?cancelemailchange=1&id='.$user->id.'">'
|
$notice .= '<br /><a href="edit.php?cancelemailchange=1&id='.$user->id.'">'
|
||||||
. get_string('auth_emailchangecancel', 'auth') . '</a>';
|
. get_string('auth_emailchangecancel', 'auth') . '</a>';
|
||||||
@ -167,7 +167,7 @@ function useredit_shared_definition(&$mform) {
|
|||||||
$mform->setAdvanced('trackforums');
|
$mform->setAdvanced('trackforums');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($CFG->htmleditor) {
|
if (!empty($CFG->htmleditor)) {
|
||||||
$choices = array();
|
$choices = array();
|
||||||
$choices['0'] = get_string('texteditor');
|
$choices['0'] = get_string('texteditor');
|
||||||
$choices['1'] = get_string('htmleditor');
|
$choices['1'] = get_string('htmleditor');
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// This is compared against the values stored in the database to determine
|
// This is compared against the values stored in the database to determine
|
||||||
// whether upgrades should be performed (see lib/db/*.php)
|
// whether upgrades should be performed (see lib/db/*.php)
|
||||||
|
|
||||||
$version = 2008081506; // YYYYMMDD = date of the last version bump
|
$version = 2008081600; // YYYYMMDD = date of the last version bump
|
||||||
// XX = daily increments
|
// XX = daily increments
|
||||||
|
|
||||||
$release = '2.0 dev (Build: 20080816)'; // Human-friendly version name
|
$release = '2.0 dev (Build: 20080816)'; // Human-friendly version name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user