53 parent::checkCanExecute( $user );
55 $oldimage = $this->
getRequest()->getText(
'oldimage' );
56 if ( strlen( $oldimage ) < 16
57 || strpos( $oldimage,
'/' ) !==
false
58 || strpos( $oldimage,
'\\' ) !==
false
60 throw new ErrorPageError(
'internalerror',
'unexpected', [
'oldimage', $oldimage ] );
63 $this->oldFile = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
64 ->newFromArchiveName( $this->
getTitle(), $oldimage );
66 if ( !$this->oldFile->exists() ) {
83 $timestamp = $this->oldFile->getTimestamp();
87 $userDate =
$lang->userDate( $timestamp, $user );
88 $userTime =
$lang->userTime( $timestamp, $user );
89 $siteTs = MWTimestamp::getLocalInstance( $timestamp );
90 $ts = $siteTs->format(
'YmdHis' );
91 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
92 $siteDate = $contLang->date( $ts,
false,
false );
93 $siteTime = $contLang->time( $ts,
false,
false );
94 $tzMsg = $siteTs->getTimezoneMessage()->inContentLanguage()->text();
99 'vertical-label' =>
true,
101 'default' => $this->
msg(
'filerevert-intro',
102 $this->
getTitle()->getText(), $userDate, $userTime,
113 'label-message' =>
'filerevert-comment',
114 'default' => $this->
msg(
'filerevert-defaultcomment', $siteDate, $siteTime,
115 $tzMsg )->inContentLanguage()->text()
123 $old = $this->
getRequest()->getText(
'oldimage' );
126 '@phan-var LocalFile $localFile';
129 $source = $localFile->getArchiveVirtualUrl( $old );
130 $comment = $data[
'comment'];
133 return Status::newFatal(
'filerevert-identical' );
137 return $localFile->upload(
152 $timestamp = $this->oldFile->getTimestamp();
155 $userDate =
$lang->userDate( $timestamp, $user );
156 $userTime =
$lang->userTime( $timestamp, $user );
158 $this->
getOutput()->addWikiMsg(
'filerevert-success', $this->
getTitle()->getText(),
159 $userDate, $userTime,
171 return $this->
msg(
'filerevert', $this->
getTitle()->getText() );
175 return OutputPage::buildBacklinkSubtitle( $this->
getTitle() );
190 return $wikiPage->getFile();
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
getWikiPage()
Get a WikiPage object.
getTitle()
Shortcut to get the Title object from the page.
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User being used for this instance.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
getLanguage()
Shortcut to get the user Language being used for this instance.
getRequest()
Get the WebRequest being used for this instance.
An error page which can definitely be safely rendered using the OutputPage.
Implements some public methods and some protected utility functions which are required by multiple ch...
getSha1()
Stable to override.
Class to represent a file in the oldimage table.
static newFromArchiveName( $title, $repo, $archiveName)
Stable to override.
File reversion user interface WikiPage must contain getFile method: \WikiFilePage Article::getFile is...
usesOOUI()
Whether the form should use OOUI Stable to override.
onSubmit( $data)
Process the form on POST submission.
getFormFields()
Get an HTMLForm descriptor array Stable to override.
getPageTitle()
Returns the name that goes in the <h1> page title.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially Stable to override.
getDescription()
Returns the description that goes below the <h1> tag.
onSuccess()
Do something exciting on successful processing of the form.
doesWrites()
Stable to override.
getName()
Return the name of the action this object responds to.
getRestriction()
Get the permission required to perform this action.
checkCanExecute(User $user)
Checks if the given user (identified by an object) can perform this action.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
if(!isset( $args[0])) $lang