}
function execute() {
- $dbr = wfGetDB( DB_SLAVE );
- $dbw = wfGetDB( DB_MASTER );
+ $dbr = $this->getDB( DB_SLAVE );
+ $dbw = $this->getDB( DB_MASTER );
$dryRun = $this->getOption( 'dry-run' );
if ( $dryRun ) {
if ( !$dryRun ) {
// Reset the text row to point to the original copy
- $dbw->begin( __METHOD__ );
+ $this->beginTransaction( $dbw, __METHOD__ );
$dbw->update(
'text',
// SET
),
__METHOD__
);
- $dbw->commit( __METHOD__ );
+ $this->commitTransaction( $dbw, __METHOD__ );
$this->waitForSlaves();
}
unset( $this->mapCache[$key] );
}
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = $this->getDB( DB_SLAVE );
$map = array();
$res = $dbr->select( 'revision',
array( 'rev_id', 'rev_text_id' ),
$this->mapCache[$pageId] = $map;
$this->mapCacheSize += count( $map );
}
+
return $this->mapCache[$pageId];
}
/**
* This is based on part of HistoryBlobStub::getText().
* Determine if the text can be retrieved from the row in the normal way.
- * @param $stub
- * @param $secondaryRow
+ * @param array $stub
+ * @param stdClass $secondaryRow
* @return bool
*/
function isUnbrokenStub( $stub, $secondaryRow ) {
$text = $secondaryRow->old_text;
if ( in_array( 'external', $flags ) ) {
$url = $text;
- @list( /* $proto */ , $path ) = explode( '://', $url, 2 );
+ MediaWiki\suppressWarnings();
+ list( /* $proto */, $path ) = explode( '://', $url, 2 );
+ MediaWiki\restoreWarnings();
+
if ( $path == "" ) {
return false;
}
$obj->uncompress();
$text = $obj->getItem( $stub['hash'] );
+
return $text !== false;
}
}