summaryrefslogtreecommitdiff
path: root/maintenance/storage
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/storage')
-rw-r--r--maintenance/storage/blobs.sql3
-rw-r--r--maintenance/storage/checkStorage.php8
-rw-r--r--maintenance/storage/compressOld.php9
-rw-r--r--maintenance/storage/drop_content_model_info.sql7
-rw-r--r--maintenance/storage/dumpRev.php9
-rw-r--r--maintenance/storage/fixBug20757.php14
-rwxr-xr-xmaintenance/storage/make-blobs4
-rw-r--r--maintenance/storage/moveToExternal.php4
-rw-r--r--maintenance/storage/orphanStats.php11
-rw-r--r--maintenance/storage/recompressTracked.php43
-rw-r--r--maintenance/storage/resolveStubs.php5
-rw-r--r--maintenance/storage/storageTypeStats.php1
-rw-r--r--maintenance/storage/testCompression.php8
-rw-r--r--maintenance/storage/trackBlobs.php10
14 files changed, 84 insertions, 52 deletions
diff --git a/maintenance/storage/blobs.sql b/maintenance/storage/blobs.sql
index 623dd7bf..979e68a9 100644
--- a/maintenance/storage/blobs.sql
+++ b/maintenance/storage/blobs.sql
@@ -4,5 +4,4 @@ CREATE TABLE /*$wgDBprefix*/blobs (
blob_id integer UNSIGNED NOT NULL AUTO_INCREMENT,
blob_text longblob,
PRIMARY KEY (blob_id)
-) ENGINE=MyISAM MAX_ROWS=100000000 AVG_ROW_LENGTH=100000;
-
+) ENGINE=InnoDB;
diff --git a/maintenance/storage/checkStorage.php b/maintenance/storage/checkStorage.php
index 6c669bfa..fd9393f2 100644
--- a/maintenance/storage/checkStorage.php
+++ b/maintenance/storage/checkStorage.php
@@ -38,14 +38,16 @@ if ( !defined( 'MEDIAWIKI' ) ) {
// ----------------------------------------------------------------------------------
/**
+ * Maintenance script to do various checks on external storage.
+ *
* @ingroup Maintenance ExternalStorage
*/
class CheckStorage {
const CONCAT_HEADER = 'O:27:"concatenatedgziphistoryblob"';
- var $oldIdMap, $errors;
- var $dbStore = null;
+ public $oldIdMap, $errors;
+ public $dbStore = null;
- var $errorDescriptions = array(
+ public $errorDescriptions = array(
'restore text' => 'Damaged text, need to be restored from a backup',
'restore revision' => 'Damaged revision row, need to be restored from a backup',
'unfixable' => 'Unexpected errors with no automated fixing method',
diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php
index 4594db71..d6362834 100644
--- a/maintenance/storage/compressOld.php
+++ b/maintenance/storage/compressOld.php
@@ -43,6 +43,11 @@
require_once( __DIR__ . '/../Maintenance.php' );
+/**
+ * Maintenance script that compress the text of a wiki.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
class CompressOld extends Maintenance {
/**
* @todo document
@@ -110,7 +115,7 @@ class CompressOld extends Maintenance {
do {
$res = $dbw->select( 'text', array( 'old_id','old_flags','old_text' ),
"old_id>=$start", __METHOD__, array( 'ORDER BY' => 'old_id', 'LIMIT' => $chunksize, 'FOR UPDATE' ) );
- if( $dbw->numRows( $res ) == 0 ) {
+ if( $res->numRows() == 0 ) {
break;
}
$last = $start;
@@ -251,7 +256,7 @@ class CompressOld extends Maintenance {
$pageRes = $dbr->select( 'page',
array('page_id', 'page_namespace', 'page_title','page_latest'),
$pageConds + array('page_id' => $pageId), __METHOD__ );
- if ( $dbr->numRows( $pageRes ) == 0 ) {
+ if ( $pageRes->numRows() == 0 ) {
continue;
}
$pageRow = $dbr->fetchObject( $pageRes );
diff --git a/maintenance/storage/drop_content_model_info.sql b/maintenance/storage/drop_content_model_info.sql
new file mode 100644
index 00000000..7bd9aba9
--- /dev/null
+++ b/maintenance/storage/drop_content_model_info.sql
@@ -0,0 +1,7 @@
+ALTER TABLE /*$wgDBprefix*/archive DROP COLUMN ar_content_model;
+ALTER TABLE /*$wgDBprefix*/archive DROP COLUMN ar_content_format;
+
+ALTER TABLE /*$wgDBprefix*/revision DROP COLUMN rev_content_model;
+ALTER TABLE /*$wgDBprefix*/revision DROP COLUMN rev_content_format;
+
+ALTER TABLE /*$wgDBprefix*/page DROP COLUMN page_content_model;
diff --git a/maintenance/storage/dumpRev.php b/maintenance/storage/dumpRev.php
index 6020f22e..39f08f9d 100644
--- a/maintenance/storage/dumpRev.php
+++ b/maintenance/storage/dumpRev.php
@@ -1,5 +1,7 @@
<?php
/**
+ * Get the text of a revision, resolving external storage if needed.
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -15,11 +17,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
+ * @file
* @ingroup Maintenance ExternalStorage
*/
require_once( __DIR__ . '/../Maintenance.php' );
+/**
+ * Maintenance script that gets the text of a revision,
+ * resolving external storage if needed.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
class DumpRev extends Maintenance {
public function __construct() {
parent::__construct();
diff --git a/maintenance/storage/fixBug20757.php b/maintenance/storage/fixBug20757.php
index 52ee825c..30cbcf1a 100644
--- a/maintenance/storage/fixBug20757.php
+++ b/maintenance/storage/fixBug20757.php
@@ -23,11 +23,16 @@
require_once( __DIR__ . '/../Maintenance.php' );
+/**
+ * Maintenance script to fix bug 20757.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
class FixBug20757 extends Maintenance {
- var $batchSize = 10000;
- var $mapCache = array();
- var $mapCacheSize = 0;
- var $maxMapCacheSize = 1000000;
+ public $batchSize = 10000;
+ public $mapCache = array();
+ public $mapCacheSize = 0;
+ public $maxMapCacheSize = 1000000;
function __construct() {
parent::__construct();
@@ -344,4 +349,3 @@ class FixBug20757 extends Maintenance {
$maintClass = 'FixBug20757';
require_once( RUN_MAINTENANCE_IF_MAIN );
-
diff --git a/maintenance/storage/make-blobs b/maintenance/storage/make-blobs
index 36cf9ced..16dcb672 100755
--- a/maintenance/storage/make-blobs
+++ b/maintenance/storage/make-blobs
@@ -6,11 +6,9 @@ if [ -z $2 ];then
fi
if [ -z $3 ]; then
table=blobs
-else
+else
table=$3
fi
echo "CREATE DATABASE $2" | mysql -u wikiadmin -p`wikiadmin_pass` -h $1 && \
sed "s/blobs\>/$table/" blobs.sql | mysql -u wikiadmin -p`wikiadmin_pass` -h $1 $2
-
-
diff --git a/maintenance/storage/moveToExternal.php b/maintenance/storage/moveToExternal.php
index 2dcc25c2..1049e0cc 100644
--- a/maintenance/storage/moveToExternal.php
+++ b/maintenance/storage/moveToExternal.php
@@ -25,7 +25,7 @@ define( 'REPORTING_INTERVAL', 1 );
if ( !defined( 'MEDIAWIKI' ) ) {
require_once( __DIR__ . '/../commandLine.inc' );
- require_once( __DIR__ . '/../../includes/ExternalStoreDB.php' );
+ require_once( __DIR__ . '/../../includes/externalstore/ExternalStoreDB.php' );
require_once( 'resolveStubs.php' );
$fname = 'moveToExternal';
@@ -124,5 +124,3 @@ function moveToExternal( $cluster, $maxID, $minID = 1 ) {
}
}
}
-
-
diff --git a/maintenance/storage/orphanStats.php b/maintenance/storage/orphanStats.php
index 82ee135b..4e246287 100644
--- a/maintenance/storage/orphanStats.php
+++ b/maintenance/storage/orphanStats.php
@@ -1,7 +1,6 @@
<?php
-
/**
- * Show some statistics on the blob_orphans table, created with trackBlobs.php
+ * Show some statistics on the blob_orphans table, created with trackBlobs.php.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,10 +17,18 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
+ * @file
* @ingroup Maintenance ExternalStorage
*/
+
require_once( __DIR__ . '/../Maintenance.php' );
+/**
+ * Maintenance script that shows some statistics on the blob_orphans table,
+ * created with trackBlobs.php.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
class OrphanStats extends Maintenance {
public function __construct() {
parent::__construct();
diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php
index 4098077f..030a147e 100644
--- a/maintenance/storage/recompressTracked.php
+++ b/maintenance/storage/recompressTracked.php
@@ -42,20 +42,26 @@ Options:
$job = RecompressTracked::newFromCommandLine( $args, $options );
$job->execute();
+/**
+ * Maintenance script that moves blobs indexed by trackBlobs.php to a specified
+ * list of destination clusters, and recompresses them in the process.
+ *
+ * @ingroup Maintenance ExternalStorage
+ */
class RecompressTracked {
- var $destClusters;
- var $batchSize = 1000;
- var $orphanBatchSize = 1000;
- var $reportingInterval = 10;
- var $numProcs = 1;
- var $useDiff, $pageBlobClass, $orphanBlobClass;
- var $slavePipes, $slaveProcs, $prevSlaveId;
- var $copyOnly = false;
- var $isChild = false;
- var $slaveId = false;
- var $noCount = false;
- var $debugLog, $infoLog, $criticalLog;
- var $store;
+ public $destClusters;
+ public $batchSize = 1000;
+ public $orphanBatchSize = 1000;
+ public $reportingInterval = 10;
+ public $numProcs = 1;
+ public $useDiff, $pageBlobClass, $orphanBlobClass;
+ public $slavePipes, $slaveProcs, $prevSlaveId;
+ public $copyOnly = false;
+ public $isChild = false;
+ public $slaveId = false;
+ public $noCount = false;
+ public $debugLog, $infoLog, $criticalLog;
+ public $store;
static $optionsWithArgs = array( 'procs', 'slave-id', 'debug-log', 'info-log', 'critical-log' );
static $cmdLineOptionMap = array(
@@ -517,7 +523,7 @@ class RecompressTracked {
*
* Write the new URL to the text table and set the bt_moved flag.
*
- * This is done in a single transaction to provide restartable behaviour
+ * This is done in a single transaction to provide restartable behavior
* without data loss.
*
* The transaction is kept short to reduce locking.
@@ -670,10 +676,10 @@ class RecompressTracked {
* Class to represent a recompression operation for a single CGZ blob
*/
class CgzCopyTransaction {
- var $parent;
- var $blobClass;
- var $cgz;
- var $referrers;
+ public $parent;
+ public $blobClass;
+ public $cgz;
+ public $referrers;
/**
* Create a transaction from a RecompressTracked object
@@ -803,4 +809,3 @@ class CgzCopyTransaction {
}
}
}
-
diff --git a/maintenance/storage/resolveStubs.php b/maintenance/storage/resolveStubs.php
index 7e288e13..414eab81 100644
--- a/maintenance/storage/resolveStubs.php
+++ b/maintenance/storage/resolveStubs.php
@@ -1,7 +1,7 @@
<?php
/**
- * Script to convert history stubs that point to an external row to direct
- * external pointers.
+ * Convert history stubs that point to an external row to direct external
+ * pointers.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -110,4 +110,3 @@ function resolveStub( $id, $stubText, $flags ) {
), $fname
);
}
-
diff --git a/maintenance/storage/storageTypeStats.php b/maintenance/storage/storageTypeStats.php
index 1afecc4e..3187c318 100644
--- a/maintenance/storage/storageTypeStats.php
+++ b/maintenance/storage/storageTypeStats.php
@@ -113,4 +113,3 @@ SQL;
$maintClass = 'StorageTypeStats';
require_once( RUN_MAINTENANCE_IF_MAIN );
-
diff --git a/maintenance/storage/testCompression.php b/maintenance/storage/testCompression.php
index 998ebe48..e13e1b10 100644
--- a/maintenance/storage/testCompression.php
+++ b/maintenance/storage/testCompression.php
@@ -1,5 +1,7 @@
<?php
/**
+ * Test revision text compression and decompression.
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -16,8 +18,7 @@
* http://www.gnu.org/copyleft/gpl.html
*
* @file
- * @ingroup Maintenance
- * @see wfWaitForSlaves()
+ * @ingroup Maintenance ExternalStorage
*/
$optionsWithArgs = array( 'start', 'limit', 'type' );
@@ -65,7 +66,7 @@ $uncompressedSize = 0;
$t = -microtime( true );
foreach ( $res as $row ) {
$revision = new Revision( $row );
- $text = $revision->getText();
+ $text = $revision->getSerializedData();
$uncompressedSize += strlen( $text );
$hashes[$row->rev_id] = md5( $text );
$keys[$row->rev_id] = $blob->addItem( $text );
@@ -98,4 +99,3 @@ foreach ( $keys as $id => $key ) {
}
$t += microtime( true );
printf( "Decompression time: %5.2f ms\n", $t * 1000 );
-
diff --git a/maintenance/storage/trackBlobs.php b/maintenance/storage/trackBlobs.php
index 214168a8..2f3c8c6a 100644
--- a/maintenance/storage/trackBlobs.php
+++ b/maintenance/storage/trackBlobs.php
@@ -37,12 +37,12 @@ $tracker->run();
echo "All done.\n";
class TrackBlobs {
- var $clusters, $textClause;
- var $doBlobOrphans;
- var $trackedBlobs = array();
+ public $clusters, $textClause;
+ public $doBlobOrphans;
+ public $trackedBlobs = array();
- var $batchSize = 1000;
- var $reportingInterval = 10;
+ public $batchSize = 1000;
+ public $reportingInterval = 10;
function __construct( $clusters ) {
$this->clusters = $clusters;