summaryrefslogtreecommitdiff
path: root/maintenance/populateLogSearch.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
committerPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
commitd9022f63880ce039446fba8364f68e656b7bf4cb (patch)
tree16b40fbf17bf7c9ee6f4ead25b16dd192378050a /maintenance/populateLogSearch.php
parent27cf83d177256813e2e802241085fce5dd0f3fb9 (diff)
Update to MediaWiki 1.19.0
Diffstat (limited to 'maintenance/populateLogSearch.php')
-rw-r--r--maintenance/populateLogSearch.php42
1 files changed, 19 insertions, 23 deletions
diff --git a/maintenance/populateLogSearch.php b/maintenance/populateLogSearch.php
index f13873cb..e3f6067f 100644
--- a/maintenance/populateLogSearch.php
+++ b/maintenance/populateLogSearch.php
@@ -23,21 +23,28 @@
require_once( dirname( __FILE__ ) . '/Maintenance.php' );
-class PopulateLogSearch extends Maintenance {
-
- const LOG_SEARCH_BATCH_SIZE = 100;
-
+class PopulateLogSearch extends LoggedUpdateMaintenance {
static $tableMap = array( 'rev' => 'revision', 'fa' => 'filearchive', 'oi' => 'oldimage', 'ar' => 'archive' );
public function __construct() {
parent::__construct();
$this->mDescription = "Migrate log params to new table and index for searching";
+ $this->setBatchSize( 100 );
+ }
+
+ protected function getUpdateKey() {
+ return 'populate log_search';
+ }
+
+ protected function updateSkippedMessage() {
+ return 'log_search table already populated.';
}
- public function execute() {
+ protected function doDBUpdates() {
$db = $this->getDB( DB_MASTER );
if ( !$db->tableExists( 'log_search' ) ) {
- $this->error( "log_search does not exist", true );
+ $this->error( "log_search does not exist" );
+ return false;
}
$start = $db->selectField( 'logging', 'MIN(log_id)', false, __FUNCTION__ );
if ( !$start ) {
@@ -47,9 +54,9 @@ class PopulateLogSearch extends Maintenance {
$end = $db->selectField( 'logging', 'MAX(log_id)', false, __FUNCTION__ );
# Do remaining chunk
- $end += self::LOG_SEARCH_BATCH_SIZE - 1;
+ $end += $this->mBatchSize - 1;
$blockStart = $start;
- $blockEnd = $start + self::LOG_SEARCH_BATCH_SIZE - 1;
+ $blockEnd = $start + $this->mBatchSize - 1;
$delTypes = array( 'delete', 'suppress' ); // revisiondelete types
while ( $blockEnd <= $end ) {
@@ -128,23 +135,12 @@ class PopulateLogSearch extends Maintenance {
$log->addRelations( 'target_author_ip', $userIPs, $row->log_id );
}
}
- $blockStart += self::LOG_SEARCH_BATCH_SIZE;
- $blockEnd += self::LOG_SEARCH_BATCH_SIZE;
+ $blockStart += $this->mBatchSize;
+ $blockEnd += $this->mBatchSize;
wfWaitForSlaves();
}
- if ( $db->insert(
- 'updatelog',
- array( 'ul_key' => 'populate log_search' ),
- __FUNCTION__,
- 'IGNORE'
- )
- ) {
- $this->output( "log_search population complete.\n" );
- return true;
- } else {
- $this->output( "Could not insert log_search population row.\n" );
- return false;
- }
+ $this->output( "Done populating log_search table.\n" );
+ return true;
}
}