40 $fname =
'resolveStubs';
43 $maxID =
$dbr->selectField(
'text',
'MAX(old_id)',
'', $fname );
45 $numBlocks = intval( $maxID / $blockSize ) + 1;
46 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
48 for ( $b = 0; $b < $numBlocks; $b++ ) {
49 $lbFactory->waitForReplication();
51 printf(
"%5.2f%%\n", $b / $numBlocks * 100 );
52 $start = intval( $maxID / $numBlocks ) * $b + 1;
53 $end = intval( $maxID / $numBlocks ) * ( $b + 1 );
55 $res =
$dbr->select(
'text', [
'old_id',
'old_text',
'old_flags' ],
56 "old_id>=$start AND old_id<=$end " .
57 "AND old_flags LIKE '%object%' AND old_flags NOT LIKE '%external%' " .
58 'AND LOWER(CONVERT(LEFT(old_text,22) USING latin1)) = \'o:15:"historyblobstub"\'',
60 foreach (
$res as $row ) {
61 resolveStub( $row->old_id, $row->old_text, $row->old_flags );