MediaWiki  master
ProtectAction.php
Go to the documentation of this file.
1 <?php
22 
31 
32  public function getName() {
33  return 'protect';
34  }
35 
36  public function onView() {
37  return null;
38  }
39 
40  public function show() {
41  if ( $this->getContext()->getConfig()->get( MainConfigNames::UseMediaWikiUIEverywhere ) ) {
42  $out = $this->getOutput();
43  $out->addModuleStyles( [
44  'mediawiki.ui.input',
45  'mediawiki.ui.checkbox',
46  ] );
47  }
48 
49  $this->getArticle()->protect();
50  }
51 
52  public function doesWrites() {
53  return true;
54  }
55 }
getContext()
Get the IContextSource in use here.
Definition: Action.php:135
getOutput()
Get the OutputPage being used for this instance.
Definition: Action.php:159
getArticle()
Get a Article object.
Definition: Action.php:209
An action which just does something, without showing a form first.
A class containing constants representing the names of configuration variables.
Handle page protection (action=protect)
doesWrites()
Indicates whether this action may perform database writes.
getName()
Return the name of the action this object responds to.
onView()
Show something on GET request.