41 private $linkBatchFactory;
54 parent::__construct(
'Protectedtitles' );
55 $this->linkBatchFactory = $linkBatchFactory;
56 $this->dbProvider = $dbProvider;
65 $type = $request->getVal( $this->IdType );
66 $level = $request->getVal( $this->IdLevel );
67 $sizetype = $request->getVal(
'sizetype' );
68 $size = $request->getIntOrNull(
'size' );
69 $NS = $request->getIntOrNull(
'namespace' );
73 $this->linkBatchFactory,
83 $this->
getOutput()->addHTML( $this->showOptions() );
85 if ( $pager->getNumRows() ) {
87 $pager->getNavigationBar() .
88 '<ul>' . $pager->getBody() .
'</ul>' .
89 $pager->getNavigationBar()
92 $this->
getOutput()->addWikiMsg(
'protectedtitlesempty' );
103 $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
105 return Html::rawElement(
110 [
'class' =>
'mw-invalidtitle' ],
111 Linker::getInvalidTitleDescription(
122 $description = $this->
msg(
'restriction-level-' . $row->pt_create_perm )->escaped();
124 $expiry = strlen( $row->pt_expiry ) ?
125 $lang->formatExpiry( $row->pt_expiry, TS_MW ) :
128 if ( $expiry !==
'infinity' ) {
130 $description .= $this->
msg(
'comma-separator' )->escaped() . $this->
msg(
131 'protect-expiring-local',
132 $lang->userTimeAndDate( $expiry, $user ),
133 $lang->userDate( $expiry, $user ),
134 $lang->userTime( $expiry, $user )
138 return '<li>' .
$lang->specialList( $link, $description ) .
"</li>\n";
144 private function showOptions() {
147 'class' => HTMLSelectNamespace::class,
148 'name' =>
'namespace',
150 'cssclass' =>
'namespaceselector',
152 'label' => $this->
msg(
'namespace' )->text()
154 'levelmenu' => $this->getLevelMenu()
159 ->setWrapperLegendMsg(
'protectedtitles' )
160 ->setSubmitTextMsg(
'protectedtitles-submit' );
162 return $htmlForm->prepareForm()->getHTML(
false );
168 private function getLevelMenu() {
170 $m = [ $this->
msg(
'restriction-level-all' )->text() => 0 ];
174 foreach ( $this->
getConfig()->
get( MainConfigNames::RestrictionLevels ) as
$type ) {
177 $text = $this->
msg(
"restriction-level-$type" )->text();
183 if ( count( $m ) <= 2 ) {
187 foreach ( $m as $text =>
$type ) {
188 $options[ $text ] =
$type;
193 'options' => $options,
194 'label' => $this->
msg(
'restriction-level' )->text(),
201 return 'maintenance';
A class containing constants representing the names of configuration variables.
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing 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.
A special page that list protected titles from creation.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
formatRow( $row)
Callback function to output a restriction.
__construct(LinkBatchFactory $linkBatchFactory, IConnectionProvider $dbProvider)
execute( $par)
Default execute method Checks user permissions.
if(!isset( $args[0])) $lang