X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiQueryBlocks.php;h=d02fefa76f770a00015f41b0310fd608cfc1fb19;hp=004086059c33138fc6e7acd329a8941a0d91f67d;hb=11ee7f78da9776db26098642a151a288f98bea14;hpb=6572d05b6a01591dbaa92497cc4ef12a5e9f274d diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index 004086059c..d02fefa76f 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -1,9 +1,5 @@ .@gmail.com" * * This program is free software; you can redistribute it and/or modify @@ -37,6 +33,7 @@ class ApiQueryBlocks extends ApiQueryBase { public function execute() { $db = $this->getDB(); + $commentStore = new CommentStore( 'ipb_reason' ); $params = $this->extractRequestParams(); $this->requireMaxOneParameter( $params, 'users', 'ip' ); @@ -61,12 +58,18 @@ class ApiQueryBlocks extends ApiQueryBase { $this->addFieldsIf( 'ipb_by_text', $fld_by ); $this->addFieldsIf( 'ipb_by', $fld_byid ); $this->addFieldsIf( 'ipb_expiry', $fld_expiry ); - $this->addFieldsIf( 'ipb_reason', $fld_reason ); $this->addFieldsIf( [ 'ipb_range_start', 'ipb_range_end' ], $fld_range ); $this->addFieldsIf( [ 'ipb_anon_only', 'ipb_create_account', 'ipb_enable_autoblock', 'ipb_block_email', 'ipb_deleted', 'ipb_allow_usertalk' ], $fld_flags ); + if ( $fld_reason ) { + $commentQuery = $commentStore->getJoin(); + $this->addTables( $commentQuery['tables'] ); + $this->addFields( $commentQuery['fields'] ); + $this->addJoinConds( $commentQuery['joins'] ); + } + $this->addOption( 'LIMIT', $params['limit'] + 1 ); $this->addTimestampWhereRange( 'ipb_timestamp', @@ -205,7 +208,7 @@ class ApiQueryBlocks extends ApiQueryBase { $block['expiry'] = ApiResult::formatExpiry( $row->ipb_expiry ); } if ( $fld_reason ) { - $block['reason'] = $row->ipb_reason; + $block['reason'] = $commentStore->getComment( $row )->text; } if ( $fld_range && !$row->ipb_auto ) { $block['rangestart'] = IP::formatHex( $row->ipb_range_start ); @@ -335,6 +338,6 @@ class ApiQueryBlocks extends ApiQueryBase { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Blocks'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Blocks'; } }