Skip to content

Commit

Permalink
MDL-16002 rewritten upgrade locking and better upgrade progress track…
Browse files Browse the repository at this point in the history
…ing; MDL-16070 Do not use $a[0] syntax in lang packs + various other upgrade improvements and fixes
  • Loading branch information
skodak committed Aug 16, 2008
1 parent 9deded3 commit 775f811
Show file tree
Hide file tree
Showing 85 changed files with 1,053 additions and 836 deletions.
2 changes: 1 addition & 1 deletion admin/auth_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
$plugin = "auth/$auth";
$name = $matches[1];
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));
}
}
}
Expand Down
9 changes: 0 additions & 9 deletions admin/cliupgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,9 +819,6 @@

$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

// Install the roles system.
Expand Down Expand Up @@ -868,12 +865,6 @@
if ($CFG->version) {
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->newversion = "$release ($version)";
$strdatabasechecking = get_string("databasechecking", "", $a);
Expand Down
324 changes: 153 additions & 171 deletions admin/index.php

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions admin/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
if ($location || $plugin) {
// file in an extra location
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) {
notify($streditingnoncorelangfile);
Expand All @@ -413,7 +413,7 @@
} else {
// file in standard location
if ($currentfile != $filename) {
print_error('filemismatch', 'error', '', array($currectfile, $filename, ''));
print_error('filemismatch', 'error', '', (object)array('current'=>$currectfile, 'file'=>$filename.'.php'));
}
}

Expand Down Expand Up @@ -467,7 +467,7 @@
if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
} 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);
}
Expand Down
4 changes: 2 additions & 2 deletions admin/settings/misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

// Completion system
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_pickroles('progresstrackedroles',get_string('progresstrackedroles','completion'),get_string('configprogresstrackedroles','completion')));
$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'), array('moodle/legacy:student')));

$ADMIN->add('misc', $temp);

Expand Down
9 changes: 6 additions & 3 deletions backup/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_backup_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/activity_modules/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_activity_modules_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/admin/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_admin_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/calendar_month/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_calendar_month_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/calendar_upcoming/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_calendar_upcoming_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/course_list/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_course_list_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/course_summary/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_course_summary_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 5 additions & 4 deletions blocks/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_blocks_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();

$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/news_items/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_news_items_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/online_users/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_online_users_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/participants/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_participants_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/recent_activity/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_recent_activity_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/rss_client/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_rss_client_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
5 changes: 2 additions & 3 deletions blocks/search/config_global.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,11 @@
if(isset($CFG->block_search_pdf_to_text_cmd)) {
p($CFG->block_search_pdf_to_text_cmd);
} else {
$encoding = ($CFG->unicodedb) ? "-enc UTF-8" : "-enc ISO-8859-1" ;
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{
p("lib/xpdf/linux/pdftotext $encoding -eol unix -q");
p("lib/xpdf/linux/pdftotext -enc UTF-8 -eol unix -q");
}
} ?>"/><br/><br/>
</td>
Expand Down
9 changes: 6 additions & 3 deletions blocks/search/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_search_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/search_forums/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_search_forums_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/section_links/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_section_links_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
9 changes: 6 additions & 3 deletions blocks/social_activities/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
//
// The commands in here will all be database-neutral,
// 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) {

global $CFG, $THEME, $DB;
function xmldb_block_social_activities_upgrade($oldversion) {
global $CFG, $DB;

$dbman = $DB->get_manager();
$result = true;

/// And upgrade begins here. For each one, you'll need one
Expand Down
Loading

0 comments on commit 775f811

Please sign in to comment.