X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiQueryProtectedTitles.php;h=f5266850bd2a56f659f0a5cf2e7b9377ae7e7324;hp=5f6510ea281dd7627085833cf6b9245b06924c67;hb=a2c8c2969420a0f150c03f76e3a0bf9028fcda43;hpb=fa32e55a7c7c133fd841f474237c6a11a1ff0588 diff --git a/includes/api/ApiQueryProtectedTitles.php b/includes/api/ApiQueryProtectedTitles.php index 5f6510ea28..f5266850bd 100644 --- a/includes/api/ApiQueryProtectedTitles.php +++ b/includes/api/ApiQueryProtectedTitles.php @@ -1,9 +1,5 @@ .@gmail.com" * * This program is free software; you can redistribute it and/or modify @@ -55,10 +51,17 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { $prop = array_flip( $params['prop'] ); $this->addFieldsIf( 'pt_user', isset( $prop['user'] ) || isset( $prop['userid'] ) ); - $this->addFieldsIf( 'pt_reason', isset( $prop['comment'] ) || isset( $prop['parsedcomment'] ) ); $this->addFieldsIf( 'pt_expiry', isset( $prop['expiry'] ) ); $this->addFieldsIf( 'pt_create_perm', isset( $prop['level'] ) ); + if ( isset( $prop['comment'] ) || isset( $prop['parsedcomment'] ) ) { + $commentStore = CommentStore::getStore(); + $commentQuery = $commentStore->getJoin( 'pt_reason' ); + $this->addTables( $commentQuery['tables'] ); + $this->addFields( $commentQuery['fields'] ); + $this->addJoinConds( $commentQuery['joins'] ); + } + $this->addTimestampWhereRange( 'pt_timestamp', $params['dir'], $params['start'], $params['end'] ); $this->addWhereFld( 'pt_namespace', $params['namespace'] ); $this->addWhereFld( 'pt_create_perm', $params['level'] ); @@ -127,11 +130,13 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { } if ( isset( $prop['comment'] ) ) { - $vals['comment'] = $row->pt_reason; + $vals['comment'] = $commentStore->getComment( 'pt_reason', $row )->text; } if ( isset( $prop['parsedcomment'] ) ) { - $vals['parsedcomment'] = Linker::formatComment( $row->pt_reason, $title ); + $vals['parsedcomment'] = Linker::formatComment( + $commentStore->getComment( 'pt_reason', $row )->text, $titles + ); } if ( isset( $prop['expiry'] ) ) {