MediaWiki  1.23.12
MarkpatrolledAction.php
Go to the documentation of this file.
1 <?php
31 
32  public function getName() {
33  return 'markpatrolled';
34  }
35 
36  protected function getDescription() {
37  return '';
38  }
39 
40  public function onView() {
41  $request = $this->getRequest();
42 
43  $rcId = $request->getInt( 'rcid' );
44  $rc = RecentChange::newFromId( $rcId );
45  if ( is_null( $rc ) ) {
46  throw new ErrorPageError( 'markedaspatrollederror', 'markedaspatrollederrortext' );
47  }
48 
49  $user = $this->getUser();
50  if ( !$user->matchEditToken( $request->getVal( 'token' ), $rcId ) ) {
51  throw new ErrorPageError( 'sessionfailure-title', 'sessionfailure' );
52  }
53 
54  $errors = $rc->doMarkPatrolled( $user );
55 
56  if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) {
57  throw new ErrorPageError( 'rcpatroldisabled', 'rcpatroldisabledtext' );
58  }
59 
60  if ( in_array( array( 'hookaborted' ), $errors ) ) {
61  // The hook itself has handled any output
62  return;
63  }
64 
65  # It would be nice to see where the user had actually come from, but for now just guess
66  $returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges';
67  $return = SpecialPage::getTitleFor( $returnto );
68 
69  if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) {
70  $this->getOutput()->setPageTitle( $this->msg( 'markedaspatrollederror' ) );
71  $this->getOutput()->addWikiMsg( 'markedaspatrollederror-noautopatrol' );
72  $this->getOutput()->returnToMain( null, $return );
73 
74  return;
75  }
76 
77  if ( count( $errors ) ) {
78  throw new PermissionsError( 'patrol', $errors );
79  }
80 
81  # Inform the user
82  $this->getOutput()->setPageTitle( $this->msg( 'markedaspatrolled' ) );
83  $this->getOutput()->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() );
84  $this->getOutput()->returnToMain( null, $return );
85  }
86 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
FormlessAction
An action which just does something, without showing a form first.
Definition: FormlessAction.php:29
Action\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: Action.php:182
MarkpatrolledAction\getDescription
getDescription()
Returns the description that goes below the <h1> tag.
Definition: MarkpatrolledAction.php:36
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:74
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:28
MarkpatrolledAction\getName
getName()
Return the name of the action this object responds to.
Definition: MarkpatrolledAction.php:32
MarkpatrolledAction\onView
onView()
Show something on GET request.
Definition: MarkpatrolledAction.php:40
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
RecentChange\newFromId
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
Definition: RecentChange.php:124
Action\getUser
getUser()
Shortcut to get the User being used for this instance.
Definition: Action.php:200
RC_NEW
const RC_NEW
Definition: Defines.php:179
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
Action\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: Action.php:247
Action\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: Action.php:191
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:27
MarkpatrolledAction
Mark a revision as patrolled on a page.
Definition: MarkpatrolledAction.php:30