MediaWiki REL1_37
SpecialAllMessages.php
Go to the documentation of this file.
1<?php
25
33
36
39
44 public function __construct(
47 ) {
48 parent::__construct( 'Allmessages' );
49 $this->localisationCache = $localisationCache;
50 $this->loadBalancer = $loadBalancer;
51 }
52
56 public function execute( $par ) {
57 $out = $this->getOutput();
58
59 $this->setHeaders();
60
61 if ( !$this->getConfig()->get( 'UseDatabaseMessages' ) ) {
62 $out->addWikiMsg( 'allmessages-not-supported-database' );
63
64 return;
65 }
66
67 $out->addModuleStyles( 'mediawiki.special' );
68 $this->addHelpLink( 'Help:System message' );
69
70 $contLangCode = $this->getContentLanguage()->getCode();
71 $lang = $this->getLanguage();
72
73 $opts = new FormOptions();
74
75 $opts->add( 'prefix', '' );
76 $opts->add( 'filter', 'all' );
77 $opts->add( 'lang', $contLangCode );
78 $opts->add( 'limit', 50 );
79
80 $opts->fetchValuesFromRequest( $this->getRequest() );
81 $opts->validateIntBounds( 'limit', 0, 5000 );
82
83 $pager = new AllMessagesTablePager(
84 $this->getContext(),
85 $opts,
86 $this->getLinkRenderer(),
87 $this->getContentLanguage(),
88 $this->localisationCache,
89 $this->loadBalancer
90 );
91
92 $formDescriptor = [
93 'prefix' => [
94 'type' => 'text',
95 'name' => 'prefix',
96 'label-message' => 'allmessages-prefix',
97 ],
98
99 'filter' => [
100 'type' => 'radio',
101 'name' => 'filter',
102 'label-message' => 'allmessages-filter',
103 'options-messages' => [
104 'allmessages-filter-unmodified' => 'unmodified',
105 'allmessages-filter-all' => 'all',
106 'allmessages-filter-modified' => 'modified',
107 ],
108 'default' => 'all',
109 'flatlist' => true,
110 ],
111
112 'lang' => [
113 'type' => 'language',
114 'name' => 'lang',
115 'label-message' => 'allmessages-language',
116 'default' => $opts->getValue( 'lang' ),
117 ],
118
119 'limit' => [
120 'type' => 'limitselect',
121 'name' => 'limit',
122 'label-message' => 'table_pager_limit_label',
123 'options' => [
124 $lang->formatNum( 20 ) => 20,
125 $lang->formatNum( 50 ) => 50,
126 $lang->formatNum( 100 ) => 100,
127 $lang->formatNum( 250 ) => 250,
128 $lang->formatNum( 500 ) => 500,
129 $lang->formatNum( 5000 ) => 5000,
130 ],
131 'default' => $opts->getValue( 'limit' ),
132 ],
133 ];
134
135 $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
136 $htmlForm
137 ->setMethod( 'get' )
138 ->setIntro( $this->msg( 'allmessagestext' ) )
139 ->setWrapperLegendMsg( 'allmessages' )
140 ->setSubmitTextMsg( 'allmessages-filter-submit' )
141 ->prepareForm()
142 ->displayForm( false );
143
144 $out->addParserOutputContent( $pager->getFullOutput() );
145 }
146
147 protected function getGroupName() {
148 return 'wiki';
149 }
150}
Use TablePager for prettified output.
Helper class to keep track of options when mixing links and form elements.
Class for caching the contents of localisation files, Messages*.php and *.i18n.php.
LocalisationCache $localisationCache
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
ILoadBalancer $loadBalancer
__construct(LocalisationCache $localisationCache, ILoadBalancer $loadBalancer)
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getContentLanguage()
Shortcut to get content language.
Database cluster connection, tracking, load balancing, and transaction manager interface.
if(!isset( $args[0])) $lang