<?php
/**
- * @addtogroup Maintenance
+ * @file
+ * @ingroup Maintenance ExternalStorage
*/
-/** */
-require_once( 'Revision.php' );
-require_once( 'ExternalStoreDB.php' );
-
/** @todo document */
function compressOldPages( $start = 0, $extdb = '' ) {
$fname = 'compressOldPages';
print "Starting from old_id $start...\n";
$dbw = wfGetDB( DB_MASTER );
do {
- $res = $dbw->select( 'text', array( 'old_id','old_flags','old_namespace','old_title','old_text' ),
+ $res = $dbw->select( 'text', array( 'old_id','old_flags','old_text' ),
"old_id>=$start", $fname, array( 'ORDER BY' => 'old_id', 'LIMIT' => $chunksize, 'FOR UPDATE' ) );
if( $dbw->numRows( $res ) == 0 ) {
break;
}
$last = $start;
- while( $row = $dbw->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
# print " {$row->old_id} - {$row->old_namespace}:{$row->old_title}\n";
compressPage( $row, $extdb );
$last = $row->old_id;
}
- $dbw->freeResult( $res );
$start = $last + 1; # Deletion may leave long empty stretches
print "$start...\n";
} while( true );
'old_text' => $compress
), array( /* WHERE */
'old_id' => $row->old_id
- ), $fname, 'LIMIT 1'
+ ), $fname,
+ array( 'LIMIT' => 1 )
);
return true;
}
define( 'LS_CHUNKED', 1 );
/** @todo document */
-function compressWithConcat( $startId, $maxChunkSize, $maxChunkFactor, $factorThreshold, $beginDate,
+function compressWithConcat( $startId, $maxChunkSize, $beginDate,
$endDate, $extdb="", $maxPageId = false )
{
$fname = 'compressWithConcat';
# overwriting bulk storage concat rows. Don't compress external references, because
# the script doesn't yet delete rows from external storage.
$conds = array(
- "old_flags NOT LIKE '%object%' AND old_flags NOT LIKE '%external%'");
+ 'old_flags NOT ' . $dbr->buildLike( $dbr->anyString(), 'object', $dbr->anyString() ) . ' AND old_flags NOT '
+ . $dbr->buildLike( $dbr->anyString(), 'external', $dbr->anyString() ) );
if ( $beginDate ) {
if ( !preg_match( '/^\d{14}$/', $beginDate ) ) {
$revLoadOptions
);
$revs = array();
- while ( $revRow = $dbw->fetchObject( $revRes ) ) {
+ foreach ( $revRes as $revRow ) {
$revs[] = $revRow;
}
$primaryOldid = $revs[$i]->rev_text_id;
# Get the text of each revision and add it to the object
- for ( $j = 0; $j < $thisChunkSize && $chunk->isHappy( $maxChunkFactor, $factorThreshold ); $j++ ) {
+ for ( $j = 0; $j < $thisChunkSize && $chunk->isHappy(); $j++ ) {
$oldid = $revs[$i + $j]->rev_text_id;
# Get text
$stub = false;
print 'x';
} else {
- $stub = $chunk->addItem( $text );
+ $stub = new HistoryBlobStub( $chunk->addItem( $text ) );
$stub->setLocation( $primaryOldid );
$stub->setReferrer( $oldid );
print '.';
}
return true;
}
-?>