diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2007-07-18 09:49:48 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2007-07-18 09:49:48 +0200 |
commit | fd12989ef8eab0fc9816decb8bcabccd1d213ee8 (patch) | |
tree | 68b12cc05704f2181a90d69b898f999309a8c036 | |
parent | 1a1c15f5da352895fb32daab8550cb3dca8198ac (diff) |
auf 1.10.1 aktualisiert
73 files changed, 500 insertions, 425 deletions
diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 95172e56..a2bc56c5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -3,6 +3,30 @@ Security reminder: MediaWiki does not require PHP's register_globals setting since version 1.2.0. If you have it on, turn it *off* if you can. +== MediaWiki 1.10.1 == + +July 13, 2007 + +This is a bugfix update to the Spring 2007 quarterly release snapshot. +A number of fixes to improve compatibility with PostgreSQL, some versions +of MySQL, and some PHP configurations are included. + +Changes since 1.10.0: + +* (bug 9417) Uploading new versions of images when using Postgres no longer + throws warnings. +* (bug 9908) Using tsearch2 with Postgres 8.1 no longer gives an error. +* (bug 9973) Changed size was shown in advanced recentchanges collapsible items + with $wgRCShowChangedSized = false. +* Fixed installation on MyISAM or old InnoDB with charset=utf8, was giving + overlong key errors. +* Fixed zero-padding issues with MySQL 5 binary schema +* (bug 9820) session.save_path check no longer halts installation, but + warns of possible bad values +* (bug 9978) Fixed session.save_path validation when using extended + configuration format, e.g. "5;/tmp" + + == MediaWiki 1.10.0 == May 9, 2007 diff --git a/config/index.php b/config/index.php index d036e8c8..e719e47e 100644 --- a/config/index.php +++ b/config/index.php @@ -395,7 +395,8 @@ if( !function_exists( 'session_name' ) ) # session.save_path doesn't *have* to be set, but if it is, and it's # not valid/writable/etc. then it can cause problems -$sessionSavePath = ini_get( 'session.save_path' ); +$sessionSavePath = mw_get_session_save_path(); +$ssp = htmlspecialchars( $sessionSavePath ); # Warn the user if it's not set, but let them proceed if( !$sessionSavePath ) { print "<li><strong>Warning:</strong> A value for <tt>session.save_path</tt> @@ -404,14 +405,12 @@ if( !$sessionSavePath ) { for the user your web server is running under.</li>"; } elseif ( is_dir( $sessionSavePath ) && is_writable( $sessionSavePath ) ) { # All good? Let the user know - print "<li>Session save path appears to be valid.</li>"; + print "<li>Session save path (<tt>{$ssp}</tt>) appears to be valid.</li>"; } else { - # Something not right? Halt the installation so the user can fix it up - dieout( "Your session save path appears to be invalid or is not writable. - PHP needs to be able to save data to this location in order for correct - session operation. Please check that <tt>session.save_path</tt> in - <tt>PHP.ini</tt> points to a valid path, and is read/write/execute for - the user your web server is running under." ); + # Something not right? Warn the user, but let them proceed + print "<li><strong>Warning:</strong> Your <tt>session.save_path</tt> value (<tt>{$ssp}</tt>) + appears to be invalid or is not writable. PHP needs to be able to save data to + this location for correct session operation.</li>"; } # Check for PCRE support @@ -839,45 +838,48 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { if( $wgDatabase->tableExists( "cur" ) || $wgDatabase->tableExists( "revision" ) ) { print "<li>There are already MediaWiki tables in this database. Checking if updates are needed...</li>\n"; - # Determine existing default character set - if ( $wgDatabase->tableExists( "revision" ) ) { - $revision = $wgDatabase->escapeLike( $conf->DBprefix . 'revision' ); - $res = $wgDatabase->query( "SHOW TABLE STATUS LIKE '$revision'" ); - $row = $wgDatabase->fetchObject( $res ); - if ( !$row ) { - echo "<li>SHOW TABLE STATUS query failed!</li>\n"; - $existingSchema = false; - } elseif ( preg_match( '/^latin1/', $row->Collation ) ) { - $existingSchema = 'mysql4'; - } elseif ( preg_match( '/^utf8/', $row->Collation ) ) { - $existingSchema = 'mysql5'; - } elseif ( preg_match( '/^binary/', $row->Collation ) ) { - $existingSchema = 'mysql5-binary'; - } else { - $existingSchema = false; - echo "<li><strong>Warning:</strong> Unrecognised existing collation</li>\n"; - } - if ( $existingSchema && $existingSchema != $conf->DBschema ) { - print "<li><strong>Warning:</strong> you requested the {$conf->DBschema} schema, " . - "but the existing database has the $existingSchema schema. This upgrade script ". - "can't convert it, so it will remain $existingSchema.</li>\n"; - $conf->setSchema( $existingSchema ); + if ( $conf->DBtype == 'mysql') { + + # Determine existing default character set + if ( $wgDatabase->tableExists( "revision" ) ) { + $revision = $wgDatabase->escapeLike( $conf->DBprefix . 'revision' ); + $res = $wgDatabase->query( "SHOW TABLE STATUS LIKE '$revision'" ); + $row = $wgDatabase->fetchObject( $res ); + if ( !$row ) { + echo "<li>SHOW TABLE STATUS query failed!</li>\n"; + $existingSchema = false; + } elseif ( preg_match( '/^latin1/', $row->Collation ) ) { + $existingSchema = 'mysql4'; + } elseif ( preg_match( '/^utf8/', $row->Collation ) ) { + $existingSchema = 'mysql5'; + } elseif ( preg_match( '/^binary/', $row->Collation ) ) { + $existingSchema = 'mysql5-binary'; + } else { + $existingSchema = false; + echo "<li><strong>Warning:</strong> Unrecognised existing collation</li>\n"; + } + if ( $existingSchema && $existingSchema != $conf->DBschema ) { + print "<li><strong>Warning:</strong> you requested the {$conf->DBschema} schema, " . + "but the existing database has the $existingSchema schema. This upgrade script ". + "can't convert it, so it will remain $existingSchema.</li>\n"; + $conf->setSchema( $existingSchema ); + } } - } - # Create user if required (todo: other databases) - if ( $conf->Root && $conf->DBtype == 'mysql') { - $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 ); - if ( $conn->isOpen() ) { - print "<li>DB user account ok</li>\n"; - $conn->close(); - } else { - print "<li>Granting user permissions..."; - if( $mysqlOldClient && $mysqlNewAuth ) { - print " <b class='error'>If the next step fails, see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'>http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>"; + # Create user if required + if ( $conf->Root ) { + $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 ); + if ( $conn->isOpen() ) { + print "<li>DB user account ok</li>\n"; + $conn->close(); + } else { + print "<li>Granting user permissions..."; + if( $mysqlOldClient && $mysqlNewAuth ) { + print " <b class='error'>If the next step fails, see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'>http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>"; + } + print "</li>\n"; + dbsource( "../maintenance/users.sql", $wgDatabase ); } - print "</li>\n"; - dbsource( "../maintenance/users.sql", $wgDatabase ); } } print "</ul><pre>\n"; diff --git a/includes/ChangesList.php b/includes/ChangesList.php index bc141579..751e1226 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -497,18 +497,19 @@ class EnhancedChangesList extends ChangesList { $r .= ') . . '; - # Character difference - $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'], - $block[0]->mAttribs['rc_new_len'] ); - if( $chardiff == '' ) { - $r .= ' ('; - } else { - $r .= ' ' . $chardiff. ' . . ('; - } - + if( $wgRCShowChangedSize ) { + # Character difference + $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'], + $block[0]->mAttribs['rc_new_len'] ); + if( $chardiff == '' ) { + $r .= ' ('; + } else { + $r .= ' ' . $chardiff. ' . . '; + } + } # History - $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(), + $r .= '(' . $this->skin->makeKnownLinkObj( $block[0]->getTitle(), $this->message['history'], $curIdEq.'&action=history' ); $r .= ')'; } diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 7158e2d1..07b3339d 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -378,7 +378,10 @@ class DatabasePostgres extends Database { "WHERE relname = 'pg_pltemplate' AND nspname='pg_catalog'"; $rows = $this->numRows($this->doQuery($SQL)); if ($rows >= 1) { + $olde = error_reporting(0); + error_reporting($olde - E_WARNING); $result = $this->doQuery("CREATE LANGUAGE plpgsql"); + error_reporting($olde); if (!$result) { print "<b>FAILED</b>. You need to install the language plpgsql in the database <tt>$wgDBname</tt></li>"; dieout("</ul>"); @@ -512,7 +515,7 @@ class DatabasePostgres extends Database { # TODO: # hashar : not sure if the following test really trigger if the object - # fetching failled. + # fetching failed. if( pg_last_error($this->mConn) ) { throw new DBUnexpectedError($this, 'SQL error: ' . htmlspecialchars( pg_last_error($this->mConn) ) ); } @@ -558,6 +561,9 @@ class DatabasePostgres extends Database { } function affectedRows() { + if( !isset( $this->mLastResult ) ) + return 0; + return pg_affected_rows( $this->mLastResult ); } @@ -619,33 +625,83 @@ class DatabasePostgres extends Database { } - function insert( $table, $a, $fname = 'Database::insert', $options = array() ) { - # Postgres doesn't support options - # We have a go at faking one of them - # TODO: DELAYED, LOW_PRIORITY + /** + * INSERT wrapper, inserts an array into a table + * + * $args may be a single associative array, or an array of these with numeric keys, + * for multi-row insert (Postgres version 8.2 and above only). + * + * @param array $table String: Name of the table to insert to. + * @param array $args Array: Items to insert into the table. + * @param array $fname String: Name of the function, for profiling + * @param mixed $options String or Array. Valid options: IGNORE + * + * @return bool Success of insert operation. IGNORE always returns true. + */ + function insert( $table, $args, $fname = 'DatabasePostgres::insert', $options = array() ) { + global $wgDBversion; - if ( !is_array($options)) - $options = array($options); + $table = $this->tableName( $table ); + if (! isset( $wgDBversion ) ) { + $this->getServerVersion(); + $wgDBversion = $this->numeric_version; + } - if ( in_array( 'IGNORE', $options ) ) - $oldIgnore = $this->ignoreErrors( true ); + if ( !is_array( $options ) ) + $options = array( $options ); - # IGNORE is performed using single-row inserts, ignoring errors in each - # FIXME: need some way to distiguish between key collision and other types of error - $oldIgnore = $this->ignoreErrors( true ); - if ( !is_array( reset( $a ) ) ) { - $a = array( $a ); + if ( isset( $args[0] ) && is_array( $args[0] ) ) { + $multi = true; + $keys = array_keys( $args[0] ); } - foreach ( $a as $row ) { - parent::insert( $table, $row, $fname, array() ); + else { + $multi = false; + $keys = array_keys( $args ); } - $this->ignoreErrors( $oldIgnore ); - $retVal = true; - if ( in_array( 'IGNORE', $options ) ) - $this->ignoreErrors( $oldIgnore ); + $ignore = in_array( 'IGNORE', $options ) ? 1 : 0; + if ( $ignore ) + $olde = error_reporting( 0 ); + + $sql = "INSERT INTO $table (" . implode( ',', $keys ) . ') VALUES '; + + if ( $multi ) { + if ( $wgDBversion >= 8.1 ) { + $first = true; + foreach ( $args as $row ) { + if ( $first ) { + $first = false; + } else { + $sql .= ','; + } + $sql .= '(' . $this->makeList( $row ) . ')'; + } + $res = (bool)$this->query( $sql, $fname, $ignore ); + } + else { + $res = true; + $origsql = $sql; + foreach ( $args as $row ) { + $tempsql = $origsql; + $tempsql .= '(' . $this->makeList( $row ) . ')'; + $tempres = (bool)$this->query( $tempsql, $fname, $ignore ); + if (! $tempres) + $res = false; + } + } + } + else { + $sql .= '(' . $this->makeList( $args ) . ')'; + $res = (bool)$this->query( $sql, $fname, $ignore ); + } + + if ( $ignore ) { + $olde = error_reporting( $olde ); + return true; + } + + return $res; - return $retVal; } function tableName( $name ) { @@ -989,9 +1045,9 @@ END; $this->doQuery("DROP TABLE $wgDBmwschema.$ctest"); } $SQL = "CREATE TABLE $wgDBmwschema.$ctest(a int)"; - error_reporting( 0 ); + $olde = error_reporting( 0 ); $res = $this->doQuery($SQL); - error_reporting( E_ALL ); + error_reporting( $olde ); if (!$res) { print "<b>FAILED</b>. Make sure that the user \"$wgDBuser\" can write to the schema \"$wgDBmwschema\"</li>\n"; dieout("</ul>"); diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 169d67c9..d9bd3760 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -31,7 +31,7 @@ require_once( 'includes/SiteConfiguration.php' ); $wgConf = new SiteConfiguration; /** MediaWiki version number */ -$wgVersion = '1.10.0'; +$wgVersion = '1.10.1'; /** Name of the site. It must be changed in LocalSettings.php */ $wgSitename = 'MediaWiki'; diff --git a/includes/Image.php b/includes/Image.php index 09c2286e..e085936c 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -929,17 +929,19 @@ class Image $thumbPath = wfImageThumbDir( $this->name, $this->fromSharedDirectory ) . "/$thumbName"; $thumbUrl = $this->thumbUrlFromName( $thumbName ); - $this->migrateThumbFile( $thumbName ); - if ( file_exists( $thumbPath ) ) { + if ( !$wgGenerateThumbnailOnParse && !($flags & self::RENDER_NOW ) ) { $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); break; } - - if ( !$wgGenerateThumbnailOnParse && !($flags & self::RENDER_NOW ) ) { + + wfDebug( "Doing stat for $thumbPath\n" ); + $this->migrateThumbFile( $thumbName ); + if ( file_exists( $thumbPath ) ) { $thumb = $handler->getTransform( $this, $thumbPath, $thumbUrl, $params ); break; } + $thumb = $handler->doTransform( $this, $thumbPath, $thumbUrl, $params ); // Ignore errors if requested diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php index 3a624ced..7c3580e7 100644 --- a/includes/SearchPostgres.php +++ b/includes/SearchPostgres.php @@ -115,6 +115,12 @@ class SearchPostgres extends SearchEngine { * @private */ function searchQuery( $term, $fulltext, $colname ) { + global $wgDBversion; + + if ( !isset( $wgDBversion ) ) { + $this->db->getServerVersion(); + $wgDBversion = $this->db->numeric_version; + } $searchstring = $this->parseQuery( $term ); @@ -140,8 +146,9 @@ class SearchPostgres extends SearchEngine { } } + $rankscore = $wgDBversion > 8.2 ? 5 : 1; $query = "SELECT page_id, page_namespace, page_title, ". - "rank($fulltext, to_tsquery('default',$searchstring),5) AS score ". + "rank($fulltext, to_tsquery('default',$searchstring), $rankscore) AS score ". "FROM page p, revision r, pagecontent c WHERE p.page_latest = r.rev_id " . "AND r.rev_text_id = c.old_id AND $fulltext @@ to_tsquery('default',$searchstring)"; } diff --git a/install-utils.inc b/install-utils.inc index 4e1aad27..24480f91 100644 --- a/install-utils.inc +++ b/install-utils.inc @@ -106,4 +106,20 @@ function dbsource( $fname, $db = false ) { exit(1); } } -?> + +/** + * Get the value of session.save_path + * + * Per http://uk.php.net/manual/en/ref.session.php#ini.session.save-path, + * this might have some additional preceding parts which need to be + * ditched + * + * @return string + */ +function mw_get_session_save_path() { + $path = ini_get( 'session.save_path' ); + $path = substr( $path, strrpos( $path, ';' ) ); + return $path; +} + +?>
\ No newline at end of file diff --git a/maintenance/archives/patch-ar_deleted.sql b/maintenance/archives/patch-ar_deleted.sql index b1d37a5c..2e5edc44 100644 --- a/maintenance/archives/patch-ar_deleted.sql +++ b/maintenance/archives/patch-ar_deleted.sql @@ -1,3 +1,3 @@ -- Adding ar_deleted field for revisiondelete ALTER TABLE /*$wgDBprefix*/archive - ADD ar_deleted tinyint(1) unsigned NOT NULL default '0'; + ADD ar_deleted tinyint unsigned NOT NULL default '0'; diff --git a/maintenance/archives/patch-ar_len.sql b/maintenance/archives/patch-ar_len.sql index 69e634b0..1710e099 100644 --- a/maintenance/archives/patch-ar_len.sql +++ b/maintenance/archives/patch-ar_len.sql @@ -1,3 +1,3 @@ ALTER TABLE /*$wgDBprefix*/archive - ADD ar_len INT(8) UNSIGNED; + ADD ar_len INT UNSIGNED; diff --git a/maintenance/archives/patch-archive-rev_id.sql b/maintenance/archives/patch-archive-rev_id.sql index 375001b8..b9d789ee 100644 --- a/maintenance/archives/patch-archive-rev_id.sql +++ b/maintenance/archives/patch-archive-rev_id.sql @@ -3,4 +3,4 @@ ALTER TABLE /*$wgDBprefix*/archive ADD - ar_rev_id int(8) unsigned; + ar_rev_id int unsigned; diff --git a/maintenance/archives/patch-archive-text_id.sql b/maintenance/archives/patch-archive-text_id.sql index f59715ff..8557f2ad 100644 --- a/maintenance/archives/patch-archive-text_id.sql +++ b/maintenance/archives/patch-archive-text_id.sql @@ -11,4 +11,4 @@ ALTER TABLE /*$wgDBprefix*/archive ADD - ar_text_id int(8) unsigned; + ar_text_id int unsigned; diff --git a/maintenance/archives/patch-bot.sql b/maintenance/archives/patch-bot.sql index ce61884c..7625889c 100644 --- a/maintenance/archives/patch-bot.sql +++ b/maintenance/archives/patch-bot.sql @@ -7,5 +7,5 @@ -- column also added to buildTables.inc ALTER TABLE /*$wgDBprefix*/recentchanges - ADD COLUMN rc_bot tinyint(3) unsigned NOT NULL default '0' + ADD COLUMN rc_bot tinyint unsigned NOT NULL default '0' AFTER rc_minor; diff --git a/maintenance/archives/patch-cache.sql b/maintenance/archives/patch-cache.sql index 5651c3ce..0545da8b 100644 --- a/maintenance/archives/patch-cache.sql +++ b/maintenance/archives/patch-cache.sql @@ -15,7 +15,7 @@ -- cur_touched is later, the page must be regenerated. ALTER TABLE /*$wgDBprefix*/cur - ADD COLUMN cur_touched char(14) binary NOT NULL default ''; + ADD COLUMN cur_touched binary(14) NOT NULL default ''; -- Existing pages should be initialized to the current -- time so they don't needlessly rerender until they are @@ -36,6 +36,6 @@ UPDATE /*$wgDBprefix*/cur -- sent again. ALTER TABLE /*$wgDBprefix*/user - ADD COLUMN user_touched char(14) binary NOT NULL default ''; + ADD COLUMN user_touched binary(14) NOT NULL default ''; UPDATE /*$wgDBprefix*/user SET user_touched=NOW()+0; diff --git a/maintenance/archives/patch-categorylinks.sql b/maintenance/archives/patch-categorylinks.sql index c5eb396e..02168d7f 100644 --- a/maintenance/archives/patch-categorylinks.sql +++ b/maintenance/archives/patch-categorylinks.sql @@ -5,7 +5,7 @@ -- CREATE TABLE /*$wgDBprefix*/categorylinks ( -- Key to page_id of the page defined as a category member. - cl_from int(8) unsigned NOT NULL default '0', + cl_from int unsigned NOT NULL default '0', -- Name of the category. -- This is also the page_title of the category's description page; @@ -17,11 +17,9 @@ CREATE TABLE /*$wgDBprefix*/categorylinks ( -- isn't always ideal, but collations seem to be an exciting -- and dangerous new world in MySQL... -- - -- For MySQL 4.1+ with charset set to utf8, the sort key *index* - -- needs cut to be smaller than 1024 bytes (at 3 bytes per char). - -- To sort properly on the shorter key, this field needs to be - -- the same shortness. - cl_sortkey varchar(86) binary NOT NULL default '', + -- Truncate so that the cl_sortkey key fits in 1000 bytes + -- (MyISAM 5 with server_character_set=utf8) + cl_sortkey varchar(70) binary NOT NULL default '', -- This isn't really used at present. Provided for an optional -- sorting method by approximate addition time. diff --git a/maintenance/archives/patch-email-notification.sql b/maintenance/archives/patch-email-notification.sql index f9bc0440..337e1ac2 100644 --- a/maintenance/archives/patch-email-notification.sql +++ b/maintenance/archives/patch-email-notification.sql @@ -8,4 +8,4 @@ -- ("notification flags") at once by clicking the new button on his/her watchlist page. -- T. Gries/M. Arndt 11.09.2004 - December 2004 -ALTER TABLE /*$wgDBprefix*/watchlist ADD (wl_notificationtimestamp varchar(14) binary); +ALTER TABLE /*$wgDBprefix*/watchlist ADD (wl_notificationtimestamp varbinary(14)); diff --git a/maintenance/archives/patch-fa_deleted.sql b/maintenance/archives/patch-fa_deleted.sql index 78163149..3483f8cf 100644 --- a/maintenance/archives/patch-fa_deleted.sql +++ b/maintenance/archives/patch-fa_deleted.sql @@ -1,3 +1,3 @@ -- Adding fa_deleted field for additional content suppression ALTER TABLE /*$wgDBprefix*/filearchive - ADD fa_deleted tinyint(1) unsigned NOT NULL default '0'; + ADD fa_deleted tinyint unsigned NOT NULL default '0'; diff --git a/maintenance/archives/patch-filearchive.sql b/maintenance/archives/patch-filearchive.sql index 71f8a5eb..587a2ab4 100644 --- a/maintenance/archives/patch-filearchive.sql +++ b/maintenance/archives/patch-filearchive.sql @@ -14,33 +14,33 @@ CREATE TABLE /*$wgDBprefix*/filearchive ( -- Which storage bin (directory tree or object store) the file data -- is stored in. Should be 'deleted' for files that have been deleted; -- any other bin is not yet in use. - fa_storage_group varchar(16), + fa_storage_group varbinary(16), -- SHA-1 of the file contents plus extension, used as a key for storage. -- eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg -- -- If NULL, the file was missing at deletion time or has been purged -- from the archival storage. - fa_storage_key varchar(64) binary default '', + fa_storage_key varbinary(64) default '', -- Deletion information, if this file is deleted. fa_deleted_user int, - fa_deleted_timestamp char(14) binary default '', + fa_deleted_timestamp binary(14) default '', fa_deleted_reason text, -- Duped fields from image - fa_size int(8) unsigned default '0', - fa_width int(5) default '0', - fa_height int(5) default '0', + fa_size int unsigned default '0', + fa_width int default '0', + fa_height int default '0', fa_metadata mediumblob, - fa_bits int(3) default '0', + fa_bits int default '0', fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") default "unknown", - fa_minor_mime varchar(32) default "unknown", + fa_minor_mime varbinary(32) default "unknown", fa_description tinyblob, - fa_user int(5) unsigned default '0', + fa_user int unsigned default '0', fa_user_text varchar(255) binary default '', - fa_timestamp char(14) binary default '', + fa_timestamp binary(14) default '', PRIMARY KEY (fa_id), INDEX (fa_name, fa_timestamp), -- pick out by image name diff --git a/maintenance/archives/patch-img_media_type.sql b/maintenance/archives/patch-img_media_type.sql index 2356fc63..857eb98e 100644 --- a/maintenance/archives/patch-img_media_type.sql +++ b/maintenance/archives/patch-img_media_type.sql @@ -13,5 +13,5 @@ ALTER TABLE /*$wgDBprefix*/image ADD ( -- the minor parts are not required to adher to any standard -- but should be consistent throughout the database -- see http://www.iana.org/assignments/media-types/ - img_minor_mime varchar(32) NOT NULL default "unknown" + img_minor_mime varbinary(32) NOT NULL default "unknown" ); diff --git a/maintenance/archives/patch-img_width.sql b/maintenance/archives/patch-img_width.sql index c99bd46d..06889ea6 100644 --- a/maintenance/archives/patch-img_width.sql +++ b/maintenance/archives/patch-img_width.sql @@ -4,15 +4,15 @@ -- column is no longer used and has therefore be removed from this patch ALTER TABLE /*$wgDBprefix*/image ADD ( - img_width int(5) NOT NULL default 0, - img_height int(5) NOT NULL default 0, - img_bits int(5) NOT NULL default 0 + img_width int NOT NULL default 0, + img_height int NOT NULL default 0, + img_bits int NOT NULL default 0 ); ALTER TABLE /*$wgDBprefix*/oldimage ADD ( - oi_width int(5) NOT NULL default 0, - oi_height int(5) NOT NULL default 0, - oi_bits int(3) NOT NULL default 0 + oi_width int NOT NULL default 0, + oi_height int NOT NULL default 0, + oi_bits int NOT NULL default 0 ); diff --git a/maintenance/archives/patch-interwiki-trans.sql b/maintenance/archives/patch-interwiki-trans.sql index 2384a66a..5cc4d0b5 100644 --- a/maintenance/archives/patch-interwiki-trans.sql +++ b/maintenance/archives/patch-interwiki-trans.sql @@ -1,2 +1,2 @@ ALTER TABLE /*$wgDBprefix*/interwiki - ADD COLUMN iw_trans TINYINT(1) NOT NULL DEFAULT 0; + ADD COLUMN iw_trans TINYINT NOT NULL DEFAULT 0; diff --git a/maintenance/archives/patch-interwiki.sql b/maintenance/archives/patch-interwiki.sql index 3efdac8b..321765b9 100644 --- a/maintenance/archives/patch-interwiki.sql +++ b/maintenance/archives/patch-interwiki.sql @@ -4,12 +4,12 @@ CREATE TABLE /*$wgDBprefix*/interwiki ( -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de") - iw_prefix char(32) NOT NULL, + iw_prefix varchar(32) NOT NULL, -- The URL of the wiki, with "$1" as a placeholder for an article name. -- Any spaces in the name will be transformed to underscores before -- insertion. - iw_url char(127) NOT NULL, + iw_url blob NOT NULL, -- A boolean value indicating whether the wiki is in this project -- (used, for example, to detect redirect loops) diff --git a/maintenance/archives/patch-ipb_anon_only.sql b/maintenance/archives/patch-ipb_anon_only.sql index d46c04e8..fcd257c7 100644 --- a/maintenance/archives/patch-ipb_anon_only.sql +++ b/maintenance/archives/patch-ipb_anon_only.sql @@ -10,16 +10,16 @@ DROP TABLE IF EXISTS /*$wgDBprefix*/ipblocks_newunique; CREATE TABLE /*$wgDBprefix*/ipblocks_newunique ( - ipb_id int(8) NOT NULL auto_increment, + ipb_id int NOT NULL auto_increment, ipb_address tinyblob NOT NULL, - ipb_user int(8) unsigned NOT NULL default '0', - ipb_by int(8) unsigned NOT NULL default '0', + ipb_user int unsigned NOT NULL default '0', + ipb_by int unsigned NOT NULL default '0', ipb_reason tinyblob NOT NULL, - ipb_timestamp char(14) binary NOT NULL default '', + ipb_timestamp binary(14) NOT NULL default '', ipb_auto bool NOT NULL default 0, ipb_anon_only bool NOT NULL default 0, ipb_create_account bool NOT NULL default 1, - ipb_expiry char(14) binary NOT NULL default '', + ipb_expiry varbinary(14) NOT NULL default '', ipb_range_start tinyblob NOT NULL, ipb_range_end tinyblob NOT NULL, diff --git a/maintenance/archives/patch-ipb_expiry.sql b/maintenance/archives/patch-ipb_expiry.sql index 0f106d70..f3b6a82b 100644 --- a/maintenance/archives/patch-ipb_expiry.sql +++ b/maintenance/archives/patch-ipb_expiry.sql @@ -1,6 +1,6 @@ -- Adds the ipb_expiry field to ipblocks -ALTER TABLE /*$wgDBprefix*/ipblocks ADD ipb_expiry char(14) binary NOT NULL default ''; +ALTER TABLE /*$wgDBprefix*/ipblocks ADD ipb_expiry varbinary(14) NOT NULL default ''; -- All IP blocks have one day expiry UPDATE /*$wgDBprefix*/ipblocks SET ipb_expiry = date_format(date_add(ipb_timestamp,INTERVAL 1 DAY),"%Y%m%d%H%i%s") WHERE ipb_user = 0; diff --git a/maintenance/archives/patch-ipb_range_start.sql b/maintenance/archives/patch-ipb_range_start.sql index c31e2d9c..64a906d4 100644 --- a/maintenance/archives/patch-ipb_range_start.sql +++ b/maintenance/archives/patch-ipb_range_start.sql @@ -1,7 +1,7 @@ -- Add the range handling fields ALTER TABLE /*$wgDBprefix*/ipblocks - ADD ipb_range_start varchar(32) NOT NULL default '', - ADD ipb_range_end varchar(32) NOT NULL default '', + ADD ipb_range_start tinyblob NOT NULL default '', + ADD ipb_range_end tinyblob NOT NULL default '', ADD INDEX ipb_range (ipb_range_start(8), ipb_range_end(8)); diff --git a/maintenance/archives/patch-ipblocks.sql b/maintenance/archives/patch-ipblocks.sql index 8e47798b..634fa78c 100644 --- a/maintenance/archives/patch-ipblocks.sql +++ b/maintenance/archives/patch-ipblocks.sql @@ -1,6 +1,6 @@ -- For auto-expiring blocks -- ALTER TABLE /*$wgDBprefix*/ipblocks - ADD ipb_auto tinyint(1) NOT NULL default '0', - ADD ipb_id int(8) NOT NULL auto_increment, + ADD ipb_auto tinyint NOT NULL default '0', + ADD ipb_id int NOT NULL auto_increment, ADD PRIMARY KEY (ipb_id); diff --git a/maintenance/archives/patch-job.sql b/maintenance/archives/patch-job.sql index d931124d..a1f9094f 100644 --- a/maintenance/archives/patch-job.sql +++ b/maintenance/archives/patch-job.sql @@ -1,10 +1,10 @@ -- Jobs performed by parallel apache threads or a command-line daemon CREATE TABLE /*$wgDBprefix*/job ( - job_id int(9) unsigned NOT NULL auto_increment, + job_id int unsigned NOT NULL auto_increment, -- Command name, currently only refreshLinks is defined - job_cmd varchar(255) NOT NULL default '', + job_cmd varbinary(60) NOT NULL default '', -- Namespace and title to act on -- Should be 0 and '' if the command does not operate on a title diff --git a/maintenance/archives/patch-langlinks.sql b/maintenance/archives/patch-langlinks.sql index 33eb419d..ffff07c0 100644 --- a/maintenance/archives/patch-langlinks.sql +++ b/maintenance/archives/patch-langlinks.sql @@ -1,9 +1,9 @@ CREATE TABLE /*$wgDBprefix*/langlinks ( -- page_id of the referring page - ll_from int(8) unsigned NOT NULL default '0', + ll_from int unsigned NOT NULL default '0', -- Language code of the target - ll_lang varchar(10) binary NOT NULL default '', + ll_lang varbinary(20) NOT NULL default '', -- Title of the target, including namespace ll_title varchar(255) binary NOT NULL default '', diff --git a/maintenance/archives/patch-linktables.sql b/maintenance/archives/patch-linktables.sql index 8c521ad9..ae9768a8 100644 --- a/maintenance/archives/patch-linktables.sql +++ b/maintenance/archives/patch-linktables.sql @@ -5,13 +5,13 @@ DROP TABLE IF EXISTS /*$wgDBprefix*/links; CREATE TABLE /*$wgDBprefix*/links ( -- Key to the page_id of the page containing the link. - l_from int(8) unsigned NOT NULL default '0', + l_from int unsigned NOT NULL default '0', -- Key to the page_id of the link target. -- An unfortunate consequence of this is that rename -- operations require changing the links entries for -- all links to the moved page. - l_to int(8) unsigned NOT NULL default '0', + l_to int unsigned NOT NULL default '0', UNIQUE KEY l_from(l_from,l_to), KEY (l_to) @@ -26,7 +26,7 @@ CREATE TABLE /*$wgDBprefix*/links ( DROP TABLE IF EXISTS /*$wgDBprefix*/brokenlinks; CREATE TABLE /*$wgDBprefix*/brokenlinks ( -- Key to the page_id of the page containing the link. - bl_from int(8) unsigned NOT NULL default '0', + bl_from int unsigned NOT NULL default '0', -- Text of the target page title ("namesapce:title"). -- Unfortunately this doesn't split the namespace index @@ -45,7 +45,7 @@ CREATE TABLE /*$wgDBprefix*/brokenlinks ( DROP TABLE IF EXISTS /*$wgDBprefix*/imagelinks; CREATE TABLE /*$wgDBprefix*/imagelinks ( -- Key to page_id of the page containing the image / media link. - il_from int(8) unsigned NOT NULL default '0', + il_from int unsigned NOT NULL default '0', -- Filename of target image. -- This is also the page_title of the file's description page; diff --git a/maintenance/archives/patch-log_deleted.sql b/maintenance/archives/patch-log_deleted.sql index 6c777134..0fce0f51 100644 --- a/maintenance/archives/patch-log_deleted.sql +++ b/maintenance/archives/patch-log_deleted.sql @@ -1,3 +1,3 @@ -- Adding ar_deleted field for revisiondelete ALTER TABLE /*$wgDBprefix*/logging - ADD log_deleted tinyint(1) unsigned NOT NULL default '0';
\ No newline at end of file + ADD log_deleted tinyint unsigned NOT NULL default '0'; diff --git a/maintenance/archives/patch-logging.sql b/maintenance/archives/patch-logging.sql index 96847526..b5cfdf72 100644 --- a/maintenance/archives/patch-logging.sql +++ b/maintenance/archives/patch-logging.sql @@ -5,11 +5,11 @@ CREATE TABLE /*$wgDBprefix*/logging ( -- Symbolic keys for the general log type and the action type -- within the log. The output format will be controlled by the -- action field, but only the type controls categorization. - log_type char(10) NOT NULL default '', - log_action char(10) NOT NULL default '', + log_type varbinary(10) NOT NULL default '', + log_action varbinary(10) NOT NULL default '', -- Timestamp. Duh. - log_timestamp char(14) NOT NULL default '19700101000000', + log_timestamp binary(14) NOT NULL default '19700101000000', -- The user who performed this action; key to user_id log_user int unsigned NOT NULL default 0, diff --git a/maintenance/archives/patch-math.sql b/maintenance/archives/patch-math.sql index d217ecea..1d4b90e1 100644 --- a/maintenance/archives/patch-math.sql +++ b/maintenance/archives/patch-math.sql @@ -8,14 +8,14 @@ DROP TABLE IF EXISTS /*$wgDBprefix*/math; CREATE TABLE /*$wgDBprefix*/math ( -- Binary MD5 hash of the latex fragment, used as an identifier key. - math_inputhash varchar(16) NOT NULL, + math_inputhash varbinary(16) NOT NULL, -- Not sure what this is, exactly... - math_outputhash varchar(16) NOT NULL, + math_outputhash varbinary(16) NOT NULL, -- texvc reports how well it thinks the HTML conversion worked; -- if it's a low level the PNG rendering may be preferred. - math_html_conservativeness tinyint(1) NOT NULL, + math_html_conservativeness tinyint NOT NULL, -- HTML output from texvc, if any math_html text, diff --git a/maintenance/archives/patch-objectcache.sql b/maintenance/archives/patch-objectcache.sql index a439dd03..223a11c9 100644 --- a/maintenance/archives/patch-objectcache.sql +++ b/maintenance/archives/patch-objectcache.sql @@ -1,6 +1,6 @@ -- For a few generic cache operations if not using Memcached CREATE TABLE /*$wgDBprefix*/objectcache ( - keyname char(255) binary not null default '', + keyname varbinary(255) binary not null default '', value mediumblob, exptime datetime, unique key (keyname), diff --git a/maintenance/archives/patch-page_len.sql b/maintenance/archives/patch-page_len.sql index c32dc8d4..7d01d90a 100644 --- a/maintenance/archives/patch-page_len.sql +++ b/maintenance/archives/patch-page_len.sql @@ -6,7 +6,7 @@ -- Added 2005-03-12 ALTER TABLE /*$wgDBprefix*/page - ADD page_len int(8) unsigned NOT NULL, + ADD page_len int unsigned NOT NULL, ADD INDEX (page_len); -- Not accurate if upgrading from intermediate diff --git a/maintenance/archives/patch-page_restrictions.sql b/maintenance/archives/patch-page_restrictions.sql index c0eafab9..c18a054e 100644 --- a/maintenance/archives/patch-page_restrictions.sql +++ b/maintenance/archives/patch-page_restrictions.sql @@ -1,17 +1,17 @@ --- Used for storing page restrictions (i.e. protection levels) CREATE TABLE /*$wgDBprefix*/page_restrictions ( -- Page to apply restrictions to (Foreign Key to page). - pr_page int(8) NOT NULL, + pr_page int NOT NULL, -- The protection type (edit, move, etc) - pr_type varchar(255) NOT NULL, + pr_type varbinary(60) NOT NULL, -- The protection level (Sysop, autoconfirmed, etc) - pr_level varchar(255) NOT NULL, + pr_level varbinary(60) NOT NULL, -- Whether or not to cascade the protection down to pages transcluded. - pr_cascade tinyint(4) NOT NULL, + pr_cascade tinyint NOT NULL, -- Field for future support of per-user restriction. - pr_user int(8) NULL, + pr_user int NULL, -- Field for time-limited protection. - pr_expiry char(14) binary NULL, + pr_expiry varbinary(14) NULL, PRIMARY KEY pr_pagetype (pr_page,pr_type), @@ -19,4 +19,4 @@ CREATE TABLE /*$wgDBprefix*/page_restrictions ( KEY pr_typelevel (pr_type,pr_level), KEY pr_level (pr_level), KEY pr_cascade (pr_cascade) -) /*$wgDBTableOptions*/;
\ No newline at end of file +) /*$wgDBTableOptions*/; diff --git a/maintenance/archives/patch-pagelinks.sql b/maintenance/archives/patch-pagelinks.sql index 91e279da..118592fb 100644 --- a/maintenance/archives/patch-pagelinks.sql +++ b/maintenance/archives/patch-pagelinks.sql @@ -18,7 +18,7 @@ -- CREATE TABLE /*$wgDBprefix*/pagelinks ( -- Key to the page_id of the page containing the link. - pl_from int(8) unsigned NOT NULL default '0', + pl_from int unsigned NOT NULL default '0', -- Key to page_namespace/page_title of the target page. -- The target page may or may not exist, and due to renames diff --git a/maintenance/archives/patch-querycache.sql b/maintenance/archives/patch-querycache.sql index d0a592ac..e6da79cc 100644 --- a/maintenance/archives/patch-querycache.sql +++ b/maintenance/archives/patch-querycache.sql @@ -2,14 +2,14 @@ CREATE TABLE /*$wgDBprefix*/querycache ( -- A key name, generally the base name of of the special page. - qc_type char(32) NOT NULL, + qc_type varbinary(32) NOT NULL, -- Some sort of stored value. Sizes, counts... - qc_value int(5) unsigned NOT NULL default '0', + qc_value int unsigned NOT NULL default '0', -- Target namespace+title qc_namespace int NOT NULL default '0', - qc_title char(255) binary NOT NULL default '', + qc_title varchar(255) binary NOT NULL default '', KEY (qc_type,qc_value) diff --git a/maintenance/archives/patch-querycacheinfo.sql b/maintenance/archives/patch-querycacheinfo.sql index d90189e2..7ad2bca6 100644 --- a/maintenance/archives/patch-querycacheinfo.sql +++ b/maintenance/archives/patch-querycacheinfo.sql @@ -2,10 +2,10 @@ CREATE TABLE /*$wgDBprefix*/querycache_info ( -- Special page name -- Corresponds to a qc_type value - qci_type varchar(32) NOT NULL default '', + qci_type varbinary(32) NOT NULL default '', -- Timestamp of last update - qci_timestamp char(14) NOT NULL default '19700101000000', + qci_timestamp binary(14) NOT NULL default '19700101000000', UNIQUE KEY ( qci_type ) diff --git a/maintenance/archives/patch-querycachetwo.sql b/maintenance/archives/patch-querycachetwo.sql index 4f7a60ac..01623bc7 100644 --- a/maintenance/archives/patch-querycachetwo.sql +++ b/maintenance/archives/patch-querycachetwo.sql @@ -2,18 +2,18 @@ CREATE TABLE /*$wgDBprefix*/querycachetwo ( -- A key name, generally the base name of of the special page. - qcc_type char(32) NOT NULL, + qcc_type varbinary(32) NOT NULL, -- Some sort of stored value. Sizes, counts... - qcc_value int(5) unsigned NOT NULL default '0', + qcc_value int unsigned NOT NULL default '0', -- Target namespace+title qcc_namespace int NOT NULL default '0', - qcc_title char(255) binary NOT NULL default '', + qcc_title varchar(255) binary NOT NULL default '', -- Target namespace+title2 qcc_namespacetwo int NOT NULL default '0', - qcc_titletwo char(255) binary NOT NULL default '', + qcc_titletwo varchar(255) binary NOT NULL default '', KEY qcc_type (qcc_type,qcc_value), KEY qcc_title (qcc_type,qcc_namespace,qcc_title), diff --git a/maintenance/archives/patch-rc_deleted.sql b/maintenance/archives/patch-rc_deleted.sql index a2bdca9b..cc668433 100644 --- a/maintenance/archives/patch-rc_deleted.sql +++ b/maintenance/archives/patch-rc_deleted.sql @@ -1,8 +1,8 @@ -- Adding rc_deleted field for revisiondelete -- Add rc_logid to match log_id ALTER TABLE /*$wgDBprefix*/recentchanges - ADD rc_deleted tinyint(1) unsigned NOT NULL default '0', - ADD rc_logid int(10) unsigned NOT NULL default '0', - ADD rc_log_type varchar(255) binary NULL default NULL, - ADD rc_log_action varchar(255) binary NULL default NULL, + ADD rc_deleted tinyint unsigned NOT NULL default '0', + ADD rc_logid int unsigned NOT NULL default '0', + ADD rc_log_type varbinary(255) NULL default NULL, + ADD rc_log_action varbinary(255) NULL default NULL, ADD rc_params blob NOT NULL default ''; diff --git a/maintenance/archives/patch-rc_id.sql b/maintenance/archives/patch-rc_id.sql index 6dd9ef4a..3b023753 100644 --- a/maintenance/archives/patch-rc_id.sql +++ b/maintenance/archives/patch-rc_id.sql @@ -1,7 +1,7 @@ -- Primary key in recentchanges ALTER TABLE /*$wgDBprefix*/recentchanges - ADD rc_id int(8) NOT NULL auto_increment, + ADD rc_id int NOT NULL auto_increment, ADD PRIMARY KEY rc_id (rc_id); diff --git a/maintenance/archives/patch-rc_ip.sql b/maintenance/archives/patch-rc_ip.sql index a68a22cb..6b0b0534 100644 --- a/maintenance/archives/patch-rc_ip.sql +++ b/maintenance/archives/patch-rc_ip.sql @@ -1,7 +1,7 @@ -- Adding the rc_ip field for logging of IP addresses in recentchanges ALTER TABLE /*$wgDBprefix*/recentchanges - ADD rc_ip char(15) NOT NULL default '', + ADD rc_ip varbinary(40) NOT NULL default '', ADD INDEX rc_ip (rc_ip); diff --git a/maintenance/archives/patch-rc_len.sql b/maintenance/archives/patch-rc_len.sql index 920f755b..6c781a00 100644 --- a/maintenance/archives/patch-rc_len.sql +++ b/maintenance/archives/patch-rc_len.sql @@ -5,5 +5,5 @@ -- ALTER TABLE /*$wgDBprefix*/recentchanges - ADD COLUMN rc_old_len int(10), ADD COLUMN rc_new_len int(10); + ADD COLUMN rc_old_len int, ADD COLUMN rc_new_len int; diff --git a/maintenance/archives/patch-rc_type.sql b/maintenance/archives/patch-rc_type.sql index 1097771b..f1fb18e5 100644 --- a/maintenance/archives/patch-rc_type.sql +++ b/maintenance/archives/patch-rc_type.sql @@ -1,8 +1,8 @@ -- recentchanges improvements -- ALTER TABLE /*$wgDBprefix*/recentchanges - ADD rc_type tinyint(3) unsigned NOT NULL default '0', - ADD rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0', + ADD rc_type tinyint unsigned NOT NULL default '0', + ADD rc_moved_to_ns tinyint unsigned NOT NULL default '0', ADD rc_moved_to_title varchar(255) binary NOT NULL default ''; UPDATE /*$wgDBprefix*/recentchanges SET rc_type=1 WHERE rc_new; diff --git a/maintenance/archives/patch-redirect.sql b/maintenance/archives/patch-redirect.sql index 455a674f..5d7218bc 100644 --- a/maintenance/archives/patch-redirect.sql +++ b/maintenance/archives/patch-redirect.sql @@ -4,7 +4,7 @@ -- CREATE TABLE /*$wgDBprefix*/redirect ( -- Key to the page_id of the redirect page - rd_from int(8) unsigned NOT NULL default '0', + rd_from int unsigned NOT NULL default '0', -- Key to page_namespace/page_title of the target page. -- The target page may or may not exist, and due to renames diff --git a/maintenance/archives/patch-rename-group.sql b/maintenance/archives/patch-rename-group.sql index 026b60bd..e69de29b 100644 --- a/maintenance/archives/patch-rename-group.sql +++ b/maintenance/archives/patch-rename-group.sql @@ -1,10 +0,0 @@ --- Rename groups table to groups, which is not a keyword --- It was called group in a few alpha versions - -RENAME TABLE /*$wgDBprefix*/`group` TO /*$wgDBprefix*/groups; -ALTER TABLE /*$wgDBprefix*/groups - CHANGE group_id gr_id int(5) unsigned NOT NULL auto_increment, - CHANGE group_name gr_name varchar(50) NOT NULL default '', - CHANGE group_description gr_description varchar(255) NOT NULL default '', - CHANGE group_rights gr_rights tinyblob; - diff --git a/maintenance/archives/patch-rename-user_groups-and_rights.sql b/maintenance/archives/patch-rename-user_groups-and_rights.sql index 650f2604..978b31f7 100644 --- a/maintenance/archives/patch-rename-user_groups-and_rights.sql +++ b/maintenance/archives/patch-rename-user_groups-and_rights.sql @@ -1,9 +1,9 @@ ALTER TABLE /*$wgDBprefix*/user_groups - CHANGE user_id ug_user INT(5) UNSIGNED NOT NULL DEFAULT '0', - CHANGE group_id ug_group INT(5) UNSIGNED NOT NULL DEFAULT '0'; + CHANGE user_id ug_user INT UNSIGNED NOT NULL DEFAULT '0', + CHANGE group_id ug_group INT UNSIGNED NOT NULL DEFAULT '0'; ALTER TABLE /*$wgDBprefix*/user_rights - CHANGE user_id ur_user INT(5) UNSIGNED NOT NULL, + CHANGE user_id ur_user INT UNSIGNED NOT NULL, CHANGE user_rights ur_rights TINYBLOB NOT NULL; diff --git a/maintenance/archives/patch-restructure.sql b/maintenance/archives/patch-restructure.sql index acf306c2..7b638483 100644 --- a/maintenance/archives/patch-restructure.sql +++ b/maintenance/archives/patch-restructure.sql @@ -10,17 +10,17 @@ -- discarded when done. CREATE TABLE /*$wgDBprefix*/page ( - page_id int(8) unsigned NOT NULL auto_increment, + page_id int unsigned NOT NULL auto_increment, page_namespace tinyint NOT NULL, page_title varchar(255) binary NOT NULL, page_restrictions tinyblob NOT NULL, - page_counter bigint(20) unsigned NOT NULL default '0', - page_is_redirect tinyint(1) unsigned NOT NULL default '0', - page_is_new tinyint(1) unsigned NOT NULL default '0', + page_counter bigint unsigned NOT NULL default '0', + page_is_redirect tinyint unsigned NOT NULL default '0', + page_is_new tinyint unsigned NOT NULL default '0', page_random real unsigned NOT NULL, - page_touched char(14) binary NOT NULL default '', - page_latest int(8) unsigned NOT NULL, - page_len int(8) unsigned NOT NULL, + page_touched binary(14) NOT NULL default '', + page_latest int unsigned NOT NULL, + page_len int unsigned NOT NULL, PRIMARY KEY page_id (page_id), UNIQUE INDEX name_title (page_namespace,page_title), @@ -29,14 +29,14 @@ CREATE TABLE /*$wgDBprefix*/page ( ); CREATE TABLE /*$wgDBprefix*/revision ( - rev_id int(8) unsigned NOT NULL auto_increment, - rev_page int(8) unsigned NOT NULL, + rev_id int unsigned NOT NULL auto_increment, + rev_page int unsigned NOT NULL, rev_comment tinyblob NOT NULL, - rev_user int(5) unsigned NOT NULL default '0', + rev_user int unsigned NOT NULL default '0', rev_user_text varchar(255) binary NOT NULL default '', - rev_timestamp char(14) binary NOT NULL default '', - rev_minor_edit tinyint(1) unsigned NOT NULL default '0', - rev_deleted tinyint(1) unsigned NOT NULL default '0', + rev_timestamp binary(14) NOT NULL default '', + rev_minor_edit tinyint unsigned NOT NULL default '0', + rev_deleted tinyint unsigned NOT NULL default '0', PRIMARY KEY rev_page_id (rev_page, rev_id), diff --git a/maintenance/archives/patch-rev_deleted.sql b/maintenance/archives/patch-rev_deleted.sql index 3af0c1d7..ba47f789 100644 --- a/maintenance/archives/patch-rev_deleted.sql +++ b/maintenance/archives/patch-rev_deleted.sql @@ -8,4 +8,4 @@ -- ALTER TABLE /*$wgDBprefix*/revision - ADD rev_deleted tinyint(1) unsigned NOT NULL default '0'; + ADD rev_deleted tinyint unsigned NOT NULL default '0'; diff --git a/maintenance/archives/patch-rev_len.sql b/maintenance/archives/patch-rev_len.sql index b861a2bc..ccdae8b8 100644 --- a/maintenance/archives/patch-rev_len.sql +++ b/maintenance/archives/patch-rev_len.sql @@ -1,3 +1,3 @@ ALTER TABLE /*$wgDBprefix*/revision - ADD rev_len INT(8) UNSIGNED; + ADD rev_len INT UNSIGNED; diff --git a/maintenance/archives/patch-rev_parent_id.sql b/maintenance/archives/patch-rev_parent_id.sql index 971122bb..4baf7927 100644 --- a/maintenance/archives/patch-rev_parent_id.sql +++ b/maintenance/archives/patch-rev_parent_id.sql @@ -6,4 +6,4 @@ -- ALTER TABLE /*$wgDBprefix*/revision - ADD rev_parent_id int(8) unsigned default NULL; + ADD rev_parent_id int unsigned default NULL; diff --git a/maintenance/archives/patch-rev_text_id.sql b/maintenance/archives/patch-rev_text_id.sql index 44ef438c..3dd9127d 100644 --- a/maintenance/archives/patch-rev_text_id.sql +++ b/maintenance/archives/patch-rev_text_id.sql @@ -11,7 +11,7 @@ -- ALTER TABLE /*$wgDBprefix*/revision - ADD rev_text_id int(8) unsigned NOT NULL; + ADD rev_text_id int unsigned NOT NULL; UPDATE /*$wgDBprefix*/revision SET rev_text_id=rev_id; diff --git a/maintenance/archives/patch-searchindex.sql b/maintenance/archives/patch-searchindex.sql index 2b9b6702..452c4548 100644 --- a/maintenance/archives/patch-searchindex.sql +++ b/maintenance/archives/patch-searchindex.sql @@ -9,7 +9,7 @@ DROP TABLE IF EXISTS /*$wgDBprefix*/searchindex; CREATE TABLE /*$wgDBprefix*/searchindex ( -- Key to page_id - si_page int(8) unsigned NOT NULL, + si_page int unsigned NOT NULL, -- Munged version of title si_title varchar(255) NOT NULL default '', diff --git a/maintenance/archives/patch-ss_images.sql b/maintenance/archives/patch-ss_images.sql index e1950eb6..80f1295f 100644 --- a/maintenance/archives/patch-ss_images.sql +++ b/maintenance/archives/patch-ss_images.sql @@ -1,5 +1,5 @@ -- More statistics, for version 1.6 -ALTER TABLE /*$wgDBprefix*/site_stats ADD ss_images int(10) default '0'; +ALTER TABLE /*$wgDBprefix*/site_stats ADD ss_images int default '0'; SELECT @images := COUNT(*) FROM /*$wgDBprefix*/image; UPDATE /*$wgDBprefix*/site_stats SET ss_images=@images; diff --git a/maintenance/archives/patch-ss_total_articles.sql b/maintenance/archives/patch-ss_total_articles.sql index b4a48cf7..ce804ce5 100644 --- a/maintenance/archives/patch-ss_total_articles.sql +++ b/maintenance/archives/patch-ss_total_articles.sql @@ -1,6 +1,6 @@ -- Faster statistics, as of 1.4.3 ALTER TABLE /*$wgDBprefix*/site_stats - ADD ss_total_pages bigint(20) default -1, - ADD ss_users bigint(20) default -1, - ADD ss_admins int(10) default -1; + ADD ss_total_pages bigint default -1, + ADD ss_users bigint default -1, + ADD ss_admins int default -1; diff --git a/maintenance/archives/patch-templatelinks.sql b/maintenance/archives/patch-templatelinks.sql index 31318ba7..a545b34e 100644 --- a/maintenance/archives/patch-templatelinks.sql +++ b/maintenance/archives/patch-templatelinks.sql @@ -3,7 +3,7 @@ -- CREATE TABLE /*$wgDBprefix*/templatelinks ( -- Key to the page_id of the page containing the link. - tl_from int(8) unsigned NOT NULL default '0', + tl_from int unsigned NOT NULL default '0', -- Key to page_namespace/page_title of the target page. -- The target page may or may not exist, and due to renames diff --git a/maintenance/archives/patch-trackbacks.sql b/maintenance/archives/patch-trackbacks.sql index 4193d058..e3a47aae 100644 --- a/maintenance/archives/patch-trackbacks.sql +++ b/maintenance/archives/patch-trackbacks.sql @@ -2,7 +2,7 @@ CREATE TABLE /*$wgDBprefix*/trackbacks ( tb_id INTEGER AUTO_INCREMENT PRIMARY KEY, tb_page INTEGER REFERENCES page(page_id) ON DELETE CASCADE, tb_title VARCHAR(255) NOT NULL, - tb_url VARCHAR(255) NOT NULL, + tb_url BLOB NOT NULL, tb_ex TEXT, tb_name VARCHAR(255), diff --git a/maintenance/archives/patch-transcache.sql b/maintenance/archives/patch-transcache.sql index 0d2204e4..d0731697 100644 --- a/maintenance/archives/patch-transcache.sql +++ b/maintenance/archives/patch-transcache.sql @@ -1,5 +1,5 @@ CREATE TABLE /*$wgDBprefix*/transcache ( - tc_url VARCHAR(255) NOT NULL, + tc_url varbinary(255) NOT NULL, tc_contents TEXT, tc_time INT NOT NULL, UNIQUE INDEX tc_url_idx(tc_url) diff --git a/maintenance/archives/patch-user_email_token.sql b/maintenance/archives/patch-user_email_token.sql index d4d633b7..f8e66ca4 100644 --- a/maintenance/archives/patch-user_email_token.sql +++ b/maintenance/archives/patch-user_email_token.sql @@ -6,7 +6,7 @@ -- ALTER TABLE /*$wgDBprefix*/user - ADD COLUMN user_email_authenticated CHAR(14) BINARY, - ADD COLUMN user_email_token CHAR(32) BINARY, - ADD COLUMN user_email_token_expires CHAR(14) BINARY, + ADD COLUMN user_email_authenticated binary(14), + ADD COLUMN user_email_token binary(32), + ADD COLUMN user_email_token_expires binary(14), ADD INDEX (user_email_token); diff --git a/maintenance/archives/patch-user_groups.sql b/maintenance/archives/patch-user_groups.sql index 20e00520..c3740332 100644 --- a/maintenance/archives/patch-user_groups.sql +++ b/maintenance/archives/patch-user_groups.sql @@ -8,7 +8,7 @@ -- CREATE TABLE /*$wgDBprefix*/user_groups ( -- Key to user_id - ug_user int(5) unsigned NOT NULL default '0', + ug_user int unsigned NOT NULL default '0', -- Group names are short symbolic string keys. -- The set of group names is open-ended, though in practice @@ -18,7 +18,7 @@ CREATE TABLE /*$wgDBprefix*/user_groups ( -- with particular permissions. A user will have the combined -- permissions of any group they're explicitly in, plus -- the implicit '*' and 'user' groups. - ug_group char(16) NOT NULL default '', + ug_group varbinary(16) NOT NULL default '', PRIMARY KEY (ug_user,ug_group), KEY (ug_group) diff --git a/maintenance/archives/patch-user_newpass_time.sql b/maintenance/archives/patch-user_newpass_time.sql index 47b332ba..c323f238 100644 --- a/maintenance/archives/patch-user_newpass_time.sql +++ b/maintenance/archives/patch-user_newpass_time.sql @@ -1,4 +1,4 @@ -- Timestamp of the last time when a new password was -- sent, for throttling purposes -ALTER TABLE /*$wgDBprefix*/user ADD user_newpass_time char(14) binary; +ALTER TABLE /*$wgDBprefix*/user ADD user_newpass_time binary(14); diff --git a/maintenance/archives/patch-user_registration.sql b/maintenance/archives/patch-user_registration.sql index 65fd99df..906a6954 100644 --- a/maintenance/archives/patch-user_registration.sql +++ b/maintenance/archives/patch-user_registration.sql @@ -6,4 +6,4 @@ ALTER TABLE /*$wgDBprefix*/user -- Timestamp of account registration. -- Accounts predating this schema addition may contain NULL. - ADD user_registration CHAR(14) BINARY; + ADD user_registration binary(14); diff --git a/maintenance/archives/patch-user_rights.sql b/maintenance/archives/patch-user_rights.sql index 4c6846e0..9866654c 100644 --- a/maintenance/archives/patch-user_rights.sql +++ b/maintenance/archives/patch-user_rights.sql @@ -7,7 +7,7 @@ CREATE TABLE /*$wgDBprefix*/user_rights ( -- Key to user_id - ur_user int(5) unsigned NOT NULL, + ur_user int unsigned NOT NULL, -- Comma-separated list of permission keys ur_rights tinyblob NOT NULL, diff --git a/maintenance/archives/patch-user_token.sql b/maintenance/archives/patch-user_token.sql index 797dc98f..a3eb0bfd 100644 --- a/maintenance/archives/patch-user_token.sql +++ b/maintenance/archives/patch-user_token.sql @@ -1,7 +1,7 @@ -- user_token patch -- 2004-09-23 -ALTER TABLE /*$wgDBprefix*/user ADD user_token char(32) binary NOT NULL default ''; +ALTER TABLE /*$wgDBprefix*/user ADD user_token binary(32) NOT NULL default ''; UPDATE /*$wgDBprefix*/user SET user_token = concat( substring(rand(),3,4), diff --git a/maintenance/archives/patch-userlevels-defaultgroups.sql b/maintenance/archives/patch-userlevels-defaultgroups.sql index 065653da..e69de29b 100644 --- a/maintenance/archives/patch-userlevels-defaultgroups.sql +++ b/maintenance/archives/patch-userlevels-defaultgroups.sql @@ -1,30 +0,0 @@ --- --- Provide default groups --- Should probably be inserted when someone create a new database --- - -INSERT INTO /*$wgDBprefix*/groups (gr_id,gr_name,gr_description,gr_rights) - VALUES ( - 1,':group-anon-name',':group-anon-desc', - 'read,edit,createaccount' - ); -INSERT INTO /*$wgDBprefix*/groups (gr_id,gr_name,gr_description,gr_rights) - VALUES ( - 2,':group-loggedin-name',':group-loggedin-desc', - 'read,edit,move,upload,validate,createaccount' - ); -INSERT INTO /*$wgDBprefix*/groups (gr_id,gr_name,gr_description,gr_rights) - VALUES ( - 3,':group-admin-name',':group-admin-desc', - 'read,edit,move,upload,validate,createaccount,delete,undelete,protect,block,upload,asksql,rollback,patrol,editinterface,import' - ); -INSERT INTO /*$wgDBprefix*/groups (gr_id,gr_name,gr_description,gr_rights) - VALUES ( - 4,':group-bureaucrat-name',':group-bureaucrat-desc', - 'read,edit,move,upload,validate,createaccount,delete,undelete,protect,block,upload,asksql,rollback,patrol,editinterface,import,makesysop' - ); -INSERT INTO /*$wgDBprefix*/groups (gr_id,gr_name,gr_description,gr_rights) - VALUES ( - 5,':group-steward-name',':group-steward-desc', - 'read,edit,move,upload,validate,createaccount,delete,undelete,protect,block,upload,asksql,rollback,patrol,editinterface,import,makesysop,userrights,grouprights,siteadmin' - ); diff --git a/maintenance/archives/patch-userlevels-rights.sql b/maintenance/archives/patch-userlevels-rights.sql index 7f1cabfc..e69de29b 100644 --- a/maintenance/archives/patch-userlevels-rights.sql +++ b/maintenance/archives/patch-userlevels-rights.sql @@ -1,5 +0,0 @@ --- Oct. 24 2004 --- Adds the gr_rights field missing from early dev work - --- Hold group name and description -ALTER TABLE /*$wgDBprefix*/groups ADD gr_rights tinyblob; diff --git a/maintenance/archives/patch-userlevels.sql b/maintenance/archives/patch-userlevels.sql index 17ff3c5d..399d6cb2 100644 --- a/maintenance/archives/patch-userlevels.sql +++ b/maintenance/archives/patch-userlevels.sql @@ -1,22 +1,8 @@ --- Oct. 1st 2004 - Ashar Voultoiz --- Implement the new sitelevels --- --- This is under development to provide a showcase in HEAD :o) - --- Hold group name and description -CREATE TABLE /*$wgDBprefix*/groups ( - gr_id int(5) unsigned NOT NULL auto_increment, - gr_name varchar(50) NOT NULL default '', - gr_description varchar(255) NOT NULL default '', - gr_rights tinyblob, - PRIMARY KEY (gr_id) - -) /*$wgDBTableOptions*/; -- Relation table between user and groups CREATE TABLE /*$wgDBprefix*/user_groups ( - ug_user int(5) unsigned NOT NULL default '0', - ug_group int(5) unsigned NOT NULL default '0', + ug_user int unsigned NOT NULL default '0', + ug_group varbinary(16) NOT NULL default '0', PRIMARY KEY (ug_user,ug_group) - + KEY (ug_group) ) /*$wgDBTableOptions*/; diff --git a/maintenance/archives/patch-usernewtalk.sql b/maintenance/archives/patch-usernewtalk.sql index fb8c8655..34fae946 100644 --- a/maintenance/archives/patch-usernewtalk.sql +++ b/maintenance/archives/patch-usernewtalk.sql @@ -5,11 +5,11 @@ --- required and therefore dropped. CREATE TABLE /*$wgDBprefix*/user_newtalk ( - user_id int(5) NOT NULL default '0', - user_ip varchar(40) NOT NULL default '', + user_id int NOT NULL default '0', + user_ip varbinary(40) NOT NULL default '', KEY user_id (user_id), KEY user_ip (user_ip) -) TYPE=MyISAM; +) /*$wgDBTableOptions*/; INSERT INTO /*$wgDBprefix*/user_newtalk (user_id, user_ip) diff --git a/maintenance/archives/patch-usernewtalk2.sql b/maintenance/archives/patch-usernewtalk2.sql index 477109b7..e69de29b 100644 --- a/maintenance/archives/patch-usernewtalk2.sql +++ b/maintenance/archives/patch-usernewtalk2.sql @@ -1,6 +0,0 @@ -CREATE TABLE /*$wgDBprefix*/user_newtalk ( - user_id int(5) NOT NULL default '0', - user_ip varchar(40) NOT NULL default '', - INDEX user_id (user_id), - INDEX user_ip (user_ip) -); diff --git a/maintenance/archives/patch-watchlist-null.sql b/maintenance/archives/patch-watchlist-null.sql index 37ffc163..d4869a02 100644 --- a/maintenance/archives/patch-watchlist-null.sql +++ b/maintenance/archives/patch-watchlist-null.sql @@ -2,7 +2,7 @@ -- 2005-08-17 ALTER TABLE /*$wgDBprefix*/watchlist - CHANGE wl_notificationtimestamp wl_notificationtimestamp varchar(14) binary; + CHANGE wl_notificationtimestamp wl_notificationtimestamp varbinary(14); UPDATE /*$wgDBprefix*/watchlist SET wl_notificationtimestamp=NULL diff --git a/maintenance/archives/patch-watchlist.sql b/maintenance/archives/patch-watchlist.sql index adee010b..83826b72 100644 --- a/maintenance/archives/patch-watchlist.sql +++ b/maintenance/archives/patch-watchlist.sql @@ -10,11 +10,11 @@ DROP TABLE IF EXISTS watchlist2; CREATE TABLE watchlist2 ( - wl_user int(5) unsigned NOT NULL, - wl_namespace tinyint(2) unsigned NOT NULL default '0', + wl_user int unsigned NOT NULL, + wl_namespace int unsigned NOT NULL default '0', wl_title varchar(255) binary NOT NULL default '', UNIQUE KEY (wl_user, wl_namespace, wl_title) -) TYPE=MyISAM PACK_KEYS=1; +) /*$wgDBTableOptions*/; INSERT INTO watchlist2 (wl_user,wl_namespace,wl_title) SELECT DISTINCT wl_user,(cur_namespace | 1) - 1,cur_title diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 5d8b5481..f7217692 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -15,7 +15,7 @@ -- -- -- The MySQL table backend for MediaWiki currently uses --- 14-character CHAR or VARCHAR fields to store timestamps. +-- 14-character BINARY or VARBINARY fields to store timestamps. -- The format is YYYYMMDDHHMMSS, which is derived from the -- text format of MySQL's TIMESTAMP fields. -- @@ -49,7 +49,7 @@ -- tables. -- CREATE TABLE /*$wgDBprefix*/user ( - user_id int(5) unsigned NOT NULL auto_increment, + user_id int unsigned NOT NULL auto_increment, -- Usernames must be unique, must not be in the form of -- an IP address. _Shouldn't_ allow slashes or case @@ -76,7 +76,7 @@ CREATE TABLE /*$wgDBprefix*/user ( -- Timestamp of the last time when a new password was -- sent, for throttling purposes - user_newpass_time char(14) binary, + user_newpass_time binary(14), -- Note: email should be restricted, not public info. -- Same with passwords. @@ -90,29 +90,29 @@ CREATE TABLE /*$wgDBprefix*/user ( -- logs in, logs out, changes preferences, or performs -- some other action requiring HTML cache invalidation -- to ensure that the UI is updated. - user_touched char(14) binary NOT NULL default '', + user_touched binary(14) NOT NULL default '', -- A pseudorandomly generated value that is stored in -- a cookie when the "remember password" feature is -- used (previously, a hash of the password was used, but -- this was vulnerable to cookie-stealing attacks) - user_token char(32) binary NOT NULL default '', + user_token binary(32) NOT NULL default '', -- Initially NULL; when a user's e-mail address has been -- validated by returning with a mailed token, this is -- set to the current timestamp. - user_email_authenticated char(14) binary, + user_email_authenticated binary(14), -- Randomly generated token created when the e-mail address -- is set and a confirmation test mail sent. - user_email_token char(32) binary, + user_email_token binary(32), -- Expiration date for the user_email_token - user_email_token_expires char(14) binary, + user_email_token_expires binary(14), -- Timestamp of account registration. -- Accounts predating this schema addition may contain NULL. - user_registration char(14) binary, + user_registration binary(14), -- Count of edits and edit-like actions. -- @@ -142,7 +142,7 @@ CREATE TABLE /*$wgDBprefix*/user ( -- CREATE TABLE /*$wgDBprefix*/user_groups ( -- Key to user_id - ug_user int(5) unsigned NOT NULL default '0', + ug_user int unsigned NOT NULL default '0', -- Group names are short symbolic string keys. -- The set of group names is open-ended, though in practice @@ -152,7 +152,7 @@ CREATE TABLE /*$wgDBprefix*/user_groups ( -- with particular permissions. A user will have the combined -- permissions of any group they're explicitly in, plus -- the implicit '*' and 'user' groups. - ug_group char(16) NOT NULL default '', + ug_group varbinary(16) NOT NULL default '', PRIMARY KEY (ug_user,ug_group), KEY (ug_group) @@ -162,10 +162,10 @@ CREATE TABLE /*$wgDBprefix*/user_groups ( -- of the "you have new messages" box CREATE TABLE /*$wgDBprefix*/user_newtalk ( -- Key to user.user_id - user_id int(5) NOT NULL default '0', + user_id int NOT NULL default '0', -- If the user is an anonymous user their IP address is stored here -- since the user_id of 0 is ambiguous - user_ip varchar(40) NOT NULL default '', + user_ip varbinary(40) NOT NULL default '', INDEX user_id (user_id), INDEX user_ip (user_ip) @@ -179,7 +179,7 @@ CREATE TABLE /*$wgDBprefix*/user_newtalk ( CREATE TABLE /*$wgDBprefix*/page ( -- Unique identifier number. The page_id will be preserved across -- edits and rename operations, but not deletions and recreations. - page_id int(8) unsigned NOT NULL auto_increment, + page_id int unsigned NOT NULL auto_increment, -- A page name is broken into a namespace and a title. -- The namespace keys are UI-language-independent constants, @@ -195,14 +195,14 @@ CREATE TABLE /*$wgDBprefix*/page ( page_restrictions tinyblob NOT NULL, -- Number of times this page has been viewed. - page_counter bigint(20) unsigned NOT NULL default '0', + page_counter bigint unsigned NOT NULL default '0', -- 1 indicates the article is a redirect. - page_is_redirect tinyint(1) unsigned NOT NULL default '0', + page_is_redirect tinyint unsigned NOT NULL default '0', -- 1 indicates this is a new entry, with only one edit. -- Not all pages with one edit are new pages. - page_is_new tinyint(1) unsigned NOT NULL default '0', + page_is_new tinyint unsigned NOT NULL default '0', -- Random value between 0 and 1, used for Special:Randompage page_random real unsigned NOT NULL, @@ -212,15 +212,15 @@ CREATE TABLE /*$wgDBprefix*/page ( -- Aside from editing this includes permission changes, -- creation or deletion of linked pages, and alteration -- of contained templates. - page_touched char(14) binary NOT NULL default '', + page_touched binary(14) NOT NULL default '', -- Handy key to revision.rev_id of the current revision. -- This may be 0 during page creation, but that shouldn't -- happen outside of a transaction... hopefully. - page_latest int(8) unsigned NOT NULL, + page_latest int unsigned NOT NULL, -- Uncompressed length in bytes of the page's current source text. - page_len int(8) unsigned NOT NULL, + page_len int unsigned NOT NULL, PRIMARY KEY page_id (page_id), UNIQUE INDEX name_title (page_namespace,page_title), @@ -237,16 +237,16 @@ CREATE TABLE /*$wgDBprefix*/page ( -- to the text storage backend. -- CREATE TABLE /*$wgDBprefix*/revision ( - rev_id int(8) unsigned NOT NULL auto_increment, + rev_id int unsigned NOT NULL auto_increment, -- Key to page_id. This should _never_ be invalid. - rev_page int(8) unsigned NOT NULL, + rev_page int unsigned NOT NULL, -- Key to text.old_id, where the actual bulk text is stored. -- It's possible for multiple revisions to use the same text, -- for instance revisions where only metadata is altered -- or a rollback to a previous version. - rev_text_id int(8) unsigned NOT NULL, + rev_text_id int unsigned NOT NULL, -- Text comment summarizing the change. -- This text is shown in the history and other changes lists, @@ -255,27 +255,27 @@ CREATE TABLE /*$wgDBprefix*/revision ( -- Key to user.user_id of the user who made this edit. -- Stores 0 for anonymous edits and for some mass imports. - rev_user int(5) unsigned NOT NULL default '0', + rev_user int unsigned NOT NULL default '0', -- Text username or IP address of the editor. rev_user_text varchar(255) binary NOT NULL default '', -- Timestamp - rev_timestamp char(14) binary NOT NULL default '', + rev_timestamp binary(14) NOT NULL default '', -- Records whether the user marked the 'minor edit' checkbox. -- Many automated edits are marked as minor. - rev_minor_edit tinyint(1) unsigned NOT NULL default '0', + rev_minor_edit tinyint unsigned NOT NULL default '0', -- Not yet used; reserved for future changes to the deletion system. - rev_deleted tinyint(1) unsigned NOT NULL default '0', + rev_deleted tinyint unsigned NOT NULL default '0', -- Length of this revision in bytes - rev_len int(8) unsigned, + rev_len int unsigned, -- Key to revision.rev_id -- This field is used to add support for a tree structure (The Adjacency List Model) - rev_parent_id int(8) unsigned default NULL, + rev_parent_id int unsigned default NULL, PRIMARY KEY rev_page_id (rev_page, rev_id), UNIQUE INDEX rev_id (rev_id), @@ -301,7 +301,7 @@ CREATE TABLE /*$wgDBprefix*/text ( -- refer to this number anymore, but to rev_id. -- -- revision.rev_text_id is a key to this column - old_id int(8) unsigned NOT NULL auto_increment, + old_id int unsigned NOT NULL auto_increment, -- Depending on the contents of the old_flags field, the text -- may be convenient plain text, or it may be funkily encoded. @@ -343,10 +343,10 @@ CREATE TABLE /*$wgDBprefix*/archive ( -- Basic revision stuff... ar_comment tinyblob NOT NULL, - ar_user int(5) unsigned NOT NULL default '0', + ar_user int unsigned NOT NULL default '0', ar_user_text varchar(255) binary NOT NULL, - ar_timestamp char(14) binary NOT NULL default '', - ar_minor_edit tinyint(1) NOT NULL default '0', + ar_timestamp binary(14) NOT NULL default '', + ar_minor_edit tinyint NOT NULL default '0', -- See ar_text note. ar_flags tinyblob NOT NULL, @@ -358,7 +358,7 @@ CREATE TABLE /*$wgDBprefix*/archive ( -- -- Old entries from 1.4 will be NULL here, and a new rev_id will -- be created on undeletion for those revisions. - ar_rev_id int(8) unsigned, + ar_rev_id int unsigned, -- For newly deleted revisions, this is the text.old_id key to the -- actual stored text. To avoid breaking the block-compression scheme @@ -369,13 +369,13 @@ CREATE TABLE /*$wgDBprefix*/archive ( -- Old entries deleted under 1.2-1.4 will have NULL here, and their -- ar_text and ar_flags fields will be used to create a new text -- row upon undeletion. - ar_text_id int(8) unsigned, + ar_text_id int unsigned, -- rev_deleted for archives - ar_deleted tinyint(1) unsigned NOT NULL default '0', + ar_deleted tinyint unsigned NOT NULL default '0', -- Length of this revision in bytes - ar_len int(8) unsigned, + ar_len int unsigned, KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp) @@ -387,7 +387,7 @@ CREATE TABLE /*$wgDBprefix*/archive ( -- CREATE TABLE /*$wgDBprefix*/pagelinks ( -- Key to the page_id of the page containing the link. - pl_from int(8) unsigned NOT NULL default '0', + pl_from int unsigned NOT NULL default '0', -- Key to page_namespace/page_title of the target page. -- The target page may or may not exist, and due to renames @@ -407,7 +407,7 @@ CREATE TABLE /*$wgDBprefix*/pagelinks ( -- CREATE TABLE /*$wgDBprefix*/templatelinks ( -- Key to the page_id of the page containing the link. - tl_from int(8) unsigned NOT NULL default '0', + tl_from int unsigned NOT NULL default '0', -- Key to page_namespace/page_title of the target page. -- The target page may or may not exist, and due to renames @@ -428,7 +428,7 @@ CREATE TABLE /*$wgDBprefix*/templatelinks ( -- CREATE TABLE /*$wgDBprefix*/imagelinks ( -- Key to page_id of the page containing the image / media link. - il_from int(8) unsigned NOT NULL default '0', + il_from int unsigned NOT NULL default '0', -- Filename of target image. -- This is also the page_title of the file's description page; @@ -447,7 +447,7 @@ CREATE TABLE /*$wgDBprefix*/imagelinks ( -- CREATE TABLE /*$wgDBprefix*/categorylinks ( -- Key to page_id of the page defined as a category member. - cl_from int(8) unsigned NOT NULL default '0', + cl_from int unsigned NOT NULL default '0', -- Name of the category. -- This is also the page_title of the category's description page; @@ -460,11 +460,9 @@ CREATE TABLE /*$wgDBprefix*/categorylinks ( -- and dangerous new world in MySQL... The sortkey is updated -- if no override exists and cl_from is renamed. -- - -- For MySQL 4.1+ with charset set to utf8, the sort key *index* - -- needs cut to be smaller than 1024 bytes (at 3 bytes per char). - -- To sort properly on the shorter key, this field needs to be - -- the same shortness. - cl_sortkey varchar(86) binary NOT NULL default '', + -- Truncate so that the cl_sortkey key fits in 1000 bytes + -- (MyISAM 5 with server_character_set=utf8) + cl_sortkey varchar(70) binary NOT NULL default '', -- This isn't really used at present. Provided for an optional -- sorting method by approximate addition time. @@ -485,7 +483,7 @@ CREATE TABLE /*$wgDBprefix*/categorylinks ( -- CREATE TABLE /*$wgDBprefix*/externallinks ( -- page_id of the referring page - el_from int(8) unsigned NOT NULL default '0', + el_from int unsigned NOT NULL default '0', -- The URL el_to blob NOT NULL, @@ -513,10 +511,10 @@ CREATE TABLE /*$wgDBprefix*/externallinks ( -- CREATE TABLE /*$wgDBprefix*/langlinks ( -- page_id of the referring page - ll_from int(8) unsigned NOT NULL default '0', + ll_from int unsigned NOT NULL default '0', -- Language code of the target - ll_lang varchar(10) binary NOT NULL default '', + ll_lang varbinary(20) NOT NULL default '', -- Title of the target, including namespace ll_title varchar(255) binary NOT NULL default '', @@ -531,32 +529,32 @@ CREATE TABLE /*$wgDBprefix*/langlinks ( -- CREATE TABLE /*$wgDBprefix*/site_stats ( -- The single row should contain 1 here. - ss_row_id int(8) unsigned NOT NULL, + ss_row_id int unsigned NOT NULL, -- Total number of page views, if hit counters are enabled. - ss_total_views bigint(20) unsigned default '0', + ss_total_views bigint unsigned default '0', -- Total number of edits performed. - ss_total_edits bigint(20) unsigned default '0', + ss_total_edits bigint unsigned default '0', -- An approximate count of pages matching the following criteria: -- * in namespace 0 -- * not a redirect -- * contains the text '[[' -- See Article::isCountable() in includes/Article.php - ss_good_articles bigint(20) unsigned default '0', + ss_good_articles bigint unsigned default '0', -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster - ss_total_pages bigint(20) default '-1', + ss_total_pages bigint default '-1', -- Number of users, theoretically equal to SELECT COUNT(*) FROM user; - ss_users bigint(20) default '-1', + ss_users bigint default '-1', -- Deprecated, no longer updated as of 1.5 - ss_admins int(10) default '-1', + ss_admins int default '-1', -- Number of images, equivalent to SELECT COUNT(*) FROM image - ss_images int(10) default '0', + ss_images int default '0', UNIQUE KEY ss_row_id (ss_row_id) @@ -580,23 +578,23 @@ CREATE TABLE /*$wgDBprefix*/hitcounter ( -- CREATE TABLE /*$wgDBprefix*/ipblocks ( -- Primary key, introduced for privacy. - ipb_id int(8) NOT NULL auto_increment, + ipb_id int NOT NULL auto_increment, -- Blocked IP address in dotted-quad form or user name. ipb_address tinyblob NOT NULL, -- Blocked user ID or 0 for IP blocks. - ipb_user int(8) unsigned NOT NULL default '0', + ipb_user int unsigned NOT NULL default '0', -- User ID who made the block. - ipb_by int(8) unsigned NOT NULL default '0', + ipb_by int unsigned NOT NULL default '0', -- Text comment made by blocker. ipb_reason tinyblob NOT NULL, -- Creation (or refresh) date in standard YMDHMS form. -- IP blocks expire automatically. - ipb_timestamp char(14) binary NOT NULL default '', + ipb_timestamp binary(14) NOT NULL default '', -- Indicates that the IP address was banned because a banned -- user accessed a page through it. If this is 1, ipb_address @@ -613,7 +611,8 @@ CREATE TABLE /*$wgDBprefix*/ipblocks ( ipb_enable_autoblock bool NOT NULL default '1', -- Time at which the block will expire. - ipb_expiry char(14) binary NOT NULL default '', + -- May be "infinity" + ipb_expiry varbinary(14) NOT NULL default '', -- Start and end of an address range, in hexadecimal -- Size chosen to allow IPv6 @@ -647,17 +646,17 @@ CREATE TABLE /*$wgDBprefix*/image ( img_name varchar(255) binary NOT NULL default '', -- File size in bytes. - img_size int(8) unsigned NOT NULL default '0', + img_size int unsigned NOT NULL default '0', -- For images, size in pixels. - img_width int(5) NOT NULL default '0', - img_height int(5) NOT NULL default '0', + img_width int NOT NULL default '0', + img_height int NOT NULL default '0', -- Extracted EXIF metadata stored as a serialized PHP array. img_metadata mediumblob NOT NULL, -- For images, bits per pixel if known. - img_bits int(3) NOT NULL default '0', + img_bits int NOT NULL default '0', -- Media type as defined by the MEDIATYPE_xxx constants img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, @@ -670,18 +669,18 @@ CREATE TABLE /*$wgDBprefix*/image ( -- the minor parts are not required to adher to any standard -- but should be consistent throughout the database -- see http://www.iana.org/assignments/media-types/ - img_minor_mime varchar(32) NOT NULL default "unknown", + img_minor_mime varbinary(32) NOT NULL default "unknown", -- Description field as entered by the uploader. -- This is displayed in image upload history and logs. img_description tinyblob NOT NULL, -- user_id and user_name of uploader. - img_user int(5) unsigned NOT NULL default '0', + img_user int unsigned NOT NULL default '0', img_user_text varchar(255) binary NOT NULL, -- Time of the upload. - img_timestamp char(14) binary NOT NULL default '', + img_timestamp varbinary(14) NOT NULL default '', PRIMARY KEY img_name (img_name), @@ -707,14 +706,14 @@ CREATE TABLE /*$wgDBprefix*/oldimage ( oi_archive_name varchar(255) binary NOT NULL default '', -- Other fields as in image... - oi_size int(8) unsigned NOT NULL default 0, - oi_width int(5) NOT NULL default 0, - oi_height int(5) NOT NULL default 0, - oi_bits int(3) NOT NULL default 0, + oi_size int unsigned NOT NULL default 0, + oi_width int NOT NULL default 0, + oi_height int NOT NULL default 0, + oi_bits int NOT NULL default 0, oi_description tinyblob NOT NULL, - oi_user int(5) unsigned NOT NULL default '0', + oi_user int unsigned NOT NULL default '0', oi_user_text varchar(255) binary NOT NULL, - oi_timestamp char(14) binary NOT NULL default '', + oi_timestamp binary(14) NOT NULL default '', INDEX oi_name (oi_name(10)) @@ -736,36 +735,36 @@ CREATE TABLE /*$wgDBprefix*/filearchive ( -- Which storage bin (directory tree or object store) the file data -- is stored in. Should be 'deleted' for files that have been deleted; -- any other bin is not yet in use. - fa_storage_group varchar(16), + fa_storage_group varbinary(16), -- SHA-1 of the file contents plus extension, used as a key for storage. -- eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg -- -- If NULL, the file was missing at deletion time or has been purged -- from the archival storage. - fa_storage_key varchar(64) binary default '', + fa_storage_key varbinary(64) default '', -- Deletion information, if this file is deleted. fa_deleted_user int, - fa_deleted_timestamp char(14) binary default '', + fa_deleted_timestamp binary(14) default '', fa_deleted_reason text, -- Duped fields from image - fa_size int(8) unsigned default '0', - fa_width int(5) default '0', - fa_height int(5) default '0', + fa_size int unsigned default '0', + fa_width int default '0', + fa_height int default '0', fa_metadata mediumblob, - fa_bits int(3) default '0', + fa_bits int default '0', fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") default "unknown", - fa_minor_mime varchar(32) default "unknown", + fa_minor_mime varbinary(32) default "unknown", fa_description tinyblob, - fa_user int(5) unsigned default '0', + fa_user int unsigned default '0', fa_user_text varchar(255) binary, - fa_timestamp char(14) binary default '', + fa_timestamp binary(14) default '', -- Visibility of deleted revisions, bitfield - fa_deleted tinyint(1) unsigned NOT NULL default '0', + fa_deleted tinyint unsigned NOT NULL default '0', PRIMARY KEY (fa_id), INDEX (fa_name, fa_timestamp), -- pick out by image name @@ -781,12 +780,12 @@ CREATE TABLE /*$wgDBprefix*/filearchive ( -- the last few days, see Article::editUpdates() -- CREATE TABLE /*$wgDBprefix*/recentchanges ( - rc_id int(8) NOT NULL auto_increment, - rc_timestamp varchar(14) binary NOT NULL default '', - rc_cur_time varchar(14) binary NOT NULL default '', + rc_id int NOT NULL auto_increment, + rc_timestamp varbinary(14) NOT NULL default '', + rc_cur_time varbinary(14) NOT NULL default '', -- As in revision - rc_user int(10) unsigned NOT NULL default '0', + rc_user int unsigned NOT NULL default '0', rc_user_text varchar(255) binary NOT NULL, -- When pages are renamed, their RC entries do _not_ change. @@ -795,55 +794,55 @@ CREATE TABLE /*$wgDBprefix*/recentchanges ( -- as in revision... rc_comment varchar(255) binary NOT NULL default '', - rc_minor tinyint(3) unsigned NOT NULL default '0', + rc_minor tinyint unsigned NOT NULL default '0', -- Edits by user accounts with the 'bot' rights key are -- marked with a 1 here, and will be hidden from the -- default view. - rc_bot tinyint(3) unsigned NOT NULL default '0', + rc_bot tinyint unsigned NOT NULL default '0', - rc_new tinyint(3) unsigned NOT NULL default '0', + rc_new tinyint unsigned NOT NULL default '0', -- Key to page_id (was cur_id prior to 1.5). -- This will keep links working after moves while -- retaining the at-the-time name in the changes list. - rc_cur_id int(10) unsigned NOT NULL default '0', + rc_cur_id int unsigned NOT NULL default '0', -- rev_id of the given revision - rc_this_oldid int(10) unsigned NOT NULL default '0', + rc_this_oldid int unsigned NOT NULL default '0', -- rev_id of the prior revision, for generating diff links. - rc_last_oldid int(10) unsigned NOT NULL default '0', + rc_last_oldid int unsigned NOT NULL default '0', -- These may no longer be used, with the new move log. - rc_type tinyint(3) unsigned NOT NULL default '0', - rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0', + rc_type tinyint unsigned NOT NULL default '0', + rc_moved_to_ns tinyint unsigned NOT NULL default '0', rc_moved_to_title varchar(255) binary NOT NULL default '', -- If the Recent Changes Patrol option is enabled, -- users may mark edits as having been reviewed to -- remove a warning flag on the RC list. -- A value of 1 indicates the page has been reviewed. - rc_patrolled tinyint(3) unsigned NOT NULL default '0', + rc_patrolled tinyint unsigned NOT NULL default '0', -- Recorded IP address the edit was made from, if the -- $wgPutIPinRC option is enabled. - rc_ip char(15) NOT NULL default '', + rc_ip varbinary(40) NOT NULL default '', -- Text length in characters before -- and after the edit - rc_old_len int(10), - rc_new_len int(10), + rc_old_len int, + rc_new_len int, -- Visibility of deleted revisions, bitfield - rc_deleted tinyint(1) unsigned NOT NULL default '0', + rc_deleted tinyint unsigned NOT NULL default '0', -- Value corresonding to log_id, specific log entries - rc_logid int(10) unsigned NOT NULL default '0', + rc_logid int unsigned NOT NULL default '0', -- Store log type info here, or null - rc_log_type varchar(255) binary NULL default NULL, + rc_log_type varbinary(255) NULL default NULL, -- Store log action or null - rc_log_action varchar(255) binary NULL default NULL, + rc_log_action varbinary(255) NULL default NULL, -- Log params rc_params blob NOT NULL default '', @@ -860,7 +859,7 @@ CREATE TABLE /*$wgDBprefix*/recentchanges ( CREATE TABLE /*$wgDBprefix*/watchlist ( -- Key to user.user_id - wl_user int(5) unsigned NOT NULL, + wl_user int unsigned NOT NULL, -- Key to page_namespace/page_title -- Note that users may watch pages which do not exist yet, @@ -870,7 +869,7 @@ CREATE TABLE /*$wgDBprefix*/watchlist ( -- Timestamp when user was last sent a notification e-mail; -- cleared when the user visits the page. - wl_notificationtimestamp varchar(14) binary, + wl_notificationtimestamp varbinary(14), UNIQUE KEY (wl_user, wl_namespace, wl_title), KEY namespace_title (wl_namespace, wl_title) @@ -884,14 +883,14 @@ CREATE TABLE /*$wgDBprefix*/watchlist ( -- CREATE TABLE /*$wgDBprefix*/math ( -- Binary MD5 hash of the latex fragment, used as an identifier key. - math_inputhash varchar(16) NOT NULL, + math_inputhash varbinary(16) NOT NULL, -- Not sure what this is, exactly... - math_outputhash varchar(16) NOT NULL, + math_outputhash varbinary(16) NOT NULL, -- texvc reports how well it thinks the HTML conversion worked; -- if it's a low level the PNG rendering may be preferred. - math_html_conservativeness tinyint(1) NOT NULL, + math_html_conservativeness tinyint NOT NULL, -- HTML output from texvc, if any math_html text, @@ -913,7 +912,7 @@ CREATE TABLE /*$wgDBprefix*/math ( -- CREATE TABLE /*$wgDBprefix*/searchindex ( -- Key to page_id - si_page int(8) unsigned NOT NULL, + si_page int unsigned NOT NULL, -- Munged version of title si_title varchar(255) NOT NULL default '', @@ -932,19 +931,19 @@ CREATE TABLE /*$wgDBprefix*/searchindex ( -- CREATE TABLE /*$wgDBprefix*/interwiki ( -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de") - iw_prefix char(32) NOT NULL, + iw_prefix varchar(32) NOT NULL, -- The URL of the wiki, with "$1" as a placeholder for an article name. -- Any spaces in the name will be transformed to underscores before -- insertion. - iw_url char(127) NOT NULL, + iw_url blob NOT NULL, -- A boolean value indicating whether the wiki is in this project -- (used, for example, to detect redirect loops) iw_local bool NOT NULL, -- Boolean value indicating whether interwiki transclusions are allowed. - iw_trans tinyint(1) NOT NULL default 0, + iw_trans tinyint NOT NULL default 0, UNIQUE KEY iw_prefix (iw_prefix) @@ -955,10 +954,10 @@ CREATE TABLE /*$wgDBprefix*/interwiki ( -- CREATE TABLE /*$wgDBprefix*/querycache ( -- A key name, generally the base name of of the special page. - qc_type char(32) NOT NULL, + qc_type varbinary(32) NOT NULL, -- Some sort of stored value. Sizes, counts... - qc_value int(5) unsigned NOT NULL default '0', + qc_value int unsigned NOT NULL default '0', -- Target namespace+title qc_namespace int NOT NULL default '0', @@ -972,7 +971,7 @@ CREATE TABLE /*$wgDBprefix*/querycache ( -- For a few generic cache operations if not using Memcached -- CREATE TABLE /*$wgDBprefix*/objectcache ( - keyname char(255) binary NOT NULL default '', + keyname varbinary(255) NOT NULL default '', value mediumblob, exptime datetime, UNIQUE KEY (keyname), @@ -984,7 +983,7 @@ CREATE TABLE /*$wgDBprefix*/objectcache ( -- Cache of interwiki transclusion -- CREATE TABLE /*$wgDBprefix*/transcache ( - tc_url varchar(255) NOT NULL, + tc_url varbinary(255) NOT NULL, tc_contents text, tc_time int NOT NULL, UNIQUE INDEX tc_url_idx (tc_url) @@ -994,11 +993,11 @@ CREATE TABLE /*$wgDBprefix*/logging ( -- Symbolic keys for the general log type and the action type -- within the log. The output format will be controlled by the -- action field, but only the type controls categorization. - log_type char(10) NOT NULL default '', - log_action char(10) NOT NULL default '', + log_type varbinary(10) NOT NULL default '', + log_action varbinary(10) NOT NULL default '', -- Timestamp. Duh. - log_timestamp char(14) NOT NULL default '19700101000000', + log_timestamp binary(14) NOT NULL default '19700101000000', -- The user who performed this action; key to user_id log_user int unsigned NOT NULL default 0, @@ -1018,7 +1017,7 @@ CREATE TABLE /*$wgDBprefix*/logging ( log_id int unsigned NOT NULL auto_increment, -- rev_deleted for logs - log_deleted tinyint(1) unsigned NOT NULL default '0', + log_deleted tinyint unsigned NOT NULL default '0', PRIMARY KEY log_id (log_id), KEY type_time (log_type, log_timestamp), @@ -1032,7 +1031,7 @@ CREATE TABLE /*$wgDBprefix*/trackbacks ( tb_id int auto_increment, tb_page int REFERENCES page(page_id) ON DELETE CASCADE, tb_title varchar(255) NOT NULL, - tb_url varchar(255) NOT NULL, + tb_url blob NOT NULL, tb_ex text, tb_name varchar(255), @@ -1043,10 +1042,11 @@ CREATE TABLE /*$wgDBprefix*/trackbacks ( -- Jobs performed by parallel apache threads or a command-line daemon CREATE TABLE /*$wgDBprefix*/job ( - job_id int(9) unsigned NOT NULL auto_increment, + job_id int unsigned NOT NULL auto_increment, - -- Command name, currently only refreshLinks is defined - job_cmd varchar(255) NOT NULL default '', + -- Command name + -- Limited to 60 to prevent key length overflow + job_cmd varbinary(60) NOT NULL default '', -- Namespace and title to act on -- Should be 0 and '' if the command does not operate on a title @@ -1067,10 +1067,10 @@ CREATE TABLE /*$wgDBprefix*/querycache_info ( -- Special page name -- Corresponds to a qc_type value - qci_type varchar(32) NOT NULL default '', + qci_type varbinary(32) NOT NULL default '', -- Timestamp of last update - qci_timestamp char(14) NOT NULL default '19700101000000', + qci_timestamp binary(14) NOT NULL default '19700101000000', UNIQUE KEY ( qci_type ) @@ -1079,7 +1079,7 @@ CREATE TABLE /*$wgDBprefix*/querycache_info ( -- For each redirect, this table contains exactly one row defining its target CREATE TABLE /*$wgDBprefix*/redirect ( -- Key to the page_id of the redirect page - rd_from int(8) unsigned NOT NULL default '0', + rd_from int unsigned NOT NULL default '0', -- Key to page_namespace/page_title of the target page. -- The target page may or may not exist, and due to renames @@ -1095,10 +1095,10 @@ CREATE TABLE /*$wgDBprefix*/redirect ( -- Used for caching expensive grouped queries that need two links (for example double-redirects) CREATE TABLE /*$wgDBprefix*/querycachetwo ( -- A key name, generally the base name of of the special page. - qcc_type char(32) NOT NULL, + qcc_type varbinary(32) NOT NULL, -- Some sort of stored value. Sizes, counts... - qcc_value int(5) unsigned NOT NULL default '0', + qcc_value int unsigned NOT NULL default '0', -- Target namespace+title qcc_namespace int NOT NULL default '0', @@ -1117,17 +1117,17 @@ CREATE TABLE /*$wgDBprefix*/querycachetwo ( --- Used for storing page restrictions (i.e. protection levels) CREATE TABLE /*$wgDBprefix*/page_restrictions ( -- Page to apply restrictions to (Foreign Key to page). - pr_page int(8) NOT NULL, + pr_page int NOT NULL, -- The protection type (edit, move, etc) - pr_type varchar(255) NOT NULL, + pr_type varbinary(60) NOT NULL, -- The protection level (Sysop, autoconfirmed, etc) - pr_level varchar(255) NOT NULL, + pr_level varbinary(60) NOT NULL, -- Whether or not to cascade the protection down to pages transcluded. - pr_cascade tinyint(4) NOT NULL, + pr_cascade tinyint NOT NULL, -- Field for future support of per-user restriction. - pr_user int(8) NULL, + pr_user int NULL, -- Field for time-limited protection. - pr_expiry char(14) binary NULL, + pr_expiry varbinary(14) NULL, -- Field for an ID for this restrictions row (sort-key for Special:ProtectedPages) pr_id int unsigned NOT NULL auto_increment, diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index b3fb16f4..023a6b4b 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -1159,7 +1159,7 @@ END; } function do_postgres_updates() { - global $wgDatabase, $wgVersion, $wgDBmwschema, $wgShowExceptionDetails; + global $wgDatabase, $wgVersion, $wgDBmwschema, $wgDBts2schema, $wgShowExceptionDetails, $wgDBuser; $wgShowExceptionDetails = 1; @@ -1167,6 +1167,41 @@ function do_postgres_updates() { if ( !isset( $wgDBmwschema )) $wgDBmwschema = 'mediawiki'; + # Verify that this user is configured correctly + $safeuser = $wgDatabase->addQuotes($wgDBuser); + $SQL = "SELECT array_to_string(useconfig,'*') FROM pg_user WHERE usename = $safeuser"; + $config = pg_fetch_result( $wgDatabase->doQuery( $SQL ), 0, 0 ); + $conf = array(); + foreach( explode( '*', $config ) as $c ) { + list( $x,$y ) = explode( '=', $c ); + $conf[$x] = $y; + } + $newpath = array(); + if( !array_key_exists( 'search_path', $conf ) or strpos( $conf['search_path'],$wgDBmwschema ) === false ) { + print "Adding in schema \"$wgDBmwschema\" to search_path for user \"$wgDBuser\"\n"; + $newpath[$wgDBmwschema] = 1; + } + if( !array_key_exists( 'search_path', $conf ) or strpos( $conf['search_path'],$wgDBts2schema ) === false ) { + print "Adding in schema \"$wgDBts2schema\" to search_path for user \"$wgDBuser\"\n"; + $newpath[$wgDBts2schema] = 1; + } + $searchpath = implode( ',', array_keys( $newpath ) ); + if( strlen( $searchpath ) ) { + $wgDatabase->doQuery( "ALTER USER $wgDBuser SET search_path = $searchpath" ); + } + $goodconf = array( + 'client_min_messages' => 'error', + 'DateStyle' => 'ISO, YMD', + 'TimeZone' => 'GMT' + ); + foreach( array_keys( $goodconf ) AS $key ) { + $value = $goodconf[$key]; + if( !array_key_exists( $key, $conf ) or $conf[$key] !== $value ) { + print "Setting $key to '$value' for user \"$wgDBuser\"\n"; + $wgDatabase->doQuery( "ALTER USER $wgDBuser SET $key = '$value'" ); + } + } + $newsequences = array( "log_log_id_seq", "pr_id_val", @@ -1227,7 +1262,6 @@ function do_postgres_updates() { $newrules = array( ); - foreach ($newsequences as $ns) { if ($wgDatabase->sequenceExists($ns)) { echo "... sequence $ns already exists\n"; |