Migrate to IReadableDatabase::newSelectQueryBuilder

Bug: T312425
Change-Id: I94a69b7c8500a840279528b3cafc452d1b0129f4
This commit is contained in:
Umherirrender 2024-04-26 21:44:06 +02:00
parent 2098f23506
commit eccd91d14e
2 changed files with 28 additions and 15 deletions

View file

@ -74,12 +74,12 @@ class Hooks implements UserGetAllRightsHook {
$dbrCentralDB = $connectionProvider->getReplicaDatabase( $wgInterwikiCentralDB ?? false );
$res = $dbrCentralDB->selectRow(
'interwiki',
'*',
[ 'iw_prefix' => $prefix ],
__METHOD__
);
$res = $dbrCentralDB->newSelectQueryBuilder()
->select( '*' )
->from( 'interwiki' )
->where( [ 'iw_prefix' => $prefix ] )
->caller( __METHOD__ )
->fetchRow();
if ( !$res ) {
return true;
}
@ -91,12 +91,12 @@ class Hooks implements UserGetAllRightsHook {
// Global interlanguage link? Whoo!
$dbrCentralLangDB = $connectionProvider->getReplicaDatabase( $wgInterwikiCentralInterlanguageDB ?? false );
$res = $dbrCentralLangDB->selectRow(
'interwiki',
'*',
[ 'iw_prefix' => $prefix ],
__METHOD__
);
$res = $dbrCentralLangDB->newSelectQueryBuilder()
->select( '*' )
->from( 'interwiki' )
->where( [ 'iw_prefix' => $prefix ] )
->caller( __METHOD__ )
->fetchRow();
if ( !$res ) {
return false;
}

View file

@ -189,7 +189,12 @@ class SpecialInterwiki extends SpecialPage {
if ( $action === 'edit' ) {
$dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
$row = $dbr->selectRow( 'interwiki', '*', [ 'iw_prefix' => $prefix ], __METHOD__ );
$row = $dbr->newSelectQueryBuilder()
->select( '*' )
->from( 'interwiki' )
->where( [ 'iw_prefix' => $prefix ] )
->caller( __METHOD__ )
->fetchRow();
$formDescriptor['prefix']['disabled'] = true;
$formDescriptor['prefix']['default'] = $prefix;
@ -379,7 +384,11 @@ class SpecialInterwiki extends SpecialPage {
// Fetch list from global table
$dbrCentralDB = $connectionProvider->getReplicaDatabase( $interwikiCentralDB );
$res = $dbrCentralDB->select( 'interwiki', '*', [], __METHOD__ );
$res = $dbrCentralDB->newSelectQueryBuilder()
->select( '*' )
->from( 'interwiki' )
->caller( __METHOD__ )
->fetchResultSet();
$retval = [];
foreach ( $res as $row ) {
$row = (array)$row;
@ -400,7 +409,11 @@ class SpecialInterwiki extends SpecialPage {
// Fetch list from global table
$dbrCentralLangDB = $connectionProvider->getReplicaDatabase( $interwikiCentralInterlanguageDB );
$res = $dbrCentralLangDB->select( 'interwiki', '*', [], __METHOD__ );
$res = $dbrCentralLangDB->newSelectQueryBuilder()
->select( '*' )
->from( 'interwiki' )
->caller( __METHOD__ )
->fetchResultSet();
$retval2 = [];
foreach ( $res as $row ) {
$row = (array)$row;