MDL-22297, use bigger version number to bump 1.9 upgrade

This commit is contained in:
Dongsheng Cai
2010-05-04 05:09:30 +00:00
parent 1cea3c80b6
commit a2bd5aba3d
3 changed files with 47 additions and 44 deletions
+33 -31
View File
@@ -26,9 +26,36 @@ function xmldb_chat_upgrade($oldversion) {
$dbman = $DB->get_manager();
$result = true;
//===== 1.9.0 upgrade line ======//
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2008072400) {
if ($result && $oldversion < 2010050100) {
/// Changing precision of field ip on table chat_users to (45)
$table = new xmldb_table('chat_users');
$field = new xmldb_field('ip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, 'version');
/// Launch change of precision for field ip
$dbman->change_field_precision($table, $field);
/// chat savepoint reached
upgrade_mod_savepoint($result, 2010050100, 'chat');
}
if ($result && $oldversion < 2010050101) {
/// Define field introformat to be added to chat
$table = new xmldb_table('chat');
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
/// Launch add field introformat
$dbman->add_field($table, $field);
/// chat savepoint reached
upgrade_mod_savepoint($result, 2010050101, 'chat');
}
/// Creating chat_messages_current to hold latest chat messages
if ($result && $oldversion < 2010050102) {
/// Define table chat_messages_current to be created
$table = new xmldb_table('chat_messages_current');
@@ -52,38 +79,13 @@ function xmldb_chat_upgrade($oldversion) {
$table->add_index('timestamp-chatid', XMLDB_INDEX_NOTUNIQUE, array('timestamp', 'chatid'));
/// create table for chat_messages_current
$dbman->create_table($table);
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
/// chat savepoint reached
upgrade_mod_savepoint($result, 2008072400, 'chat');
upgrade_mod_savepoint($result, 2010050102, 'chat');
}
if ($result && $oldversion < 2009010600) {
/// Changing precision of field ip on table chat_users to (45)
$table = new xmldb_table('chat_users');
$field = new xmldb_field('ip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, 'version');
/// Launch change of precision for field ip
$dbman->change_field_precision($table, $field);
/// chat savepoint reached
upgrade_mod_savepoint($result, 2009010600, 'chat');
}
if ($result && $oldversion < 2009042000) {
/// Define field introformat to be added to chat
$table = new xmldb_table('chat');
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
/// Launch add field introformat
$dbman->add_field($table, $field);
/// chat savepoint reached
upgrade_mod_savepoint($result, 2009042000, 'chat');
}
return $result;
}
+1 -1
View File
@@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2009042000; // The (date) version of this module
$module->version = 2010050102; // The (date) version of this module
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?
+13 -12
View File
@@ -112,18 +112,6 @@
if (has_capability('mod/chat:chat',$context)) {
/// Print the main part of the page
echo $OUTPUT->box_start('generalbox', 'enterlink');
// users with screenreader set, will only see 1 link, to the manual refresh page
// for better accessibility
if (!empty($USER->screenreader)) {
$chattarget = "/mod/chat/gui_basic/index.php?id=$chat->id$groupparam";
} else {
$chattarget = "/mod/chat/gui_$CFG->chat_method/index.php?id=$chat->id$groupparam";
}
echo '<p>';
echo $OUTPUT->action_link($chattarget, $strenterchat, new popup_action('click', $chattarget, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700)));
echo '</p>';
if ($CFG->enableajax) {
echo '<p>';
@@ -131,10 +119,23 @@
$link = new moodle_url("/mod/chat/gui_ajax/index.php?id=$chat->id$groupparam");
$action = new popup_action('click', $link, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700, 'toolbar' => false, 'resizeable' => false, 'status' => false));
echo $OUTPUT->action_link($link, get_string('ajax_gui', 'message'), $action, array('title'=>get_string('modulename', 'chat')));
echo '</p>';
} else {
if (!empty($USER->screenreader)) {
$chattarget = "/mod/chat/gui_basic/index.php?id=$chat->id$groupparam";
} else {
$chattarget = "/mod/chat/gui_$CFG->chat_method/index.php?id=$chat->id$groupparam";
}
echo '<p>';
echo $OUTPUT->action_link($chattarget, $strenterchat, new popup_action('click', $chattarget, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700)));
echo '</p>';
}
// if user is using screen reader, then there is no need to display this link again
// users with screenreader set, will only see 1 link, to the manual refresh page
// for better accessibility
if ($CFG->chat_method == 'header_js' && empty($USER->screenreader)) {
// show frame/js-less alternative
echo '<p>(';