3 * Implements Special:Allmessages
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup SpecialPage
23 use MediaWiki\MediaWikiServices
;
26 * Use this special page to get a list of the MediaWiki system messages.
29 * @ingroup SpecialPage
31 class SpecialAllMessages
extends SpecialPage
{
33 public function __construct() {
34 parent
::__construct( 'Allmessages' );
38 * @param string|null $par Parameter passed to the page or null
40 public function execute( $par ) {
41 $out = $this->getOutput();
45 if ( !$this->getConfig()->get( 'UseDatabaseMessages' ) ) {
46 $out->addWikiMsg( 'allmessages-not-supported-database' );
51 $out->addModuleStyles( 'mediawiki.special' );
52 $this->addHelpLink( 'Help:System message' );
54 $contLang = MediaWikiServices
::getInstance()->getContentLanguage()->getCode();
55 $lang = $this->getLanguage();
57 $opts = new FormOptions();
59 $opts->add( 'prefix', '' );
60 $opts->add( 'filter', 'all' );
61 $opts->add( 'lang', $contLang );
62 $opts->add( 'limit', 50 );
64 $opts->fetchValuesFromRequest( $this->getRequest() );
65 $opts->validateIntBounds( 'limit', 0, 5000 );
67 $pager = new AllMessagesTablePager( $this->getContext(), $opts, $this->getLinkRenderer() );
73 'label-message' => 'allmessages-prefix',
79 'label-message' => 'allmessages-filter',
80 'options-messages' => [
81 'allmessages-filter-unmodified' => 'unmodified',
82 'allmessages-filter-all' => 'all',
83 'allmessages-filter-modified' => 'modified',
92 'label-message' => 'allmessages-language',
93 'default' => $opts->getValue( 'lang' ),
97 'type' => 'limitselect',
99 'label-message' => 'table_pager_limit_label',
101 $lang->formatNum( 20 ) => 20,
102 $lang->formatNum( 50 ) => 50,
103 $lang->formatNum( 100 ) => 100,
104 $lang->formatNum( 250 ) => 250,
105 $lang->formatNum( 500 ) => 500,
106 $lang->formatNum( 5000 ) => 5000,
108 'default' => $opts->getValue( 'limit' ),
112 $htmlForm = HTMLForm
::factory( 'ooui', $formDescriptor, $this->getContext() );
115 ->setIntro( $this->msg( 'allmessagestext' ) )
116 ->setWrapperLegendMsg( 'allmessages' )
117 ->setSubmitTextMsg( 'allmessages-filter-submit' )
119 ->displayForm( false );
121 $out->addParserOutputContent( $pager->getFullOutput() );
124 protected function getGroupName() {