Update for deprecation of selectFields() methods

Various selectFields() methods were deprecated in MediaWiki core change
Idcfd1556. This change adapts the extension to use the replacement
getQueryInfo() methods when available.

Change-Id: Ia81bf6a655af800ce8ac19940d851e65746e1f77
This commit is contained in:
Brad Jorsch 2017-10-12 15:44:47 -04:00
parent 4ef71c3d88
commit 569b209ce8

View file

@ -372,20 +372,31 @@ abstract class BaseBlacklist {
// Load all the relevant tables from the correct DB.
// This assumes that old_text is the actual text or
// that the external store system is at least unified.
if ( is_callable( [ Revision::class, 'getQueryInfo' ] ) ) {
$revQuery = Revision::getQueryInfo( [ 'page', 'text' ] );
} else {
$revQuery = [
'tables' => [ 'revision', 'page', 'text' ],
'fields' => array_merge(
Revision::selectFields(),
Revision::selectPageFields(),
Revision::selectTextFields()
),
'joins' => [
'text' => [ 'JOIN', 'old_id=rev_text_id' ]
],
];
}
$row = wfGetDB( DB_REPLICA, [], $wiki )->selectRow(
[ 'page', 'revision', 'text' ],
array_merge(
Revision::selectFields(),
Revision::selectPageFields(),
Revision::selectTextFields()
),
$revQuery['tables'],
$revQuery['fields'],
[
'page_namespace' => $title->getNamespace(), // assume NS IDs match
'page_title' => $title->getDBkey(), // assume same case rules
'rev_id=page_latest',
'old_id=rev_text_id'
],
__METHOD__
__METHOD__,
[],
[ 'page' => [ 'JOIN', 'rev_id=page_latest' ] ] + $revQuery['joins']
);
return $row