X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fstorage%2FresolveStubs.php;h=8ca8bb291b9cb3c6a350e82cfc3ac93b4e3ee3e2;hb=c118951f57e34c3133693ea56b4f1bfc3a76f473;hp=36741cb2bc0b9c9b4da4390de038e3e40b8da0a4;hpb=b767edc892b81c3be688b9f4a4004433e9c5132c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/storage/resolveStubs.php b/maintenance/storage/resolveStubs.php index 36741cb2bc..8ca8bb291b 100644 --- a/maintenance/storage/resolveStubs.php +++ b/maintenance/storage/resolveStubs.php @@ -23,7 +23,7 @@ */ if ( !defined( 'MEDIAWIKI' ) ) { - $optionsWithArgs = array( 'm' ); + $optionsWithArgs = [ 'm' ]; require_once __DIR__ . '/../commandLine.inc'; @@ -37,7 +37,7 @@ if ( !defined( 'MEDIAWIKI' ) ) { function resolveStubs() { $fname = 'resolveStubs'; - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $maxID = $dbr->selectField( 'text', 'MAX(old_id)', false, $fname ); $blockSize = 10000; $numBlocks = intval( $maxID / $blockSize ) + 1; @@ -49,7 +49,7 @@ function resolveStubs() { $start = intval( $maxID / $numBlocks ) * $b + 1; $end = intval( $maxID / $numBlocks ) * ( $b + 1 ); - $res = $dbr->select( 'text', array( 'old_id', 'old_text', 'old_flags' ), + $res = $dbr->select( 'text', [ 'old_id', 'old_text', 'old_flags' ], "old_id>=$start AND old_id<=$end " . "AND old_flags LIKE '%object%' AND old_flags NOT LIKE '%external%' " . 'AND LOWER(CONVERT(LEFT(old_text,22) USING latin1)) = \'o:15:"historyblobstub"\'', @@ -73,7 +73,7 @@ function resolveStub( $id, $stubText, $flags ) { $stub = unserialize( $stubText ); $flags = explode( ',', $flags ); - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); $dbw = wfGetDB( DB_MASTER ); if ( strtolower( get_class( $stub ) ) !== 'historyblobstub' ) { @@ -85,11 +85,11 @@ function resolveStub( $id, $stubText, $flags ) { # Get the (maybe) external row $externalRow = $dbr->selectRow( 'text', - array( 'old_text' ), - array( + [ 'old_text' ], + [ 'old_id' => $stub->mOldId, 'old_flags' . $dbr->buildLike( $dbr->anyString(), 'external', $dbr->anyString() ) - ), + ], $fname ); @@ -108,12 +108,12 @@ function resolveStub( $id, $stubText, $flags ) { # Update the row # print "oldid=$id\n"; $dbw->update( 'text', - array( /* SET */ + [ /* SET */ 'old_flags' => $newFlags, 'old_text' => $externalRow->old_text . '/' . $stub->mHash - ), - array( /* WHERE */ + ], + [ /* WHERE */ 'old_id' => $id - ), $fname + ], $fname ); }