38 private $linkBatchFactory;
41 private $loadBalancer;
51 parent::__construct(
'Protectedtitles' );
52 $this->linkBatchFactory = $linkBatchFactory;
53 $this->loadBalancer = $loadBalancer;
62 $type = $request->getVal( $this->IdType );
63 $level = $request->getVal( $this->IdLevel );
64 $sizetype = $request->getVal(
'sizetype' );
65 $size = $request->getIntOrNull(
'size' );
66 $NS = $request->getIntOrNull(
'namespace' );
70 $this->linkBatchFactory,
80 $this->
getOutput()->addHTML( $this->showOptions( $NS,
$type, $level ) );
82 if ( $pager->getNumRows() ) {
84 $pager->getNavigationBar() .
85 '<ul>' . $pager->getBody() .
'</ul>' .
86 $pager->getNavigationBar()
89 $this->
getOutput()->addWikiMsg(
'protectedtitlesempty' );
100 $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
102 return Html::rawElement(
107 [
'class' =>
'mw-invalidtitle' ],
119 $description = $this->
msg(
'restriction-level-' . $row->pt_create_perm )->escaped();
121 $expiry = strlen( $row->pt_expiry ) ?
122 $lang->formatExpiry( $row->pt_expiry, TS_MW ) :
125 if ( $expiry !==
'infinity' ) {
127 $description .= $this->
msg(
'comma-separator' )->escaped() . $this->
msg(
128 'protect-expiring-local',
129 $lang->userTimeAndDate( $expiry, $user ),
130 $lang->userDate( $expiry, $user ),
131 $lang->userTime( $expiry, $user )
135 return '<li>' .
$lang->specialList( $link, $description ) .
"</li>\n";
145 private function showOptions( $namespace,
$type, $level ) {
148 'class' => HTMLSelectNamespace::class,
149 'name' =>
'namespace',
151 'cssclass' =>
'namespaceselector',
153 'label' => $this->
msg(
'namespace' )->text()
155 'levelmenu' => $this->getLevelMenu( $level )
158 $htmlForm = HTMLForm::factory(
'ooui', $formDescriptor, $this->
getContext() )
160 ->setWrapperLegendMsg(
'protectedtitles' )
161 ->setSubmitTextMsg(
'protectedtitles-submit' );
163 return $htmlForm->prepareForm()->getHTML(
false );
171 private function getLevelMenu( $pr_level ) {
173 $m = [ $this->
msg(
'restriction-level-all' )->text() => 0 ];
177 foreach ( $this->
getConfig()->
get( MainConfigNames::RestrictionLevels ) as
$type ) {
180 $text = $this->
msg(
"restriction-level-$type" )->text();
186 if ( count( $m ) <= 2 ) {
190 foreach ( $m as $text =>
$type ) {
191 $options[ $text ] =
$type;
196 'options' => $options,
197 'label' => $this->
msg(
'restriction-level' )->text(),
204 return 'maintenance';
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
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.
__construct(LinkBatchFactory $linkBatchFactory, ILoadBalancer $loadBalancer)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
formatRow( $row)
Callback function to output a restriction.
execute( $par)
Default execute method Checks user permissions.
if(!isset( $args[0])) $lang