MediaWiki  1.33.0
SpecialAllMessages.php
Go to the documentation of this file.
1 <?php
24 
32 
33  public function __construct() {
34  parent::__construct( 'Allmessages' );
35  }
36 
40  public function execute( $par ) {
41  $out = $this->getOutput();
42 
43  $this->setHeaders();
44 
45  if ( !$this->getConfig()->get( 'UseDatabaseMessages' ) ) {
46  $out->addWikiMsg( 'allmessagesnotsupportedDB' );
47 
48  return;
49  }
50 
51  $out->addModuleStyles( 'mediawiki.special' );
52  $this->addHelpLink( 'Help:System message' );
53 
54  $contLang = MediaWikiServices::getInstance()->getContentLanguage()->getCode();
55  $lang = $this->getLanguage();
56 
57  $opts = new FormOptions();
58 
59  $opts->add( 'prefix', '' );
60  $opts->add( 'filter', 'all' );
61  $opts->add( 'lang', $contLang );
62  $opts->add( 'limit', 50 );
63 
64  $opts->fetchValuesFromRequest( $this->getRequest() );
65  $opts->validateIntBounds( 'limit', 0, 5000 );
66 
67  $pager = new AllMessagesTablePager( $this->getContext(), $opts );
68 
69  $formDescriptor = [
70  'prefix' => [
71  'type' => 'text',
72  'name' => 'prefix',
73  'label-message' => 'allmessages-prefix',
74  ],
75 
76  'filter' => [
77  'type' => 'radio',
78  'name' => 'filter',
79  'label-message' => 'allmessages-filter',
80  'options-messages' => [
81  'allmessages-filter-unmodified' => 'unmodified',
82  'allmessages-filter-all' => 'all',
83  'allmessages-filter-modified' => 'modified',
84  ],
85  'default' => 'all',
86  'flatlist' => true,
87  ],
88 
89  'lang' => [
90  'type' => 'language',
91  'name' => 'lang',
92  'label-message' => 'allmessages-language',
93  'default' => $opts->getValue( 'lang' ),
94  ],
95 
96  'limit' => [
97  'type' => 'limitselect',
98  'name' => 'limit',
99  'label-message' => 'table_pager_limit_label',
100  'options' => [
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,
107  ],
108  'default' => $opts->getValue( 'limit' ),
109  ],
110  ];
111 
112  $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
113  $htmlForm
114  ->setMethod( 'get' )
115  ->setIntro( $this->msg( 'allmessagestext' ) )
116  ->setWrapperLegendMsg( 'allmessages' )
117  ->setSubmitTextMsg( 'allmessages-filter-submit' )
118  ->prepareForm()
119  ->displayForm( false );
120 
121  $out->addParserOutputContent( $pager->getFullOutput() );
122  }
123 
124  protected function getGroupName() {
125  return 'wiki';
126  }
127 }
AllMessagesTablePager
Use TablePager for prettified output.
Definition: AllMessagesTablePager.php:31
SpecialPage\msg
msg( $key)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:796
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:725
$lang
if(!isset( $args[0])) $lang
Definition: testCompression.php:33
$out
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:780
SpecialAllMessages\__construct
__construct()
Definition: SpecialAllMessages.php:33
$formDescriptor
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead & $formDescriptor
Definition: hooks.txt:2064
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:755
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
SpecialPage\addHelpLink
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
Definition: SpecialPage.php:832
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:764
HTMLForm\factory
static factory( $displayFormat)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:286
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:531
SpecialAllMessages
Definition: SpecialAllMessages.php:31
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:698
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:36
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:715
FormOptions
Helper class to keep track of options when mixing links and form elements.
Definition: FormOptions.php:35
MediaWikiServices
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
SpecialAllMessages\execute
execute( $par)
Definition: SpecialAllMessages.php:40
SpecialAllMessages\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialAllMessages.php:124