summaryrefslogtreecommitdiff
path: root/maintenance/archives
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
committerPierre Schmitz <pierre@archlinux.de>2008-08-15 01:29:47 +0200
commit370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch)
tree491674f4c242e4d6ba0d04eafa305174c35a3391 /maintenance/archives
parentf4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff)
Update auf 1.13.0
Diffstat (limited to 'maintenance/archives')
-rw-r--r--maintenance/archives/patch-ar_parent_id.sql3
-rw-r--r--maintenance/archives/patch-category.sql17
-rw-r--r--maintenance/archives/patch-filearhive-user-index.sql5
-rw-r--r--maintenance/archives/patch-hitcounter.sql2
-rw-r--r--maintenance/archives/patch-ipb_by_text.sql10
-rw-r--r--maintenance/archives/patch-page_props.sql9
-rw-r--r--maintenance/archives/patch-profiling-memory.sql2
-rw-r--r--maintenance/archives/patch-profiling.sql3
-rw-r--r--maintenance/archives/patch-protected_titles.sql2
-rw-r--r--maintenance/archives/patch-pt_title-encoding.sql5
-rw-r--r--maintenance/archives/patch-searchindex.sql2
-rw-r--r--maintenance/archives/patch-updatelog.sql4
-rw-r--r--maintenance/archives/patch-user_last_timestamp.sql3
-rw-r--r--maintenance/archives/populateSha1.php8
-rw-r--r--maintenance/archives/rebuildRecentchanges.inc6
-rw-r--r--maintenance/archives/upgradeLogging.php189
-rw-r--r--maintenance/archives/upgradeWatchlist.php5
17 files changed, 265 insertions, 10 deletions
diff --git a/maintenance/archives/patch-ar_parent_id.sql b/maintenance/archives/patch-ar_parent_id.sql
new file mode 100644
index 00000000..b24cf46c
--- /dev/null
+++ b/maintenance/archives/patch-ar_parent_id.sql
@@ -0,0 +1,3 @@
+-- Adding ar_deleted field for revisiondelete
+ALTER TABLE /*$wgDBprefix*/archive
+ ADD ar_parent_id int unsigned default NULL;
diff --git a/maintenance/archives/patch-category.sql b/maintenance/archives/patch-category.sql
new file mode 100644
index 00000000..416500c3
--- /dev/null
+++ b/maintenance/archives/patch-category.sql
@@ -0,0 +1,17 @@
+CREATE TABLE /*$wgDBprefix*/category (
+ cat_id int unsigned NOT NULL auto_increment,
+
+ cat_title varchar(255) binary NOT NULL,
+
+ cat_pages int signed NOT NULL default 0,
+ cat_subcats int signed NOT NULL default 0,
+ cat_files int signed NOT NULL default 0,
+
+ cat_hidden tinyint(1) unsigned NOT NULL default 0,
+
+ PRIMARY KEY (cat_id),
+ UNIQUE KEY (cat_title),
+
+ KEY (cat_pages)
+) /*$wgDBTableOptions*/;
+
diff --git a/maintenance/archives/patch-filearhive-user-index.sql b/maintenance/archives/patch-filearhive-user-index.sql
new file mode 100644
index 00000000..c79000ad
--- /dev/null
+++ b/maintenance/archives/patch-filearhive-user-index.sql
@@ -0,0 +1,5 @@
+-- Adding index to sort by uploader
+ALTER TABLE /*$wgDBprefix*/filearchive
+ ADD INDEX fa_user_timestamp (fa_user_text,fa_timestamp),
+ -- Remove useless, incomplete index
+ DROP INDEX fa_deleted_user;
diff --git a/maintenance/archives/patch-hitcounter.sql b/maintenance/archives/patch-hitcounter.sql
index 260f717f..50e56e0c 100644
--- a/maintenance/archives/patch-hitcounter.sql
+++ b/maintenance/archives/patch-hitcounter.sql
@@ -6,4 +6,4 @@
CREATE TABLE /*$wgDBprefix*/hitcounter (
hc_id INTEGER UNSIGNED NOT NULL
-) TYPE=HEAP MAX_ROWS=25000;
+) ENGINE=HEAP MAX_ROWS=25000;
diff --git a/maintenance/archives/patch-ipb_by_text.sql b/maintenance/archives/patch-ipb_by_text.sql
new file mode 100644
index 00000000..c0b620d3
--- /dev/null
+++ b/maintenance/archives/patch-ipb_by_text.sql
@@ -0,0 +1,10 @@
+-- Adding colomn with username of blocker and sets it.
+-- Required for crosswiki blocks.
+
+ALTER TABLE /*$wgDBprefix*/ipblocks
+ ADD ipb_by_text varchar(255) binary NOT NULL default '';
+
+UPDATE /*$wgDBprefix*/ipblocks
+ JOIN /*$wgDBprefix*/user ON ipb_by = user_id
+ SET ipb_by_text = user_name
+ WHERE ipb_by != 0; \ No newline at end of file
diff --git a/maintenance/archives/patch-page_props.sql b/maintenance/archives/patch-page_props.sql
new file mode 100644
index 00000000..15a35581
--- /dev/null
+++ b/maintenance/archives/patch-page_props.sql
@@ -0,0 +1,9 @@
+-- Name/value pairs indexed by page_id
+CREATE TABLE /*$wgDBprefix*/page_props (
+ pp_page int NOT NULL,
+ pp_propname varbinary(60) NOT NULL,
+ pp_value blob NOT NULL,
+
+ PRIMARY KEY (pp_page,pp_propname)
+) /*$wgDBTableOptions*/;
+
diff --git a/maintenance/archives/patch-profiling-memory.sql b/maintenance/archives/patch-profiling-memory.sql
new file mode 100644
index 00000000..ddd851e1
--- /dev/null
+++ b/maintenance/archives/patch-profiling-memory.sql
@@ -0,0 +1,2 @@
+ALTER TABLE /*$wgDBprefix*/profiling
+ ADD pf_memory float NOT NULL default 0;
diff --git a/maintenance/archives/patch-profiling.sql b/maintenance/archives/patch-profiling.sql
index bafd2b67..e748ca31 100644
--- a/maintenance/archives/patch-profiling.sql
+++ b/maintenance/archives/patch-profiling.sql
@@ -4,7 +4,8 @@
CREATE TABLE /*$wgDBprefix*/profiling (
pf_count int NOT NULL default 0,
pf_time float NOT NULL default 0,
+ pf_memory float NOT NULL default 0,
pf_name varchar(255) NOT NULL default '',
pf_server varchar(30) NOT NULL default '',
UNIQUE KEY pf_name_server (pf_name, pf_server)
-) TYPE=HEAP;
+) ENGINE=HEAP;
diff --git a/maintenance/archives/patch-protected_titles.sql b/maintenance/archives/patch-protected_titles.sql
index 5307cbdd..20b6035d 100644
--- a/maintenance/archives/patch-protected_titles.sql
+++ b/maintenance/archives/patch-protected_titles.sql
@@ -1,7 +1,7 @@
-- Protected titles - nonexistent pages that have been protected
CREATE TABLE /*$wgDBprefix*/protected_titles (
pt_namespace int NOT NULL,
- pt_title varchar(255) NOT NULL,
+ pt_title varchar(255) binary NOT NULL,
pt_user int unsigned NOT NULL,
pt_reason tinyblob,
pt_timestamp binary(14) NOT NULL,
diff --git a/maintenance/archives/patch-pt_title-encoding.sql b/maintenance/archives/patch-pt_title-encoding.sql
new file mode 100644
index 00000000..b0a23932
--- /dev/null
+++ b/maintenance/archives/patch-pt_title-encoding.sql
@@ -0,0 +1,5 @@
+-- pt_title was accidentally left with the wrong collation.
+-- This might cause failures with JOINs, and could protect the wrong pages
+-- with different case variants or unrelated UTF-8 chars.
+ALTER TABLE /*$wgDBprefix*/protected_titles
+ CHANGE COLUMN pt_title pt_title varchar(255) binary NOT NULL;
diff --git a/maintenance/archives/patch-searchindex.sql b/maintenance/archives/patch-searchindex.sql
index 452c4548..9b635a8f 100644
--- a/maintenance/archives/patch-searchindex.sql
+++ b/maintenance/archives/patch-searchindex.sql
@@ -19,7 +19,7 @@ CREATE TABLE /*$wgDBprefix*/searchindex (
UNIQUE KEY (si_page)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
-- Copying data into new table...
INSERT INTO /*$wgDBprefix*/searchindex
diff --git a/maintenance/archives/patch-updatelog.sql b/maintenance/archives/patch-updatelog.sql
new file mode 100644
index 00000000..168ad082
--- /dev/null
+++ b/maintenance/archives/patch-updatelog.sql
@@ -0,0 +1,4 @@
+CREATE TABLE /*$wgDBprefix*/updatelog (
+ ul_key varchar(255) NOT NULL,
+ PRIMARY KEY (ul_key)
+) /*$wgDBTableOptions*/;
diff --git a/maintenance/archives/patch-user_last_timestamp.sql b/maintenance/archives/patch-user_last_timestamp.sql
new file mode 100644
index 00000000..b6d5f0f3
--- /dev/null
+++ b/maintenance/archives/patch-user_last_timestamp.sql
@@ -0,0 +1,3 @@
+-- For getting diff since last view
+ALTER TABLE /*$wgDBprefix*/user_newtalk
+ ADD user_last_timestamp binary(14) NOT NULL default '';
diff --git a/maintenance/archives/populateSha1.php b/maintenance/archives/populateSha1.php
index 45f29c43..487d3bad 100644
--- a/maintenance/archives/populateSha1.php
+++ b/maintenance/archives/populateSha1.php
@@ -1,6 +1,10 @@
<?php
-
-# Optional upgrade script to populate the img_sha1 field
+/**
+ * Optional upgrade script to populate the img_sha1 field
+ *
+ * @file
+ * @ingroup MaintenanceArchive
+ */
$optionsWithArgs = array( 'method' );
require_once( dirname(__FILE__).'/../commandLine.inc' );
diff --git a/maintenance/archives/rebuildRecentchanges.inc b/maintenance/archives/rebuildRecentchanges.inc
index 1eaadc4d..65ba560c 100644
--- a/maintenance/archives/rebuildRecentchanges.inc
+++ b/maintenance/archives/rebuildRecentchanges.inc
@@ -2,8 +2,10 @@
/**
* Rebuild recent changes table
*
+ * @file
* @deprecated
- * @addtogroup MaintenanceArchive
+ * @ingroup MaintenanceArchive
+ * @defgroup MaintenanceArchive MaintenanceArchive
*/
/** */
@@ -30,7 +32,7 @@ function rebuildRecentChangesTable()
INDEX rc_timestamp (rc_timestamp),
INDEX rc_namespace (rc_namespace),
INDEX rc_title (rc_title)
-) TYPE=MyISAM PACK_KEYS=1;";
+) ENGINE=MyISAM PACK_KEYS=1;";
wfQuery( $sql );
print( "Loading from CUR table...\n" );
diff --git a/maintenance/archives/upgradeLogging.php b/maintenance/archives/upgradeLogging.php
new file mode 100644
index 00000000..f79bbabc
--- /dev/null
+++ b/maintenance/archives/upgradeLogging.php
@@ -0,0 +1,189 @@
+<?php
+/**
+ * Replication-safe online upgrade script for log_id/log_deleted
+ *
+ * @file
+ * @ingroup MaintenanceArchive
+ */
+
+require( dirname(__FILE__).'/../commandLine.inc' );
+
+class UpdateLogging {
+ var $dbw;
+ var $batchSize = 1000;
+ var $minTs = false;
+
+ function execute() {
+ $this->dbw = wfGetDB( DB_MASTER );
+ $logging = $this->dbw->tableName( 'logging' );
+ $logging_1_10 = $this->dbw->tableName( 'logging_1_10' );
+ $logging_pre_1_10 = $this->dbw->tableName( 'logging_pre_1_10' );
+
+ if ( $this->dbw->tableExists( 'logging_pre_1_10' ) && !$this->dbw->tableExists( 'logging' ) ) {
+ # Fix previous aborted run
+ echo "Cleaning up from previous aborted run\n";
+ $this->dbw->query( "RENAME TABLE $logging_pre_1_10 TO $logging", __METHOD__ );
+ }
+
+ if ( $this->dbw->tableExists( 'logging_pre_1_10' ) ) {
+ echo "This script has already been run to completion\n";
+ return;
+ }
+
+ # Create the target table
+ if ( !$this->dbw->tableExists( 'logging_1_10' ) ) {
+ global $wgDBTableOptions;
+
+ $sql = <<<EOT
+CREATE TABLE $logging_1_10 (
+ -- Log ID, for referring to this specific log entry, probably for deletion and such.
+ log_id int unsigned NOT NULL auto_increment,
+
+ -- 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 varbinary(10) NOT NULL default '',
+ log_action varbinary(10) NOT NULL default '',
+
+ -- Timestamp. Duh.
+ 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,
+
+ -- Key to the page affected. Where a user is the target,
+ -- this will point to the user page.
+ log_namespace int NOT NULL default 0,
+ log_title varchar(255) binary NOT NULL default '',
+
+ -- Freeform text. Interpreted as edit history comments.
+ log_comment varchar(255) NOT NULL default '',
+
+ -- LF separated list of miscellaneous parameters
+ log_params blob NOT NULL,
+
+ -- rev_deleted for logs
+ log_deleted tinyint unsigned NOT NULL default '0',
+
+ PRIMARY KEY log_id (log_id),
+ KEY type_time (log_type, log_timestamp),
+ KEY user_time (log_user, log_timestamp),
+ KEY page_time (log_namespace, log_title, log_timestamp),
+ KEY times (log_timestamp)
+
+) $wgDBTableOptions
+EOT;
+ echo "Creating table logging_1_10\n";
+ $this->dbw->query( $sql, __METHOD__ );
+ }
+
+ # Synchronise the tables
+ echo "Doing initial sync...\n";
+ $this->sync( 'logging', 'logging_1_10' );
+ echo "Sync done\n\n";
+
+ # Rename the old table away
+ echo "Renaming the old table to $logging_pre_1_10\n";
+ $this->dbw->query( "RENAME TABLE $logging TO $logging_pre_1_10", __METHOD__ );
+
+ # Copy remaining old rows
+ # Done before the new table is active so that $copyPos is accurate
+ echo "Doing final sync...\n";
+ $this->sync( 'logging_pre_1_10', 'logging_1_10' );
+
+ # Move the new table in
+ echo "Moving the new table in...\n";
+ $this->dbw->query( "RENAME TABLE $logging_1_10 TO $logging", __METHOD__ );
+ echo "Finished.\n";
+ }
+
+ /**
+ * Copy all rows from $srcTable to $dstTable
+ */
+ function sync( $srcTable, $dstTable ) {
+ $batchSize = 1000;
+ $minTs = $this->dbw->selectField( $srcTable, 'MIN(log_timestamp)', false, __METHOD__ );
+ $minTsUnix = wfTimestamp( TS_UNIX, $minTs );
+ $numRowsCopied = 0;
+
+ while ( true ) {
+ $maxTs = $this->dbw->selectField( $srcTable, 'MAX(log_timestamp)', false, __METHOD__ );
+ $copyPos = $this->dbw->selectField( $dstTable, 'MAX(log_timestamp)', false, __METHOD__ );
+ $maxTsUnix = wfTimestamp( TS_UNIX, $maxTs );
+ $copyPosUnix = wfTimestamp( TS_UNIX, $copyPos );
+
+ if ( $copyPos === null ) {
+ $percent = 0;
+ } else {
+ $percent = ( $copyPosUnix - $minTsUnix ) / ( $maxTsUnix - $minTsUnix ) * 100;
+ }
+ printf( "%s %.2f%%\n", $copyPos, $percent );
+
+ # Handle all entries with timestamp equal to $copyPos
+ if ( $copyPos !== null ) {
+ $numRowsCopied += $this->copyExactMatch( $srcTable, $dstTable, $copyPos );
+ }
+
+ # Now copy a batch of rows
+ if ( $copyPos === null ) {
+ $conds = false;
+ } else {
+ $conds = array( 'log_timestamp > ' . $this->dbw->addQuotes( $copyPos ) );
+ }
+ $srcRes = $this->dbw->select( $srcTable, '*', $conds, __METHOD__,
+ array( 'LIMIT' => $batchSize, 'ORDER BY' => 'log_timestamp' ) );
+
+ if ( ! $srcRes->numRows() ) {
+ # All done
+ break;
+ }
+
+ $batch = array();
+ foreach ( $srcRes as $srcRow ) {
+ $batch[] = (array)$srcRow;
+ }
+ $this->dbw->insert( $dstTable, $batch, __METHOD__ );
+ $numRowsCopied += count( $batch );
+
+ wfWaitForSlaves( 5 );
+ }
+ echo "Copied $numRowsCopied rows\n";
+ }
+
+ function copyExactMatch( $srcTable, $dstTable, $copyPos ) {
+ $numRowsCopied = 0;
+ $srcRes = $this->dbw->select( $srcTable, '*', array( 'log_timestamp' => $copyPos ), __METHOD__ );
+ $dstRes = $this->dbw->select( $dstTable, '*', array( 'log_timestamp' => $copyPos ), __METHOD__ );
+
+ if ( $srcRes->numRows() ) {
+ $srcRow = $srcRes->fetchObject();
+ $srcFields = array_keys( (array)$srcRow );
+ $srcRes->seek( 0 );
+ $dstRowsSeen = array();
+
+ # Make a hashtable of rows that already exist in the destination
+ foreach ( $dstRes as $dstRow ) {
+ $reducedDstRow = array();
+ foreach ( $srcFields as $field ) {
+ $reducedDstRow[$field] = $dstRow->$field;
+ }
+ $hash = md5( serialize( $reducedDstRow ) );
+ $dstRowsSeen[$hash] = true;
+ }
+
+ # Copy all the source rows that aren't already in the destination
+ foreach ( $srcRes as $srcRow ) {
+ $hash = md5( serialize( (array)$srcRow ) );
+ if ( !isset( $dstRowsSeen[$hash] ) ) {
+ $this->dbw->insert( $dstTable, (array)$srcRow, __METHOD__ );
+ $numRowsCopied++;
+ }
+ }
+ }
+ return $numRowsCopied;
+ }
+}
+
+$ul = new UpdateLogging;
+$ul->execute();
+
diff --git a/maintenance/archives/upgradeWatchlist.php b/maintenance/archives/upgradeWatchlist.php
index e62a39ad..9788aa56 100644
--- a/maintenance/archives/upgradeWatchlist.php
+++ b/maintenance/archives/upgradeWatchlist.php
@@ -1,7 +1,8 @@
<?php
/**
+ * @file
* @deprecated
- * @addtogroup MaintenanceArchive
+ * @ingroup MaintenanceArchive
*/
/** */
@@ -29,7 +30,7 @@ $sql = "CREATE TABLE watchlist (
wl_user int(5) unsigned NOT NULL,
wl_page int(8) unsigned NOT NULL,
UNIQUE KEY (wl_user, wl_page)
-) TYPE=MyISAM PACK_KEYS=1";
+) ENGINE=MyISAM PACK_KEYS=1";
wfQuery( $sql, DB_MASTER );
$lc = new LinkCache;