MDL-14123 Full IPv6 support - updating all db fields to theoretical 45 char limit

This commit is contained in:
skodak 2009-01-06 18:14:28 +00:00
parent b62dff9939
commit 656be89301
6 changed files with 136 additions and 59 deletions

View File

@ -312,7 +312,7 @@
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="time"/>
<FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="time" NEXT="ip"/>
<FIELD NAME="ip" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="course"/>
<FIELD NAME="ip" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="course"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ip" NEXT="module"/>
<FIELD NAME="module" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="cmid"/>
<FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="module" NEXT="action"/>
@ -420,21 +420,23 @@
</TABLE>
<TABLE NAME="sessions" COMMENT="Database based session storage - now recommended" PREVIOUS="modules" NEXT="timezone">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="sid"/>
<FIELD NAME="sid" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Session id" PREVIOUS="id" NEXT="sessdata"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="state"/>
<FIELD NAME="state" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="0 means normal session" PREVIOUS="id" NEXT="sid"/>
<FIELD NAME="sid" TYPE="char" LENGTH="128" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Session id" PREVIOUS="state" NEXT="sessdata"/>
<FIELD NAME="sessdata" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="session content" PREVIOUS="sid" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="sessdata" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified" NEXT="lastip"/>
<FIELD NAME="lastip" TYPE="char" LENGTH="40" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="sesskey"/>
<FIELD NAME="sesskey" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="lastip"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified" NEXT="firstip"/>
<FIELD NAME="firstip" TYPE="char" LENGTH="45" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="lastip"/>
<FIELD NAME="lastip" TYPE="char" LENGTH="45" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="firstip"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="userid"/>
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" PREVIOUS="primary"/>
</KEYS>
<INDEXES>
<INDEX NAME="sid" UNIQUE="true" FIELDS="sid" NEXT="timecreated"/>
<INDEX NAME="state" UNIQUE="false" FIELDS="state" NEXT="sid"/>
<INDEX NAME="sid" UNIQUE="true" FIELDS="sid" PREVIOUS="state" NEXT="timecreated"/>
<INDEX NAME="timecreated" UNIQUE="false" FIELDS="timecreated" PREVIOUS="sid" NEXT="timemodified"/>
<INDEX NAME="timemodified" UNIQUE="false" FIELDS="timemodified" PREVIOUS="timecreated"/>
</INDEXES>
@ -496,7 +498,7 @@
<FIELD NAME="lastaccess" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="firstaccess" NEXT="lastlogin"/>
<FIELD NAME="lastlogin" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lastaccess" NEXT="currentlogin"/>
<FIELD NAME="currentlogin" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lastlogin" NEXT="lastip"/>
<FIELD NAME="lastip" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="currentlogin" NEXT="secret"/>
<FIELD NAME="lastip" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="currentlogin" NEXT="secret"/>
<FIELD NAME="secret" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="lastip" NEXT="picture"/>
<FIELD NAME="picture" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="secret" NEXT="url"/>
<FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="picture" NEXT="description"/>
@ -1152,7 +1154,7 @@
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" COMMENT="Unique Host ID" NEXT="deleted"/>
<FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="wwwroot"/>
<FIELD NAME="wwwroot" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="deleted" NEXT="ip_address"/>
<FIELD NAME="ip_address" TYPE="char" LENGTH="39" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="wwwroot" NEXT="name"/>
<FIELD NAME="ip_address" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="wwwroot" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="80" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="ip_address" NEXT="public_key"/>
<FIELD NAME="public_key" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="public_key_expires"/>
<FIELD NAME="public_key_expires" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="public_key" NEXT="transport"/>
@ -1191,7 +1193,7 @@
<FIELD NAME="remoteid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="hostid" NEXT="time"/>
<FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="remoteid" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="time" NEXT="ip"/>
<FIELD NAME="ip" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="course"/>
<FIELD NAME="ip" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="course"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ip" NEXT="coursename"/>
<FIELD NAME="coursename" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="module"/>
<FIELD NAME="module" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="coursename" NEXT="cmid"/>

View File

@ -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,51 +1165,6 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint($result, 2008121701);
}
if ($result && $oldversion < 2008123100) {
/// Define table sessions to be dropped
$table = new xmldb_table('sessions2');
/// Conditionally launch drop table for sessions
if ($dbman->table_exists($table)) {
$dbman->drop_table($table);
}
/// Main savepoint reached
upgrade_main_savepoint($result, 2008123100);
}
if ($result && $oldversion < 2008123101) {
/// 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('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);
/// 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('sid', XMLDB_INDEX_UNIQUE, array('sid'));
$table->add_index('timecreated', XMLDB_INDEX_NOTUNIQUE, array('timecreated'));
$table->add_index('timemodified', XMLDB_INDEX_NOTUNIQUE, array('timemodified'));
/// Launch create table for sessions
$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');
@ -1233,6 +1188,113 @@ function xmldb_main_upgrade($oldversion) {
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');
/// Conditionally launch drop table for sessions
if ($dbman->table_exists($table)) {
$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, 2009010605);
}
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('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'));
/// Launch create table for sessions
$dbman->create_table($table);
/// Main savepoint reached
upgrade_main_savepoint($result, 2009010606);
}
return $result;
}

View File

@ -70,7 +70,7 @@
<FIELD NAME="userid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="chatid" NEXT="groupid"/>
<FIELD NAME="groupid" TYPE="int" LENGTH="11" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="version"/>
<FIELD NAME="version" TYPE="char" LENGTH="16" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="groupid" NEXT="ip"/>
<FIELD NAME="ip" TYPE="char" LENGTH="15" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="version" NEXT="firstping"/>
<FIELD NAME="ip" TYPE="char" LENGTH="45" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="version" NEXT="firstping"/>
<FIELD NAME="firstping" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ip" NEXT="lastping"/>
<FIELD NAME="lastping" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="firstping" NEXT="lastmessageping"/>
<FIELD NAME="lastmessageping" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lastping" NEXT="sid"/>

View File

@ -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;
}

View File

@ -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)?

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 = 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