From cecb985bee3bdd252e1b8dc0bd500b37cd52be01 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 16 May 2007 20:58:53 +0000 Subject: Aktualisierung auf MediaWiki 1.10.0 Plugins angepasst und verbessert kleine Korrekturen am Design --- maintenance/storage/compressOld.inc | 38 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'maintenance/storage/compressOld.inc') diff --git a/maintenance/storage/compressOld.inc b/maintenance/storage/compressOld.inc index d38bb741..2da015b0 100644 --- a/maintenance/storage/compressOld.inc +++ b/maintenance/storage/compressOld.inc @@ -1,7 +1,6 @@ select( 'text', array( 'old_id','old_flags','old_namespace','old_title','old_text' ), "old_id>=$start", $fname, array( 'ORDER BY' => 'old_id', 'LIMIT' => $chunksize, 'FOR UPDATE' ) ); if( $dbw->numRows( $res ) == 0 ) { @@ -41,7 +39,7 @@ function compressPage( $row, $extdb ) { #print "Already compressed row {$row->old_id}\n"; return false; } - $dbw =& wfGetDB( DB_MASTER ); + $dbw = wfGetDB( DB_MASTER ); $flags = $row->old_flags ? "{$row->old_flags},gzip" : "gzip"; $compress = gzdeflate( $row->old_text ); @@ -77,8 +75,8 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh $fname = 'compressWithConcat'; $loadStyle = LS_CHUNKED; - $dbr =& wfGetDB( DB_SLAVE ); - $dbw =& wfGetDB( DB_MASTER ); + $dbr = wfGetDB( DB_SLAVE ); + $dbw = wfGetDB( DB_MASTER ); # Set up external storage if ( $extdb != '' ) { @@ -112,9 +110,17 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh "old_flags NOT LIKE '%object%' AND old_flags NOT LIKE '%external%'"); if ( $beginDate ) { + if ( !preg_match( '/^\d{14}$/', $beginDate ) ) { + print "Invalid begin date \"$beginDate\"\n"; + return false; + } $conds[] = "rev_timestamp>'" . $beginDate . "'"; } if ( $endDate ) { + if ( !preg_match( '/^\d{14}$/', $endDate ) ) { + print "Invalid end date \"$endDate\"\n"; + return false; + } $conds[] = "rev_timestamp<'" . $endDate . "'"; } if ( $loadStyle == LS_CHUNKED ) { @@ -133,9 +139,6 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh #$tables[] = 'page'; #$conds[] = 'page_id=rev_page AND rev_id != page_latest'; - $oldReadsSinceLastSlaveWait = 0; #check slave lag periodically - $totalMatchingRevisions = 0; - $masterPos = false; for ( $pageId = $startId; $pageId <= $maxPageId; $pageId++ ) { wfWaitForSlaves( 5 ); @@ -155,26 +158,15 @@ function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorTh $titleObj = Title::makeTitle( $pageRow->page_namespace, $pageRow->page_title ); print "$pageId\t" . $titleObj->getPrefixedDBkey() . " "; - print_r( - array( - 'rev_page' => $pageRow->page_id, - # Don't operate on the current revision - # Use < instead of <> in case the current revision has changed - # since the page select, which wasn't locking - 'rev_id < ' . $pageRow->page_latest - ) + $conds - ); - exit; - # Load revisions $revRes = $dbw->select( $tables, $fields, - array( + array_merge( array( 'rev_page' => $pageRow->page_id, # Don't operate on the current revision # Use < instead of <> in case the current revision has changed # since the page select, which wasn't locking 'rev_id < ' . $pageRow->page_latest - ) + $conds, + ), $conds ), $fname, $revLoadOptions ); -- cgit v1.2.2