Insert all the distributed timezones upon upgrade

This commit is contained in:
moodler 2005-04-11 08:11:17 +00:00
parent a8021f5641
commit 6927f0e726
3 changed files with 25 additions and 1 deletions

View File

@ -1322,6 +1322,18 @@ function main_upgrade($oldversion=0) {
table_column('user', 'timezone', 'timezone', 'varchar', '100', '', '99');
execute_sql(" ALTER TABLE `{$CFG->prefix}user` DROP `timezonename` ");
}
if ($oldversion < 2005041101) {
require_once($CFG->libdir.'/filelib.php');
if (is_readable($CFG->dirroot.'/lib/timezones.txt')) { // Distribution file
if ($timezones = get_records_csv($CFG->dirroot.'/lib/timezones.txt', 'timezone')) {
$db->debug = false;
update_timezone_records($timezones);
notify(count($timezones).' timezones installed');
$db->debug = true;
}
}
}
return $result;
}

View File

@ -1039,6 +1039,18 @@ function main_upgrade($oldversion=0) {
execute_sql(" ALTER TABLE `{$CFG->prefix}user` DROP `timezonename` ");
}
if ($oldversion < 2005041101) {
require_once($CFG->libdir.'/filelib.php');
if (is_readable($CFG->dirroot.'/lib/timezones.txt')) { // Distribution file
if ($timezones = get_records_csv($CFG->dirroot.'/lib/timezones.txt', 'timezone')) {
$db->debug = false;
update_timezone_records($timezones);
notify(count($timezones).' timezones installed');
$db->debug = true;
}
}
}
return $result;
}

View File

@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2005040800; // YYYYMMDD = date
$version = 2005041101; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.5 UNSTABLE DEVELOPMENT'; // Human-friendly version name