From c6b3c2f05b45c2ebdc7ff72743eb53afdaadbaa1 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 19 Nov 2011 16:26:28 +0000 Subject: [PATCH] * (bug 32470) Increase the length of ug_group Postgres doesn't need extending... --- RELEASE-NOTES-1.19 | 3 ++- includes/installer/DatabaseUpdater.php | 14 ++++++++++++++ includes/installer/MysqlUpdater.php | 3 ++- includes/installer/OracleUpdater.php | 1 + includes/installer/SqliteUpdater.php | 3 ++- .../archives/patch-ug_group-length-increase.sql | 2 ++ .../archives/patch-ug_group-length-increase.sql | 3 +++ .../archives/patch-ug_group-length-increase.sql | 15 +++++++++++++++ maintenance/tables.sql | 2 +- 9 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 maintenance/archives/patch-ug_group-length-increase.sql create mode 100644 maintenance/oracle/archives/patch-ug_group-length-increase.sql create mode 100644 maintenance/sqlite/archives/patch-ug_group-length-increase.sql diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 8e374c805c..733fa52aa3 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -22,6 +22,7 @@ production. ImageMagick. * Introduced $wgQueryPageDefaultLimit (defaults to 50) for the number of items to show by default on query pages (special pages such as Whatlinkshere). +* (bug 32470) Increase the length of ug_group === New features in 1.19 === * (bug 19838) Possibility to get all interwiki prefixes if the interwiki @@ -141,7 +142,7 @@ production. * (bug 32168) Add wfAssembleUrl for use in wfExpandUrl * (bug 32168) fixed - wfExpandUrl expands dot segments now * (bug 31535) Upload comments now truncated properly, and don't have brackets -* (bug 32450) Scripts pages in MediaWiki: namespace parse [[Category:#]] links +* (bug 32450) Scripts pages in MediaWiki: namespace parse [[Category:#]] links * (bug 32086) Special:PermanentLink now show an error message when no subpage was specified. diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 50c0c56fa0..0ae28b7882 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -666,4 +666,18 @@ abstract class DatabaseUpdater { $cl->execute(); $this->output( "Rebuilding localisation cache done.\n" ); } + + /** + * Increases the length of the user_group field + */ + protected function doIncreaseUserGroupLength() { + $this->output( 'Increasing the length of the user_group...' ); + if ( $this->updateRowExists( 'user_groups_length' ) ) { + $this->output( "...user_groups field is already long enough.\n" ); + return; + } + $this->applyPatch( 'patch-ug_group-length-increase.sql' ); + $this->insertUpdateRow( 'user_groups_length' ); + $this->output( "done.\n" ); + } } diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 5862aaf868..f89fc71127 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -189,7 +189,8 @@ class MysqlUpdater extends DatabaseUpdater { array( 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ), array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ), array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1.sql' ), - array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ) + array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ), + array( 'doIncreaseUserGroupLength' ), ); } diff --git a/includes/installer/OracleUpdater.php b/includes/installer/OracleUpdater.php index 72fd9e0a00..d1006b2fc3 100644 --- a/includes/installer/OracleUpdater.php +++ b/includes/installer/OracleUpdater.php @@ -47,6 +47,7 @@ class OracleUpdater extends DatabaseUpdater { array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1_field.sql' ), array( 'doRemoveNotNullEmptyDefaults2' ), array( 'addIndex', 'page', 'i03', 'patch-page_redirect_namespace_len.sql' ), + array( 'doIncreaseUserGroupLength' ), // till 2.0 i guess array( 'doRebuildDuplicateFunction' ), diff --git a/includes/installer/SqliteUpdater.php b/includes/installer/SqliteUpdater.php index 1b517a2457..34f866b6e2 100644 --- a/includes/installer/SqliteUpdater.php +++ b/includes/installer/SqliteUpdater.php @@ -67,7 +67,8 @@ class SqliteUpdater extends DatabaseUpdater { array( 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ), array( 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ), array( 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1.sql' ), - array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ) + array( 'addIndex', 'page', 'page_redirect_namespace_len', 'patch-page_redirect_namespace_len.sql' ), + array( 'doIncreaseUserGroupLength' ), ); } diff --git a/maintenance/archives/patch-ug_group-length-increase.sql b/maintenance/archives/patch-ug_group-length-increase.sql new file mode 100644 index 0000000000..e944a8584c --- /dev/null +++ b/maintenance/archives/patch-ug_group-length-increase.sql @@ -0,0 +1,2 @@ +ALTER TABLE /*_*/user_groups + MODIFY COLUMN ug_group varbinary(32) NOT NULL default ''; diff --git a/maintenance/oracle/archives/patch-ug_group-length-increase.sql b/maintenance/oracle/archives/patch-ug_group-length-increase.sql new file mode 100644 index 0000000000..00a3d0c9a2 --- /dev/null +++ b/maintenance/oracle/archives/patch-ug_group-length-increase.sql @@ -0,0 +1,3 @@ +define mw_prefix='{$wgDBprefix}'; + +ALTER TABLE &mw_prefix.user_groups MODIFY ug_group VARCHAR2(32) NOT NULL; diff --git a/maintenance/sqlite/archives/patch-ug_group-length-increase.sql b/maintenance/sqlite/archives/patch-ug_group-length-increase.sql new file mode 100644 index 0000000000..5e810937fe --- /dev/null +++ b/maintenance/sqlite/archives/patch-ug_group-length-increase.sql @@ -0,0 +1,15 @@ +CREATE TABLE /*_*/user_groups_tmp ( + ug_user int unsigned NOT NULL default 0, + ug_group varbinary(32) NOT NULL default '' +) /*$wgDBTableOptions*/; + +INSERT INTO /*_*/user_groups_tmp + SELECT ug_user, ug_group + FROM /*_*/user_groups; + +DROP TABLE /*_*/user_groups; + +ALTER TABLE /*_*/user_groups_tmp RENAME TO /*_*/user_groups; + +CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups (ug_user,ug_group); +CREATE INDEX /*i*/ug_group ON /*_*/user_groups (ug_group); diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 2121b08b8a..b3c5c80a7f 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -152,7 +152,7 @@ CREATE TABLE /*_*/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 varbinary(16) NOT NULL default '' + ug_group varbinary(32) NOT NULL default '' ) /*$wgDBTableOptions*/; CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups (ug_user,ug_group); -- 2.20.1