From: skodak Date: Tue, 6 Jan 2009 18:14:28 +0000 (+0000) Subject: MDL-14123 Full IPv6 support - updating all db fields to theoretical 45 char limit X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=656be893014acf51086d80d97e173c1c7499b6c8;p=moodle.git MDL-14123 Full IPv6 support - updating all db fields to theoretical 45 char limit --- diff --git a/lib/db/install.xml b/lib/db/install.xml index b11355d0fb..e66d7f2cfa 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -312,7 +312,7 @@ - + @@ -420,21 +420,23 @@ - - + + + - - - + + + - + + @@ -496,7 +498,7 @@ - + @@ -1152,7 +1154,7 @@ - + @@ -1191,7 +1193,7 @@ - + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index c407436521..abb89504d3 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -926,7 +926,7 @@ function xmldb_main_upgrade($oldversion) { if (isset($roleids['user'])) { $rolecontextlevels[$roleids['user']] = get_default_contextlevels('user'); } - + /// See what other role assignments are in this database, extend the allowed /// lists to allow them too. $existingrolecontextlevels = $DB->get_recordset_sql('SELECT DISTINCT ra.roleid, con.contextlevel FROM @@ -1165,7 +1165,82 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint($result, 2008121701); } - if ($result && $oldversion < 2008123100) { + if ($result && $oldversion < 2009010500) { + /// clean up config table a bit + unset_config('session_error_counter'); + + /// Main savepoint reached + upgrade_main_savepoint($result, 2009010500); + } + + if ($result && $oldversion < 2009010600) { + + /// Define field originalquestion to be dropped from question_states + $table = new xmldb_table('question_states'); + $field = new xmldb_field('originalquestion'); + + /// Conditionally launch drop field originalquestion + if ($dbman->field_exists($table, $field)) { + $dbman->drop_field($table, $field); + } + + /// Main savepoint reached + upgrade_main_savepoint($result, 2009010600); + } + + if ($result && $oldversion < 2009010601) { + + /// Changing precision of field ip on table log to (45) + $table = new xmldb_table('log'); + $field = new xmldb_field('ip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, null, null, 'userid'); + + /// Launch change of precision for field ip + $dbman->change_field_precision($table, $field); + + /// Main savepoint reached + upgrade_main_savepoint($result, 2009010601); + } + + if ($result && $oldversion < 2009010602) { + + /// Changing precision of field lastip on table user to (45) + $table = new xmldb_table('user'); + $field = new xmldb_field('lastip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, null, null, 'currentlogin'); + + /// Launch change of precision for field lastip + $dbman->change_field_precision($table, $field); + + /// Main savepoint reached + upgrade_main_savepoint($result, 2009010602); + } + + if ($result && $oldversion < 2009010603) { + + /// Changing precision of field ip_address on table mnet_host to (45) + $table = new xmldb_table('mnet_host'); + $field = new xmldb_field('ip_address', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, null, null, 'wwwroot'); + + /// Launch change of precision for field ip_address + $dbman->change_field_precision($table, $field); + + /// Main savepoint reached + upgrade_main_savepoint($result, 2009010603); + } + + if ($result && $oldversion < 2009010604) { + + /// Changing precision of field ip on table mnet_log to (45) + $table = new xmldb_table('mnet_log'); + $field = new xmldb_field('ip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, null, null, 'userid'); + + /// Launch change of precision for field ip + $dbman->change_field_precision($table, $field); + + /// Main savepoint reached + upgrade_main_savepoint($result, 2009010604); + } + + if ($result && $oldversion < 2009010605) { /// Define table sessions to be dropped $table = new xmldb_table('sessions2'); @@ -1175,30 +1250,40 @@ function xmldb_main_upgrade($oldversion) { $dbman->drop_table($table); } + /// Define table sessions to be dropped + $table = new xmldb_table('sessions'); + + /// Conditionally launch drop table for sessions + if ($dbman->table_exists($table)) { + $dbman->drop_table($table); + } + /// Main savepoint reached - upgrade_main_savepoint($result, 2008123100); + upgrade_main_savepoint($result, 2009010605); } - if ($result && $oldversion < 2008123101) { + if ($result && $oldversion < 2009010606) { /// Define table sessions to be created $table = new xmldb_table('sessions'); /// Adding fields to table sessions $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); + $table->add_field('state', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); $table->add_field('sid', XMLDB_TYPE_CHAR, '128', null, XMLDB_NOTNULL, null, null, null, null); $table->add_field('sessdata', XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null); $table->add_field('timecreated', 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); $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null); - $table->add_field('lastip', XMLDB_TYPE_CHAR, '40', null, null, null, null, null, null); - $table->add_field('sesskey', XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, null, null, null); + $table->add_field('firstip', XMLDB_TYPE_CHAR, '45', null, null, null, null, null, null); + $table->add_field('lastip', XMLDB_TYPE_CHAR, '45', null, null, null, null, null, null); /// Adding keys to table sessions $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id')); /// Adding indexes to table sessions + $table->add_index('state', XMLDB_INDEX_NOTUNIQUE, array('state')); $table->add_index('sid', XMLDB_INDEX_UNIQUE, array('sid')); $table->add_index('timecreated', XMLDB_INDEX_NOTUNIQUE, array('timecreated')); $table->add_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified')); @@ -1207,30 +1292,7 @@ function xmldb_main_upgrade($oldversion) { $dbman->create_table($table); /// Main savepoint reached - upgrade_main_savepoint($result, 2008123101); - } - - if ($result && $oldversion < 2009010500) { - /// clean up config table a bit - unset_config('session_error_counter'); - - /// Main savepoint reached - upgrade_main_savepoint($result, 2009010500); - } - - if ($result && $oldversion < 2009010600) { - - /// Define field originalquestion to be dropped from question_states - $table = new xmldb_table('question_states'); - $field = new xmldb_field('originalquestion'); - - /// Conditionally launch drop field originalquestion - if ($dbman->field_exists($table, $field)) { - $dbman->drop_field($table, $field); - } - - /// Main savepoint reached - upgrade_main_savepoint($result, 2009010600); + upgrade_main_savepoint($result, 2009010606); } return $result; diff --git a/mod/chat/db/install.xml b/mod/chat/db/install.xml index 1cad1e1fe6..63b9b91e38 100644 --- a/mod/chat/db/install.xml +++ b/mod/chat/db/install.xml @@ -70,7 +70,7 @@ - + diff --git a/mod/chat/db/upgrade.php b/mod/chat/db/upgrade.php index acf4d72a88..875e6cfd00 100644 --- a/mod/chat/db/upgrade.php +++ b/mod/chat/db/upgrade.php @@ -58,6 +58,19 @@ function xmldb_chat_upgrade($oldversion) { upgrade_mod_savepoint($result, 2008072400, '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, 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'); + } + return $result; } diff --git a/mod/chat/version.php b/mod/chat/version.php index 70e959a59e..4a38fe6f63 100644 --- a/mod/chat/version.php +++ b/mod/chat/version.php @@ -5,7 +5,7 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2008081401; // The (date) version of this module +$module->version = 2009010600; // The (date) version of this module $module->requires = 2007101509; // Requires this Moodle version $module->cron = 300; // How often should cron check this module (seconds)? diff --git a/version.php b/version.php index d08cd028f7..637d700e4d 100644 --- a/version.php +++ b/version.php @@ -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 = 2009010600; // YYYYMMDD = date of the last version bump + $version = 2009010606; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20090106)'; // Human-friendly version name