Use string cast for Postgres compatibility

We JOIN integer and text, so Postgres would always fail on these. As
mentioned in the task description, this is only a temporary solution
(although a clean and durable one), while the long-term one is
I7460a2d63f60c2933b36f8383a8abdbba8649e12.

Bug: T42757
Change-Id: Ifddd0bca1e8eaa7c70511fb0d0588457b4fd0669
This commit is contained in:
Daimona Eaytoy 2018-10-20 15:55:23 +02:00
parent 7a6468fa29
commit 4ab12305f1
3 changed files with 6 additions and 5 deletions

View file

@ -97,11 +97,12 @@ class ApiQueryAbuseLog extends ApiQueryBase {
$this->addFieldsIf( 'afl_actions', $fld_result );
$this->addFieldsIf( 'afl_wiki', $fld_wiki );
$db = $this->getDB();
if ( $fld_filter ) {
$this->addTables( 'abuse_filter' );
$this->addFields( 'af_public_comments' );
$this->addJoinConds( [ 'abuse_filter' => [ 'LEFT JOIN',
'af_id=afl_filter' ] ] );
$db->buildStringCast( 'af_id' ) . '=afl_filter' ] ] );
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );

View file

@ -45,7 +45,7 @@ class AbuseLogPager extends ReverseChronologicalPager {
[ 'abuse_filter' =>
[
'LEFT JOIN',
'af_id=afl_filter',
$this->mDb->buildStringCast( 'af_id' ) . '=afl_filter',
],
],
];

View file

@ -282,7 +282,7 @@ class SpecialAbuseLog extends SpecialPage {
[ 'afl_id' => $id ],
__METHOD__,
[],
[ 'abuse_filter' => [ 'LEFT JOIN', 'af_id=afl_filter' ] ]
[ 'abuse_filter' => [ 'LEFT JOIN', $dbr->buildStringCast( 'af_id' ) . '=afl_filter' ] ]
);
if ( !$row ) {
@ -511,7 +511,7 @@ class SpecialAbuseLog extends SpecialPage {
[ 'afl_id' => $id ],
__METHOD__,
[],
[ 'abuse_filter' => [ 'LEFT JOIN', 'af_id=afl_filter' ] ]
[ 'abuse_filter' => [ 'LEFT JOIN', $dbr->buildStringCast( 'af_id' ) . '=afl_filter' ] ]
);
if ( !$row ) {
@ -649,7 +649,7 @@ class SpecialAbuseLog extends SpecialPage {
[ 'afl_id' => $id ],
__METHOD__,
[],
[ 'abuse_filter' => [ 'LEFT JOIN', 'af_id=afl_filter' ] ]
[ 'abuse_filter' => [ 'LEFT JOIN', $dbr->buildStringCast( 'af_id' ) . '=afl_filter' ] ]
);
if ( !$row ) {