This keeps custom namespaces from bumping the 8-bit ceiling so quickly.
* no longer be accessible. If you rename it, then you can access them through
* the new namespace name.
*
- * Custom namespaces should start at 100 and stop at 255 (hard limit set by
- * database).
+ * Custom namespaces should start at 100 to avoid conflicting with standard
+ * namespaces, and should always follow the even/odd main/talk pattern.
*/
#$wgExtraNamespaces =
# array(100 => "Hilfe",
-- Key to the page affected. Where a user is the target,
-- this will point to the user page.
- log_namespace tinyint unsigned NOT NULL default 0,
+ log_namespace int NOT NULL default 0,
log_title varchar(255) binary NOT NULL default '',
-- Freeform text. Interpreted as edit history comments.
qc_value int(5) unsigned NOT NULL default '0',
-- Target namespace+title
- qc_namespace tinyint(2) unsigned NOT NULL default '0',
+ qc_namespace int NOT NULL default '0',
qc_title char(255) binary NOT NULL default '',
KEY (qc_type,qc_value)
-- A page name is broken into a namespace and a title.
-- The namespace keys are UI-language-independent constants,
-- defined in Namespace.php.
- page_namespace tinyint NOT NULL,
+ page_namespace int NOT NULL,
-- The rest of the title, as text.
-- Spaces are transformed into underscores in title storage.
-- fields, with several caveats.
--
CREATE TABLE /*$wgDBprefix*/archive (
- ar_namespace tinyint(2) unsigned NOT NULL default '0',
+ ar_namespace int NOT NULL default '0',
ar_title varchar(255) binary NOT NULL default '',
-- Newly deleted pages will not store text in this table,
rc_user_text varchar(255) binary NOT NULL default '',
-- When pages are renamed, their RC entries do _not_ change.
- rc_namespace tinyint(3) NOT NULL default '0',
+ rc_namespace int NOT NULL default '0',
rc_title varchar(255) binary NOT NULL default '',
-- as in revision...
-- Key to page_namespace/page_title
-- Note that users may watch patches which do not exist yet,
-- or existed in the past but have been deleted.
- wl_namespace tinyint(2) unsigned NOT NULL default '0',
+ wl_namespace int NOT NULL default '0',
wl_title varchar(255) binary NOT NULL default '',
-- Timestamp when user was last sent a notification e-mail;
qc_value int(5) unsigned NOT NULL default '0',
-- Target namespace+title
- qc_namespace tinyint(2) unsigned NOT NULL default '0',
+ qc_namespace int NOT NULL default '0',
qc_title char(255) binary NOT NULL default '',
KEY (qc_type,qc_value)
-- Key to the page affected. Where a user is the target,
-- this will point to the user page.
- log_namespace tinyint unsigned NOT NULL default 0,
+ log_namespace int NOT NULL default 0,
log_title varchar(255) binary NOT NULL default '',
-- Freeform text. Interpreted as edit history comments.
echo "......Creating tables.\n";
$wgDatabase->query("CREATE TABLE $page (
page_id int(8) unsigned NOT NULL auto_increment,
- page_namespace tinyint NOT NULL,
+ page_namespace int NOT NULL,
page_title varchar(255) binary NOT NULL,
page_restrictions tinyblob NOT NULL default '',
page_counter bigint(20) unsigned NOT NULL default '0',
}
}
+function do_namespace_size() {
+ $tables = array(
+ 'page' => 'page',
+ 'archive' => 'ar',
+ 'recentchanges' => 'rc',
+ 'watchlist' => 'wl',
+ 'querycache' => 'qc',
+ 'logging' => 'log',
+ );
+ foreach( $tables as $table => $prefix ) {
+ do_namespace_size_on( $table, $prefix );
+ flush();
+ }
+}
+
+function do_namespace_size_on( $table, $prefix ) {
+ global $wgDatabase;
+ $field = $prefix . '_namespace';
+
+ $tablename = $wgDatabase->tableName( $table );
+ $result = $wgDatabase->query( "SHOW COLUMNS FROM $tablename LIKE '$field'" );
+ $info = $wgDatabase->fetchObject( $result );
+ $wgDatabase->freeResult( $result );
+
+ if( substr( $info->Type, 0, 3 ) == 'int' ) {
+ echo "...$field is already a full int ($info->Type).\n";
+ } else {
+ echo "Promoting $field from $info->Type to int... ";
+
+ $sql = "ALTER TABLE $tablename MODIFY $field int NOT NULL";
+ $wgDatabase->query( $sql );
+
+ echo "ok\n";
+ }
+}
function do_all_updates() {
global $wgNewTables, $wgNewFields;
do_schema_restructuring(); flush();
do_inverse_timestamp(); flush();
do_text_id(); flush();
+ do_namespace_size(); flush();
initialiseMessages(); flush();
}