* (bug 32470) Increase the length of ug_group
authorSam Reed <reedy@users.mediawiki.org>
Sat, 19 Nov 2011 16:26:28 +0000 (16:26 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 19 Nov 2011 16:26:28 +0000 (16:26 +0000)
Postgres doesn't need extending...

RELEASE-NOTES-1.19
includes/installer/DatabaseUpdater.php
includes/installer/MysqlUpdater.php
includes/installer/OracleUpdater.php
includes/installer/SqliteUpdater.php
maintenance/archives/patch-ug_group-length-increase.sql [new file with mode: 0644]
maintenance/oracle/archives/patch-ug_group-length-increase.sql [new file with mode: 0644]
maintenance/sqlite/archives/patch-ug_group-length-increase.sql [new file with mode: 0644]
maintenance/tables.sql

index 8e374c8..733fa52 100644 (file)
@@ -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.
 
index 50c0c56..0ae28b7 100644 (file)
@@ -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" );
+       }
 }
index 5862aaf..f89fc71 100644 (file)
@@ -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' ),
                );
        }
 
index 72fd9e0..d1006b2 100644 (file)
@@ -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' ),
index 1b517a2..34f866b 100644 (file)
@@ -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 (file)
index 0000000..e944a85
--- /dev/null
@@ -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 (file)
index 0000000..00a3d0c
--- /dev/null
@@ -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 (file)
index 0000000..5e81093
--- /dev/null
@@ -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);
index 2121b08..b3c5c80 100644 (file)
@@ -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);