summaryrefslogtreecommitdiff
path: root/maintenance/archives
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
commit222b01f5169f1c7e69762e0e8904c24f78f71882 (patch)
tree8e932e12546bb991357ec48eb1638d1770be7a35 /maintenance/archives
parent00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff)
update to MediaWiki 1.16.0
Diffstat (limited to 'maintenance/archives')
-rw-r--r--maintenance/archives/patch-change_tag-indexes.sql21
-rw-r--r--maintenance/archives/patch-eu_local_id.sql3
-rw-r--r--maintenance/archives/patch-external_user.sql9
-rw-r--r--maintenance/archives/patch-filearchive-user-index.sql (renamed from maintenance/archives/patch-filearhive-user-index.sql)0
-rw-r--r--maintenance/archives/patch-job.sql18
-rw-r--r--maintenance/archives/patch-l10n_cache.sql8
-rw-r--r--maintenance/archives/patch-log_search-rename-index.sql7
-rw-r--r--maintenance/archives/patch-log_search.sql10
-rw-r--r--maintenance/archives/patch-log_user_text.sql5
-rw-r--r--maintenance/archives/patch-mime_minor_length.sql10
-rw-r--r--maintenance/archives/patch-rd_interwiki.sql6
-rw-r--r--maintenance/archives/patch-tc-timestamp.sql4
-rw-r--r--maintenance/archives/patch-transcache.sql2
-rw-r--r--maintenance/archives/patch-user_properties.sql22
-rw-r--r--maintenance/archives/populateSha1.php59
-rw-r--r--maintenance/archives/rebuildRecentchanges.inc123
-rw-r--r--maintenance/archives/upgradeWatchlist.php67
17 files changed, 113 insertions, 261 deletions
diff --git a/maintenance/archives/patch-change_tag-indexes.sql b/maintenance/archives/patch-change_tag-indexes.sql
new file mode 100644
index 00000000..9f8d8f80
--- /dev/null
+++ b/maintenance/archives/patch-change_tag-indexes.sql
@@ -0,0 +1,21 @@
+--
+-- Rename indexes on change_tag from implicit to explicit names
+--
+
+DROP INDEX ct_rc_id ON /*_*/change_tag;
+DROP INDEX ct_log_id ON /*_*/change_tag;
+DROP INDEX ct_rev_id ON /*_*/change_tag;
+DROP INDEX ct_tag ON /*_*/change_tag;
+
+DROP INDEX ts_rc_id ON /*_*/tag_summary;
+DROP INDEX ts_log_id ON /*_*/tag_summary;
+DROP INDEX ts_rev_id ON /*_*/tag_summary;
+
+CREATE UNIQUE INDEX /*i*/change_tag_rc_tag ON /*_*/change_tag (ct_rc_id,ct_tag);
+CREATE UNIQUE INDEX /*i*/change_tag_log_tag ON /*_*/change_tag (ct_log_id,ct_tag);
+CREATE UNIQUE INDEX /*i*/change_tag_rev_tag ON /*_*/change_tag (ct_rev_id,ct_tag);
+CREATE INDEX /*i*/change_tag_tag_id ON /*_*/change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
+
+CREATE UNIQUE INDEX /*i*/tag_summary_rc_id ON /*_*/tag_summary (ts_rc_id);
+CREATE UNIQUE INDEX /*i*/tag_summary_log_id ON /*_*/tag_summary (ts_log_id);
+CREATE UNIQUE INDEX /*i*/tag_summary_rev_id ON /*_*/tag_summary (ts_rev_id);
diff --git a/maintenance/archives/patch-eu_local_id.sql b/maintenance/archives/patch-eu_local_id.sql
new file mode 100644
index 00000000..bb59d067
--- /dev/null
+++ b/maintenance/archives/patch-eu_local_id.sql
@@ -0,0 +1,3 @@
+ALTER TABLE /*_*/external_user
+CHANGE COLUMN eu_wiki_id
+eu_local_id int unsigned NOT NULL;
diff --git a/maintenance/archives/patch-external_user.sql b/maintenance/archives/patch-external_user.sql
new file mode 100644
index 00000000..176b46d4
--- /dev/null
+++ b/maintenance/archives/patch-external_user.sql
@@ -0,0 +1,9 @@
+CREATE TABLE /*_*/external_user (
+ -- Foreign key to user_id
+ eu_local_id int unsigned NOT NULL PRIMARY KEY,
+
+ -- Some opaque identifier provided by the external database
+ eu_external_id varchar(255) binary NOT NULL
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/eu_external_id ON /*_*/external_user (eu_external_id);
diff --git a/maintenance/archives/patch-filearhive-user-index.sql b/maintenance/archives/patch-filearchive-user-index.sql
index c79000ad..c79000ad 100644
--- a/maintenance/archives/patch-filearhive-user-index.sql
+++ b/maintenance/archives/patch-filearchive-user-index.sql
diff --git a/maintenance/archives/patch-job.sql b/maintenance/archives/patch-job.sql
index a1f9094f..c9199efb 100644
--- a/maintenance/archives/patch-job.sql
+++ b/maintenance/archives/patch-job.sql
@@ -1,9 +1,9 @@
-
-- Jobs performed by parallel apache threads or a command-line daemon
-CREATE TABLE /*$wgDBprefix*/job (
- job_id int unsigned NOT NULL auto_increment,
+CREATE TABLE /*_*/job (
+ job_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
- -- Command name, currently only refreshLinks is defined
+ -- Command name
+ -- Limited to 60 to prevent key length overflow
job_cmd varbinary(60) NOT NULL default '',
-- Namespace and title to act on
@@ -12,9 +12,9 @@ CREATE TABLE /*$wgDBprefix*/job (
job_title varchar(255) binary NOT NULL,
-- Any other parameters to the command
- -- Presently unused, format undefined
- job_params blob NOT NULL,
-
- PRIMARY KEY job_id (job_id),
- KEY (job_cmd, job_namespace, job_title)
+ -- Stored as a PHP serialized array, or an empty string if there are no parameters
+ job_params blob NOT NULL
) /*$wgDBTableOptions*/;
+
+CREATE INDEX /*i*/job_cmd ON /*_*/job (job_cmd, job_namespace, job_title, job_params(128));
+
diff --git a/maintenance/archives/patch-l10n_cache.sql b/maintenance/archives/patch-l10n_cache.sql
new file mode 100644
index 00000000..4c865d71
--- /dev/null
+++ b/maintenance/archives/patch-l10n_cache.sql
@@ -0,0 +1,8 @@
+-- Table for storing localisation data
+CREATE TABLE /*_*/l10n_cache (
+ lc_lang varbinary(32) NOT NULL,
+ lc_key varchar(255) NOT NULL,
+ lc_value mediumblob NOT NULL
+) /*$wgDBTableOptions*/;
+CREATE INDEX /*i*/lc_lang_key ON /*_*/l10n_cache (lc_lang, lc_key);
+
diff --git a/maintenance/archives/patch-log_search-rename-index.sql b/maintenance/archives/patch-log_search-rename-index.sql
new file mode 100644
index 00000000..41e051d8
--- /dev/null
+++ b/maintenance/archives/patch-log_search-rename-index.sql
@@ -0,0 +1,7 @@
+-- Rename the primary unique index from PRIMARY to ls_field_val
+-- This is for MySQL only and is necessary only for databases which were updated
+-- between MW 1.16 development revisions r50567 and r51465.
+ALTER TABLE /*_*/log_search
+ DROP PRIMARY KEY,
+ ADD UNIQUE INDEX ls_field_val (ls_field,ls_value,ls_log_id);
+
diff --git a/maintenance/archives/patch-log_search.sql b/maintenance/archives/patch-log_search.sql
new file mode 100644
index 00000000..8d92030b
--- /dev/null
+++ b/maintenance/archives/patch-log_search.sql
@@ -0,0 +1,10 @@
+CREATE TABLE /*_*/log_search (
+ -- The type of ID (rev ID, log ID, rev timestamp, username)
+ ls_field varbinary(32) NOT NULL,
+ -- The value of the ID
+ ls_value varchar(255) NOT NULL,
+ -- Key to log_id
+ ls_log_id int unsigned NOT NULL default 0
+) /*$wgDBTableOptions*/;
+CREATE UNIQUE INDEX /*i*/ls_field_val ON /*_*/log_search (ls_field,ls_value,ls_log_id);
+CREATE INDEX /*i*/ls_log_id ON /*_*/log_search (ls_log_id);
diff --git a/maintenance/archives/patch-log_user_text.sql b/maintenance/archives/patch-log_user_text.sql
index dffbe8be..9a783d87 100644
--- a/maintenance/archives/patch-log_user_text.sql
+++ b/maintenance/archives/patch-log_user_text.sql
@@ -1,7 +1,8 @@
ALTER TABLE /*$wgDBprefix*/logging
ADD log_user_text varchar(255) binary NOT NULL default '',
- ADD log_target_id int unsigned NULL,
+ ADD log_page int unsigned NULL,
CHANGE log_type log_type varbinary(32) NOT NULL,
CHANGE log_action log_action varbinary(32) NOT NULL;
-CREATE INDEX /*i*/user_type_time ON /*_*/logging (log_user, log_type, log_timestamp);
+CREATE INDEX /*i*/log_user_type_time ON /*_*/logging (log_user, log_type, log_timestamp);
+CREATE INDEX /*i*/log_page_id_time ON /*_*/logging (log_page,log_timestamp);
diff --git a/maintenance/archives/patch-mime_minor_length.sql b/maintenance/archives/patch-mime_minor_length.sql
new file mode 100644
index 00000000..3a3c5c4f
--- /dev/null
+++ b/maintenance/archives/patch-mime_minor_length.sql
@@ -0,0 +1,10 @@
+ALTER TABLE /*_*/filearchive
+ MODIFY COLUMN fa_minor_mime varbinary(100) default "unknown";
+
+ALTER TABLE /*_*/image
+ MODIFY COLUMN img_minor_mime varbinary(100) NOT NULL default "unknown";
+
+ALTER TABLE /*_*/oldimage
+ MODIFY COLUMN oi_minor_mime varbinary(100) NOT NULL default "unknown";
+
+INSERT INTO /*_*/updatelog VALUES ('mime_minor_length'); \ No newline at end of file
diff --git a/maintenance/archives/patch-rd_interwiki.sql b/maintenance/archives/patch-rd_interwiki.sql
new file mode 100644
index 00000000..a12f1a7d
--- /dev/null
+++ b/maintenance/archives/patch-rd_interwiki.sql
@@ -0,0 +1,6 @@
+-- Add interwiki and fragment columns to redirect table
+
+ALTER TABLE /*$wgDBprefix*/redirect
+ ADD rd_interwiki varchar(32) default NULL,
+ ADD rd_fragment varchar(255) binary default NULL;
+
diff --git a/maintenance/archives/patch-tc-timestamp.sql b/maintenance/archives/patch-tc-timestamp.sql
new file mode 100644
index 00000000..4d90cf34
--- /dev/null
+++ b/maintenance/archives/patch-tc-timestamp.sql
@@ -0,0 +1,4 @@
+ALTER TABLE /*_*/transcache MODIFY tc_time binary(14);
+UPDATE /*_*/transcache SET tc_time = DATE_FORMAT(FROM_UNIXTIME(tc_time), "%Y%c%d%H%i%s");
+
+INSERT INTO /*_*/updatelog VALUES ('convert transcache field');
diff --git a/maintenance/archives/patch-transcache.sql b/maintenance/archives/patch-transcache.sql
index d0731697..70870efa 100644
--- a/maintenance/archives/patch-transcache.sql
+++ b/maintenance/archives/patch-transcache.sql
@@ -1,7 +1,7 @@
CREATE TABLE /*$wgDBprefix*/transcache (
tc_url varbinary(255) NOT NULL,
tc_contents TEXT,
- tc_time INT NOT NULL,
+ tc_time binary(14) NOT NULL,
UNIQUE INDEX tc_url_idx(tc_url)
) /*$wgDBTableOptions*/;
diff --git a/maintenance/archives/patch-user_properties.sql b/maintenance/archives/patch-user_properties.sql
new file mode 100644
index 00000000..e30e00dc
--- /dev/null
+++ b/maintenance/archives/patch-user_properties.sql
@@ -0,0 +1,22 @@
+--
+-- User preferences and perhaps other fun stuff. :)
+-- Replaces the old user.user_options blob, with a couple nice properties:
+--
+-- 1) We only store non-default settings, so changes to the defauls
+-- are now reflected for everybody, not just new accounts.
+-- 2) We can more easily do bulk lookups, statistics, or modifications of
+-- saved options since it's a sane table structure.
+--
+CREATE TABLE /*_*/user_properties(
+ -- Foreign key to user.user_id
+ up_user int not null,
+
+ -- Name of the option being saved. This is indexed for bulk lookup.
+ up_property varbinary(32) not null,
+
+ -- Property value as a string.
+ up_value blob
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/user_properties_user_property on /*_*/user_properties (up_user,up_property);
+CREATE INDEX /*i*/user_properties_property on /*_*/user_properties (up_property);
diff --git a/maintenance/archives/populateSha1.php b/maintenance/archives/populateSha1.php
deleted file mode 100644
index 487d3bad..00000000
--- a/maintenance/archives/populateSha1.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * Optional upgrade script to populate the img_sha1 field
- *
- * @file
- * @ingroup MaintenanceArchive
- */
-
-$optionsWithArgs = array( 'method' );
-require_once( dirname(__FILE__).'/../commandLine.inc' );
-$method = isset( $options['method'] ) ? $options['method'] : 'normal';
-
-$t = -microtime( true );
-$fname = 'populateSha1.php';
-$dbw = wfGetDB( DB_MASTER );
-$res = $dbw->select( 'image', array( 'img_name' ), array( 'img_sha1' => '' ), $fname );
-$imageTable = $dbw->tableName( 'image' );
-$oldimageTable = $dbw->tableName( 'oldimage' );
-$batch = array();
-
-$cmd = 'mysql -u' . wfEscapeShellArg( $wgDBuser ) .
- ' -h' . wfEscapeShellArg( $wgDBserver ) .
- ' -p' . wfEscapeShellArg( $wgDBpassword, $wgDBname );
-if ( $method == 'pipe' ) {
- echo "Using pipe method\n";
- $pipe = popen( $cmd, 'w' );
-}
-
-$numRows = $res->numRows();
-$i = 0;
-foreach ( $res as $row ) {
- if ( $i % 100 == 0 ) {
- printf( "Done %d of %d, %5.3f%% \r", $i, $numRows, $i / $numRows * 100 );
- wfWaitForSlaves( 5 );
- }
- $file = wfLocalFile( $row->img_name );
- if ( !$file ) {
- continue;
- }
- $sha1 = File::sha1Base36( $file->getPath() );
- if ( strval( $sha1 ) !== '' ) {
- $sql = "UPDATE $imageTable SET img_sha1=" . $dbw->addQuotes( $sha1 ) .
- " WHERE img_name=" . $dbw->addQuotes( $row->img_name );
- if ( $method == 'pipe' ) {
- fwrite( $pipe, "$sql;\n" );
- } else {
- $dbw->query( $sql, $fname );
- }
- }
- $i++;
-}
-if ( $method == 'pipe' ) {
- fflush( $pipe );
- pclose( $pipe );
-}
-$t += microtime( true );
-printf( "\nDone %d files in %.1f seconds\n", $numRows, $t );
-
-?>
diff --git a/maintenance/archives/rebuildRecentchanges.inc b/maintenance/archives/rebuildRecentchanges.inc
deleted file mode 100644
index 65ba560c..00000000
--- a/maintenance/archives/rebuildRecentchanges.inc
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-/**
- * Rebuild recent changes table
- *
- * @file
- * @deprecated
- * @ingroup MaintenanceArchive
- * @defgroup MaintenanceArchive MaintenanceArchive
- */
-
-/** */
-function rebuildRecentChangesTable()
-{
- $sql = "DROP TABLE IF EXISTS recentchanges";
- wfQuery( $sql );
-
- $sql = "CREATE TABLE recentchanges (
- rc_timestamp varchar(14) binary NOT NULL default '',
- rc_cur_time varchar(14) binary NOT NULL default '',
- rc_user int(10) unsigned NOT NULL default '0',
- rc_user_text varchar(255) binary NOT NULL default '',
- rc_namespace tinyint(3) unsigned NOT NULL default '0',
- rc_title varchar(255) binary NOT NULL default '',
- rc_comment varchar(255) binary NOT NULL default '',
- rc_minor tinyint(3) unsigned NOT NULL default '0',
- rc_new tinyint(3) unsigned NOT NULL default '0',
- rc_cur_id int(10) unsigned NOT NULL default '0',
- rc_this_oldid int(10) unsigned NOT NULL default '0',
- rc_last_oldid int(10) unsigned NOT NULL default '0',
- INDEX rc_cur_id (rc_cur_id),
- INDEX rc_cur_time (rc_cur_time),
- INDEX rc_timestamp (rc_timestamp),
- INDEX rc_namespace (rc_namespace),
- INDEX rc_title (rc_title)
-) ENGINE=MyISAM PACK_KEYS=1;";
- wfQuery( $sql );
-
- print( "Loading from CUR table...\n" );
-
- $sql = "INSERT INTO recentchanges (rc_timestamp,rc_cur_time,rc_user," .
- "rc_user_text,rc_namespace,rc_title,rc_comment,rc_minor,rc_new," .
- "rc_cur_id,rc_this_oldid,rc_last_oldid) SELECT cur_timestamp," .
- "cur_timestamp,cur_user,cur_user_text,cur_namespace,cur_title," .
- "cur_comment,cur_minor_edit,cur_is_new,cur_id,0,0 FROM cur " .
- "ORDER BY cur_timestamp DESC LIMIT 5000";
- wfQuery( $sql );
-
- print( "Loading from OLD table...\n" );
-
- $sql = "INSERT INTO recentchanges (rc_timestamp,rc_cur_time,rc_user," .
- "rc_user_text,rc_namespace,rc_title,rc_comment,rc_minor,rc_new," .
- "rc_cur_id,rc_this_oldid,rc_last_oldid) SELECT old_timestamp,''," .
- "old_user,old_user_text,old_namespace,old_title,old_comment," .
- "old_minor_edit,0,0,old_id,0 FROM old ORDER BY old_timestamp " .
- "DESC LIMIT 5000";
- wfQuery( $sql );
-
- $sql = "SELECT rc_timestamp FROM recentchanges " .
- "ORDER BY rc_timestamp DESC LIMIT 5000,1";
- $res = wfQuery( $sql );
- $obj = wfFetchObject( $res );
- $ts = $obj->rc_timestamp;
-
- $sql = "DELETE FROM recentchanges WHERE rc_timestamp < '{$ts}'";
- wfQuery( $sql );
-
- rebuildRecentChangesTablePass2();
-}
-
-function rebuildRecentChangesTablePass2()
-{
- $ns = $id = $count = 0;
- $title = $ct = "";
-
- print( "Updating links...\n" );
-
- $sql = "SELECT rc_namespace,rc_title,rc_timestamp FROM recentchanges " .
- "ORDER BY rc_namespace,rc_title,rc_timestamp DESC";
- $res = wfQuery( $sql );
-
- while ( $obj = wfFetchObject( $res ) ) {
- if ( ! ( $ns == $obj->rc_namespace &&
- 0 == strcmp( $title, wfStrencode( $obj->rc_title ) ) ) ) {
-
- $ns = $obj->rc_namespace;
- $title = wfStrencode( $obj->rc_title );
-
- $sql = "SELECT cur_id,cur_timestamp FROM cur WHERE " .
- "cur_namespace={$ns} AND cur_title='{$title}'";
- $res2 = wfQuery( $sql );
- $obj2 = wfFetchObject( $res2 );
-
- $id = $obj2->cur_id;
- $ct = $obj2->cur_timestamp;
- }
- $sql = "SELECT old_id FROM old WHERE old_namespace={$ns} " .
- "AND old_title='{$title}' AND old_timestamp < '" .
- "{$obj->rc_timestamp}' ORDER BY old_timestamp DESC LIMIT 1";
- $res2 = wfQuery( $sql );
-
- if ( 0 != wfNumRows( $res2 ) ) {
- $obj2 = wfFetchObject( $res2 );
-
- $sql = "UPDATE recentchanges SET rc_cur_id={$id},rc_cur_time=" .
- "'{$ct}',rc_last_oldid={$obj2->old_id} WHERE " .
- "rc_namespace={$ns} AND rc_title='{$title}' AND " .
- "rc_timestamp='{$obj->rc_timestamp}'";
- wfQuery( $sql );
- } else {
- $sql = "UPDATE recentchanges SET rc_cur_id={$id},rc_cur_time=" .
- "'{$ct}' WHERE rc_namespace={$ns} AND rc_title='{$title}' " .
- "AND rc_timestamp='{$obj->rc_timestamp}'";
- wfQuery( $sql );
- }
-
- if ( 0 == ( ++$count % 500 ) ) {
- printf( "%d records processed.\n", $count );
- }
- }
-}
-
-
-?>
diff --git a/maintenance/archives/upgradeWatchlist.php b/maintenance/archives/upgradeWatchlist.php
deleted file mode 100644
index 9788aa56..00000000
--- a/maintenance/archives/upgradeWatchlist.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * @file
- * @deprecated
- * @ingroup MaintenanceArchive
- */
-
-/** */
-print "This script is obsolete!";
-print "It is retained in the source here in case some of its
-code might be useful for ad-hoc conversion tasks, but it is
-not maintained and probably won't even work as is.";
-exit();
-
-# Convert watchlists to new format
-
-global $IP;
-require_once( "../LocalSettings.php" );
-require_once( "$IP/Setup.php" );
-
-$wgTitle = Title::newFromText( "Rebuild links script" );
-set_time_limit(0);
-
-$wgDBuser = "wikiadmin";
-$wgDBpassword = $wgDBadminpassword;
-
-$sql = "DROP TABLE IF EXISTS watchlist";
-wfQuery( $sql, DB_MASTER );
-$sql = "CREATE TABLE watchlist (
- wl_user int(5) unsigned NOT NULL,
- wl_page int(8) unsigned NOT NULL,
- UNIQUE KEY (wl_user, wl_page)
-) ENGINE=MyISAM PACK_KEYS=1";
-wfQuery( $sql, DB_MASTER );
-
-$lc = new LinkCache;
-
-# Now, convert!
-$sql = "SELECT user_id,user_watch FROM user";
-$res = wfQuery( $sql, DB_SLAVE );
-$nu = wfNumRows( $res );
-$sql = "INSERT into watchlist (wl_user,wl_page) VALUES ";
-$i = $n = 0;
-while( $row = wfFetchObject( $res ) ) {
- $list = explode( "\n", $row->user_watch );
- $bits = array();
- foreach( $list as $title ) {
- if( $id = $lc->addLink( $title ) and ! $bits[$id]++) {
- $sql .= ($i++ ? "," : "") . "({$row->user_id},{$id})";
- }
- }
- if( ($n++ % 100) == 0 ) echo "$n of $nu users done...\n";
-}
-echo "$n users done.\n";
-if( $i ) {
- wfQuery( $sql, DB_MASTER );
-}
-
-
-# Add index
-# is this necessary?
-$sql = "ALTER TABLE watchlist
- ADD INDEX wl_user (wl_user),
- ADD INDEX wl_page (wl_page)";
-#wfQuery( $sql, DB_MASTER );
-
-