summaryrefslogtreecommitdiff
path: root/maintenance/storage
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
commit63601400e476c6cf43d985f3e7b9864681695ed4 (patch)
treef7846203a952e38aaf66989d0a4702779f549962 /maintenance/storage
parent8ff01378c9e0207f9169b81966a51def645b6a51 (diff)
Update to MediaWiki 1.20.2
this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'maintenance/storage')
-rw-r--r--maintenance/storage/checkStorage.php14
-rw-r--r--maintenance/storage/compressOld.php15
-rw-r--r--maintenance/storage/dumpRev.php2
-rw-r--r--maintenance/storage/fixBug20757.php6
-rw-r--r--maintenance/storage/moveToExternal.php4
-rw-r--r--maintenance/storage/orphanStats.php4
-rw-r--r--maintenance/storage/recompressTracked.php14
-rw-r--r--maintenance/storage/resolveStubs.php2
-rw-r--r--maintenance/storage/storageTypeStats.php2
-rw-r--r--maintenance/storage/testCompression.php2
-rw-r--r--maintenance/storage/trackBlobs.php4
11 files changed, 35 insertions, 34 deletions
diff --git a/maintenance/storage/checkStorage.php b/maintenance/storage/checkStorage.php
index af1f9ee2..6c669bfa 100644
--- a/maintenance/storage/checkStorage.php
+++ b/maintenance/storage/checkStorage.php
@@ -22,7 +22,7 @@
*/
if ( !defined( 'MEDIAWIKI' ) ) {
- require_once( dirname( __FILE__ ) . '/../commandLine.inc' );
+ require_once( __DIR__ . '/../commandLine.inc' );
$cs = new CheckStorage;
$fix = isset( $options['fix'] );
@@ -381,14 +381,15 @@ class CheckStorage {
$extDb->freeResult( $res );
// Print errors for missing blobs rows
- foreach ( $oldIds as $blobId => $oldIds ) {
- $this->error( 'restore text', "Error: missing target $cluster/$blobId for two-part ES URL", $oldIds );
+ foreach ( $oldIds as $blobId => $oldIds2 ) {
+ $this->error( 'restore text', "Error: missing target $cluster/$blobId for two-part ES URL", $oldIds2 );
}
}
}
function restoreText( $revIds, $xml ) {
- global $wgTmpDirectory, $wgDBname;
+ global $wgDBname;
+ $tmpDir = wfTempDir();
if ( !count( $revIds ) ) {
return;
@@ -396,8 +397,8 @@ class CheckStorage {
print "Restoring text from XML backup...\n";
- $revFileName = "$wgTmpDirectory/broken-revlist-$wgDBname";
- $filteredXmlFileName = "$wgTmpDirectory/filtered-$wgDBname.xml";
+ $revFileName = "$tmpDir/broken-revlist-$wgDBname";
+ $filteredXmlFileName = "$tmpDir/filtered-$wgDBname.xml";
// Write revision list
if ( !file_put_contents( $revFileName, implode( "\n", $revIds ) ) ) {
@@ -481,4 +482,3 @@ class CheckStorage {
$this->errors['fixed'][$id] = true;
}
}
-
diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php
index afe01458..4594db71 100644
--- a/maintenance/storage/compressOld.php
+++ b/maintenance/storage/compressOld.php
@@ -17,8 +17,9 @@
* -c <chunk-size> maximum number of revisions in a concat chunk
* -b <begin-date> earliest date to check for uncompressed revisions
* -e <end-date> latest revision date to compress
- * -s <startid> the old_id to start from
- * -n <endid> the old_id to stop at
+ * -s <startid> the id to start from (referring to the text table for
+ * type gzip, and to the page table for type concat)
+ * -n <endid> the page_id to stop at (only when using concat compression type)
* --extdb <cluster> store specified revisions in an external cluster (untested)
*
* This program is free software; you can redistribute it and/or modify
@@ -40,7 +41,7 @@
* @ingroup Maintenance ExternalStorage
*/
-require_once( dirname( __FILE__ ) . '/../Maintenance.php' );
+require_once( __DIR__ . '/../Maintenance.php' );
class CompressOld extends Maintenance {
/**
@@ -56,9 +57,9 @@ class CompressOld extends Maintenance {
$this->addOption( 'chunksize', 'Maximum number of revisions in a concat chunk', false, true, 'c' );
$this->addOption( 'begin-date', 'Earliest date to check for uncompressed revisions', false, true, 'b' );
$this->addOption( 'end-date', 'Latest revision date to compress', false, true, 'e' );
- $this->addOption( 'startid', 'The old_id to start from', false, true, 's' );
+ $this->addOption( 'startid', 'The id to start from (gzip -> text table, concat -> page table)', false, true, 's' );
$this->addOption( 'extdb', 'Store specified revisions in an external cluster (untested)', false, true );
- $this->addOption( 'endid', 'Stop at this old_id', false, true, 'n' );
+ $this->addOption( 'endid', 'The page_id to stop at (only when using concat compression type)', false, true, 'n' );
}
public function execute() {
@@ -293,7 +294,7 @@ class CompressOld extends Maintenance {
$chunk = new ConcatenatedGzipHistoryBlob();
$stubs = array();
- $dbw->begin();
+ $dbw->begin( __METHOD__ );
$usedChunk = false;
$primaryOldid = $revs[$i]->rev_text_id;
@@ -393,7 +394,7 @@ class CompressOld extends Maintenance {
}
# Done, next
$this->output( "/" );
- $dbw->commit();
+ $dbw->commit( __METHOD__ );
$i += $thisChunkSize;
wfWaitForSlaves();
}
diff --git a/maintenance/storage/dumpRev.php b/maintenance/storage/dumpRev.php
index b200d8af..6020f22e 100644
--- a/maintenance/storage/dumpRev.php
+++ b/maintenance/storage/dumpRev.php
@@ -18,7 +18,7 @@
* @ingroup Maintenance ExternalStorage
*/
-require_once( dirname( __FILE__ ) . '/../Maintenance.php' );
+require_once( __DIR__ . '/../Maintenance.php' );
class DumpRev extends Maintenance {
public function __construct() {
diff --git a/maintenance/storage/fixBug20757.php b/maintenance/storage/fixBug20757.php
index cb2663d1..52ee825c 100644
--- a/maintenance/storage/fixBug20757.php
+++ b/maintenance/storage/fixBug20757.php
@@ -21,7 +21,7 @@
* @ingroup Maintenance ExternalStorage
*/
-require_once( dirname( __FILE__ ) . '/../Maintenance.php' );
+require_once( __DIR__ . '/../Maintenance.php' );
class FixBug20757 extends Maintenance {
var $batchSize = 10000;
@@ -213,7 +213,7 @@ class FixBug20757 extends Maintenance {
if ( !$dryRun ) {
// Reset the text row to point to the original copy
- $dbw->begin();
+ $dbw->begin( __METHOD__ );
$dbw->update(
'text',
// SET
@@ -241,7 +241,7 @@ class FixBug20757 extends Maintenance {
),
__METHOD__
);
- $dbw->commit();
+ $dbw->commit( __METHOD__ );
$this->waitForSlaves();
}
diff --git a/maintenance/storage/moveToExternal.php b/maintenance/storage/moveToExternal.php
index 64f3adaa..2dcc25c2 100644
--- a/maintenance/storage/moveToExternal.php
+++ b/maintenance/storage/moveToExternal.php
@@ -24,8 +24,8 @@
define( 'REPORTING_INTERVAL', 1 );
if ( !defined( 'MEDIAWIKI' ) ) {
- require_once( dirname( __FILE__ ) . '/../commandLine.inc' );
- require_once( dirname( __FILE__ ) . '/../../includes/ExternalStoreDB.php' );
+ require_once( __DIR__ . '/../commandLine.inc' );
+ require_once( __DIR__ . '/../../includes/ExternalStoreDB.php' );
require_once( 'resolveStubs.php' );
$fname = 'moveToExternal';
diff --git a/maintenance/storage/orphanStats.php b/maintenance/storage/orphanStats.php
index f30f07e4..82ee135b 100644
--- a/maintenance/storage/orphanStats.php
+++ b/maintenance/storage/orphanStats.php
@@ -20,7 +20,7 @@
*
* @ingroup Maintenance ExternalStorage
*/
-require_once( dirname( __FILE__ ) . '/../Maintenance.php' );
+require_once( __DIR__ . '/../Maintenance.php' );
class OrphanStats extends Maintenance {
public function __construct() {
@@ -28,7 +28,7 @@ class OrphanStats extends Maintenance {
$this->mDescription = "how some statistics on the blob_orphans table, created with trackBlobs.php";
}
- private function getDB( $cluster ) {
+ protected function &getDB( $cluster, $groups = array(), $wiki = false ) {
$lb = wfGetLBFactory()->getExternalLB( $cluster );
return $lb->getConnection( DB_SLAVE );
}
diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php
index c8aac64b..4098077f 100644
--- a/maintenance/storage/recompressTracked.php
+++ b/maintenance/storage/recompressTracked.php
@@ -23,7 +23,7 @@
*/
$optionsWithArgs = RecompressTracked::getOptionsWithArgs();
-require( dirname( __FILE__ ) . '/../commandLine.inc' );
+require( __DIR__ . '/../commandLine.inc' );
if ( count( $args ) < 1 ) {
echo "Usage: php recompressTracked.php [options] <cluster> [... <cluster>...]
@@ -528,7 +528,7 @@ class RecompressTracked {
exit( 1 );
}
$dbw = wfGetDB( DB_MASTER );
- $dbw->begin();
+ $dbw->begin( __METHOD__ );
$dbw->update( 'text',
array( // set
'old_text' => $url,
@@ -544,7 +544,7 @@ class RecompressTracked {
array( 'bt_text_id' => $textId ),
__METHOD__
);
- $dbw->commit();
+ $dbw->commit( __METHOD__ );
}
/**
@@ -739,7 +739,7 @@ class CgzCopyTransaction {
//
// We do a locking read to prevent closer-run race conditions.
$dbw = wfGetDB( DB_MASTER );
- $dbw->begin();
+ $dbw->begin( __METHOD__ );
$res = $dbw->select( 'blob_tracking',
array( 'bt_text_id', 'bt_moved' ),
array( 'bt_text_id' => array_keys( $this->referrers ) ),
@@ -773,7 +773,7 @@ class CgzCopyTransaction {
$store = $this->parent->store;
$targetDB = $store->getMaster( $targetCluster );
$targetDB->clearFlag( DBO_TRX ); // we manage the transactions
- $targetDB->begin();
+ $targetDB->begin( __METHOD__ );
$baseUrl = $this->parent->store->store( $targetCluster, serialize( $this->cgz ) );
// Write the new URLs to the blob_tracking table
@@ -789,10 +789,10 @@ class CgzCopyTransaction {
);
}
- $targetDB->commit();
+ $targetDB->commit( __METHOD__ );
// Critical section here: interruption at this point causes blob duplication
// Reversing the order of the commits would cause data loss instead
- $dbw->commit();
+ $dbw->commit( __METHOD__ );
// Write the new URLs to the text table and set the moved flag
if ( !$this->parent->copyOnly ) {
diff --git a/maintenance/storage/resolveStubs.php b/maintenance/storage/resolveStubs.php
index 08d0ee04..7e288e13 100644
--- a/maintenance/storage/resolveStubs.php
+++ b/maintenance/storage/resolveStubs.php
@@ -27,7 +27,7 @@ define( 'REPORTING_INTERVAL', 100 );
if ( !defined( 'MEDIAWIKI' ) ) {
$optionsWithArgs = array( 'm' );
- require_once( dirname( __FILE__ ) . '/../commandLine.inc' );
+ require_once( __DIR__ . '/../commandLine.inc' );
resolveStubs();
}
diff --git a/maintenance/storage/storageTypeStats.php b/maintenance/storage/storageTypeStats.php
index 817659fc..1afecc4e 100644
--- a/maintenance/storage/storageTypeStats.php
+++ b/maintenance/storage/storageTypeStats.php
@@ -19,7 +19,7 @@
* @ingroup Maintenance ExternalStorage
*/
-require_once( dirname( __FILE__ ) . '/../Maintenance.php' );
+require_once( __DIR__ . '/../Maintenance.php' );
class StorageTypeStats extends Maintenance {
function execute() {
diff --git a/maintenance/storage/testCompression.php b/maintenance/storage/testCompression.php
index 9ae26335..998ebe48 100644
--- a/maintenance/storage/testCompression.php
+++ b/maintenance/storage/testCompression.php
@@ -21,7 +21,7 @@
*/
$optionsWithArgs = array( 'start', 'limit', 'type' );
-require( dirname( __FILE__ ) . '/../commandLine.inc' );
+require( __DIR__ . '/../commandLine.inc' );
if ( !isset( $args[0] ) ) {
echo "Usage: php testCompression.php [--type=<type>] [--start=<start-date>] [--limit=<num-revs>] <page-title>\n";
diff --git a/maintenance/storage/trackBlobs.php b/maintenance/storage/trackBlobs.php
index b5f80047..214168a8 100644
--- a/maintenance/storage/trackBlobs.php
+++ b/maintenance/storage/trackBlobs.php
@@ -22,7 +22,7 @@
* @see wfWaitForSlaves()
*/
-require( dirname( __FILE__ ) . '/../commandLine.inc' );
+require( __DIR__ . '/../commandLine.inc' );
if ( count( $args ) < 1 ) {
@@ -113,7 +113,7 @@ class TrackBlobs {
$dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_tracking' ) );
$dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_orphans' ) );
}
- $dbw->sourceFile( dirname( __FILE__ ) . '/blob_tracking.sql' );
+ $dbw->sourceFile( __DIR__ . '/blob_tracking.sql' );
}
function getTextClause() {