Go to the documentation of this file.
41 if ( !$params[
'ids'] ) {
42 $this->
dieWithError( [
'apierror-paramempty',
'ids' ],
'paramempty_ids' );
46 if ( $params[
'tags'] ) {
48 if ( !$ableToTag->isOK() ) {
53 $hide = $params[
'hide'] ?: [];
54 $show = $params[
'show'] ?: [];
55 if ( array_intersect( $hide, $show ) ) {
56 $this->
dieWithError(
'apierror-revdel-mutuallyexclusive',
'badparams' );
57 } elseif ( !$hide && !$show ) {
58 $this->
dieWithError(
'apierror-revdel-paramneeded',
'badparams' );
62 'comment' => RevisionRecord::DELETED_COMMENT,
63 'user' => RevisionRecord::DELETED_USER,
66 foreach ( $bits as $key => $bit ) {
67 if ( in_array( $key, $hide ) ) {
69 } elseif ( in_array( $key, $show ) ) {
76 if ( $params[
'suppress'] ===
'yes' ) {
78 $bitfield[RevisionRecord::DELETED_RESTRICTED] = 1;
79 } elseif ( $params[
'suppress'] ===
'no' ) {
80 $bitfield[RevisionRecord::DELETED_RESTRICTED] = 0;
82 $bitfield[RevisionRecord::DELETED_RESTRICTED] = -1;
86 if ( $params[
'target'] ) {
90 if ( $targetObj ===
null ) {
91 $this->
dieWithError( [
'apierror-revdel-needtarget' ],
'needtarget' );
99 $params[
'type'], $this->
getContext(), $targetObj, $params[
'ids']
101 $status = $list->setVisibility( [
102 'value' => $bitfield,
103 'comment' => $params[
'reason'],
104 'perItemStatus' =>
true,
105 'tags' => $params[
'tags']
110 $data[
'target'] = $targetObj->getFullText();
113 foreach ( $status->itemStatuses as $id =>
$s ) {
115 $data[
'items'][$id][
'id'] = $id;
118 $list->reloadFromMaster();
119 for ( $item = $list->reset(); $list->current(); $item = $list->next() ) {
120 $data[
'items'][$item->getId()] += $item->getApiData( $this->
getResult() );
123 $data[
'items'] = array_values( $data[
'items'] );
130 'status' => $status->
isOK() ?
'Success' :
'Fail',
135 $ret[
'errors'] = $errors;
139 $ret[
'warnings'] = $warnings;
190 'action=revisiondelete&target=Main%20Page&type=revision&ids=12345&' .
191 'hide=content&token=123ABC'
192 =>
'apihelp-revisiondelete-example-revision',
193 'action=revisiondelete&type=logging&ids=67890&hide=content|comment|user&' .
194 'reason=BLP%20violation&token=123ABC'
195 =>
'apihelp-revisiondelete-example-log',
200 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Revisiondelete';
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getContext()
Get the base IContextSource object.
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
getResult()
Get the result object.
checkUserRightsAny( $rights, $user=null)
Helper function for permission-denied errors.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
dieBlocked(AbstractBlock $block)
Throw an ApiUsageException, which will (if uncaught) call the main module's error handler and die wit...
getUser()
Stable to override.
This abstract class implements many basic API functions, and is the base of all API classes.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
static getTypes()
Lists the valid possible types for revision deletion.
isOK()
Returns whether the operation completed.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
static createList( $typeName, IContextSource $context, Title $title, array $ids)
Instantiate the appropriate list class for a given list of IDs.
getHelpUrls()
Return links to more detailed help pages about the module.
static getRevdelConstant( $typeName)
Get the revision deletion constant for the RevDel type.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
getPermissionManager()
Obtain a PermissionManager instance that subclasses may use in their authorization checks.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
extractStatusInfo(Status $status)
isWriteMode()
Indicates whether this module requires write mode.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
getModuleName()
Get the name of the module being executed by this instance.
mustBePosted()
Indicates whether this module must be called with a POST request Stable to override.
getExamplesMessages()
Returns usage examples for this module.
static suggestTarget( $typeName, $target, array $ids)
Suggest a target for the revision deletion.
static getRestriction( $typeName)
Get the user right required for the RevDel type.
getErrorFormatter()
Stable to override.
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.