X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fblock%2FCompositeBlock.php;h=45a630149ce2dc81b00388ae6c2b4c78948556ef;hb=3e39ec72a693cacc6bb92364fcf610de0e8c5a25;hp=e0f69dda8ad3e4dfb50bed9c798a96b781870cc4;hpb=d81dfffc5035a2f7d8ecaa2d7be5f0b2f1b5d8b9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/block/CompositeBlock.php b/includes/block/CompositeBlock.php index e0f69dda8a..45a630149c 100644 --- a/includes/block/CompositeBlock.php +++ b/includes/block/CompositeBlock.php @@ -120,12 +120,40 @@ class CompositeBlock extends AbstractBlock { return $maxExpiry; } + /** + * Get the IDs for the original blocks, ignoring any that are null + * + * @return int[] + */ + protected function getIds() { + $ids = []; + foreach ( $this->originalBlocks as $block ) { + $id = $block->getId(); + if ( $id !== null ) { + $ids[] = $id; + } + } + return $ids; + } + /** * @inheritDoc */ public function getPermissionsError( IContextSource $context ) { $params = $this->getBlockErrorParams( $context ); + $ids = implode( ', ', array_map( function ( $id ) { + return '#' . $id; + }, $this->getIds() ) ); + if ( $ids === '' ) { + $idsMsg = $context->msg( 'blockedtext-composite-no-ids' )->plain(); + } else { + $idsMsg = $context->msg( 'blockedtext-composite-ids', [ $ids ] )->plain(); + } + + // TODO: Clean up error messages params so we don't have to do this (T227174) + $params[ 4 ] = $idsMsg; + $msg = 'blockedtext-composite'; array_unshift( $params, $msg );