Go to the documentation of this file.
34 $block = $user->getBlock();
35 if ( $block && $block->isSitewide() ) {
40 if ( !$titleObj || $titleObj->isExternal() ) {
49 if ( !is_null( $params[
'tags'] ) ) {
51 if ( !$ableToTag->isOK() ) {
57 if ( !isset( $params[
'timestamps'] ) ) {
58 $params[
'timestamps'] = [];
60 if ( !is_array( $params[
'timestamps'] ) ) {
61 $params[
'timestamps'] = [ $params[
'timestamps'] ];
63 foreach ( $params[
'timestamps'] as $i => $ts ) {
64 $params[
'timestamps'][$i] =
wfTimestamp( TS_MW, $ts );
68 $retval = $pa->undelete(
69 ( $params[
'timestamps'] ?? [] ),
76 if ( !is_array( $retval ) ) {
82 [ $titleObj, $params[
'fileids'], $this->
getUser(), $params[
'reason'] ] );
85 $this->
setWatch( $params[
'watchlist'], $titleObj );
88 'title' => $titleObj->getPrefixedText(),
89 'revisions' => (int)$retval[0],
90 'fileversions' => (
int)$retval[1],
91 'reason' => $retval[2]
141 'action=undelete&title=Main%20Page&token=123ABC&reason=Restoring%20main%20page'
142 =>
'apihelp-undelete-example-page',
143 'action=undelete&title=Main%20Page&token=123ABC' .
144 '×tamps=2007-07-03T22:00:45Z|2007-07-02T19:48:56Z'
145 =>
'apihelp-undelete-example-revisions',
150 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Undelete';
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
const PARAM_REQUIRED
(boolean) Is the parameter required?
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Used to show archived pages and eventually restore them.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getExamplesMessages()
Returns usage examples for this module.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
dieBlocked(AbstractBlock $block)
Throw an ApiUsageException, which will (if uncaught) call the main module's error handler and die wit...
This abstract class implements many basic API functions, and is the base of all API classes.
needsToken()
Returns the token type this module requires in order to execute.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
isWriteMode()
Indicates whether this module requires write mode.
setWatch( $watch, $titleObj, $userOption=null)
Set a watch (or unwatch) based the based on a watchlist parameter.
getPermissionManager()
Obtain a PermissionManager instance that subclasses may use in their authorization checks.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getHelpUrls()
Return links to more detailed help pages about the module.
mustBePosted()
Indicates whether this module must be called with a POST request.