Go to the documentation of this file.
49 parent::checkCanExecute(
$user );
51 $oldimage = $this->
getRequest()->getText(
'oldimage' );
52 if ( strlen( $oldimage ) < 16
53 || strpos( $oldimage,
'/' ) !==
false
54 || strpos( $oldimage,
'\\' ) !==
false
56 throw new ErrorPageError(
'internalerror',
'unexpected', [
'oldimage', $oldimage ] );
64 if ( !$this->oldFile->exists() ) {
83 $timestamp = $this->oldFile->getTimestamp();
87 $userDate =
$lang->userDate( $timestamp,
$user );
88 $userTime =
$lang->userTime( $timestamp,
$user );
90 $ts = $siteTs->format(
'YmdHis' );
93 $tzMsg = $siteTs->getTimezoneMessage()->inContentLanguage()->text();
98 'vertical-label' =>
true,
100 'default' => $this->
msg(
'filerevert-intro',
101 $this->
getTitle()->getText(), $userDate, $userTime,
103 $this->
page->getFile()->getArchiveUrl( $this->
getRequest()->getText(
'oldimage' ) ),
109 'label-message' =>
'filerevert-comment',
110 'default' => $this->
msg(
'filerevert-defaultcomment', $siteDate, $siteTime,
111 $tzMsg )->inContentLanguage()->text()
119 $old = $this->
getRequest()->getText(
'oldimage' );
120 $localFile = $this->
page->getFile();
123 $source = $localFile->getArchiveVirtualUrl( $old );
124 $comment = $data[
'comment'];
131 return $localFile->upload(
143 $timestamp = $this->oldFile->getTimestamp();
146 $userDate =
$lang->userDate( $timestamp,
$user );
147 $userTime =
$lang->userTime( $timestamp,
$user );
149 $this->
getOutput()->addWikiMsg(
'filerevert-success', $this->
getTitle()->getText(),
150 $userDate, $userTime,
158 return $this->
msg(
'filerevert', $this->
getTitle()->getText() );
getName()
Return the name of the action this object responds to.
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
static buildBacklinkSubtitle(Title $title, $query=[])
Build message object for a subtitle containing a backlink to a page.
static singleton()
Get a RepoGroup instance.
getDescription()
Returns the description that goes below the <h1> tag.
getRequest()
Get the WebRequest being used for this instance.
if(!isset( $args[0])) $lang
doesWrites()
Indicates whether this action may perform database writes.
static newFatal( $message)
Factory function for fatal errors.
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
File reversion user interface.
getFormFields()
Get an HTMLForm descriptor array.
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
onSuccess()
Do something exciting on successful processing of the form.
when a variable name is used in a it is silently declared as a new masking the global
getUser()
Shortcut to get the User being used for this instance.
checkCanExecute(User $user)
Checks if the given user (identified by an object) can perform this action.
getTitle()
Shortcut to get the Title object from the page.
getLanguage()
Shortcut to get the user Language being used for this instance.
usesOOUI()
Whether the form should use OOUI.
getOutput()
Get the OutputPage being used for this instance.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
getPageTitle()
Returns the name that goes in the <h1> page title.
An error page which can definitely be safely rendered using the OutputPage.
getRestriction()
Get the permission required to perform this action.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Class to represent a file in the oldimage table.
static getLocalInstance( $ts=false)
Get a timestamp instance in the server local timezone ($wgLocaltimezone)
static newFromArchiveName( $title, $repo, $archiveName)
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
onSubmit( $data)
Process the form on POST submission.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang