MediaWiki  1.34.0
RevisionDeleter Class Reference

General controller for RevDel, used by both SpecialRevisiondelete and ApiRevisionDelete. More...

Static Public Member Functions

static checkRevisionExistence ( $title, $revid)
 Checks if a revision still exists in the revision table. More...
 
static createList ( $typeName, IContextSource $context, Title $title, array $ids)
 Instantiate the appropriate list class for a given list of IDs. More...
 
static extractBitfield (array $bitPars, $oldfield)
 Put together a rev_deleted bitfield. More...
 
static getCanonicalTypeName ( $typeName)
 Gets the canonical type name, if any. More...
 
static getChanges ( $n, $o)
 Gets an array of message keys describing the changes made to the visibility of the revision. More...
 
static getRelationType ( $typeName)
 Get DB field name for URL param... More...
 
static getRestriction ( $typeName)
 Get the user right required for the RevDel type. More...
 
static getRevdelConstant ( $typeName)
 Get the revision deletion constant for the RevDel type. More...
 
static getTypes ()
 Lists the valid possible types for revision deletion. More...
 
static suggestTarget ( $typeName, $target, array $ids)
 Suggest a target for the revision deletion. More...
 

Static Protected Member Functions

static checkItem ( $desc, $field, $diff, $new, &$arr)
 Checks for a change in the bitfield for a certain option and updates the provided array accordingly. More...
 

Static Private Attributes

static $allowedTypes
 List of known revdel types, with their corresponding list classes. More...
 
static $deprecatedTypeMap
 Type map to support old log entries. More...
 

Detailed Description

General controller for RevDel, used by both SpecialRevisiondelete and ApiRevisionDelete.

Definition at line 31 of file RevisionDeleter.php.

Member Function Documentation

◆ checkItem()

static RevisionDeleter::checkItem (   $desc,
  $field,
  $diff,
  $new,
$arr 
)
staticprotected

Checks for a change in the bitfield for a certain option and updates the provided array accordingly.

Parameters
string$descDescription to add to the array if the option was enabled / disabled.
int$fieldThe bitmask describing the single option.
int$diffThe xor of the old and new bitfields.
int$newThe new bitfield
array&$arrThe array to update.

Definition at line 105 of file RevisionDeleter.php.

Referenced by getChanges().

◆ checkRevisionExistence()

static RevisionDeleter::checkRevisionExistence (   $title,
  $revid 
)
static

Checks if a revision still exists in the revision table.

If it doesn't, returns the corresponding ar_timestamp field so that this key can be used instead.

Parameters
Title$title
int$revid
Returns
bool|mixed

Definition at line 217 of file RevisionDeleter.php.

References $dbr, $title, DB_REPLICA, and wfGetDB().

◆ createList()

static RevisionDeleter::createList (   $typeName,
IContextSource  $context,
Title  $title,
array  $ids 
)
static

Instantiate the appropriate list class for a given list of IDs.

Since
1.22
Parameters
string$typeNameRevDel type, see RevisionDeleter::getTypes()
IContextSource$context
Title$title
array$ids
Returns
RevDelList
Exceptions
MWException

Definition at line 85 of file RevisionDeleter.php.

References $context, $title, and getCanonicalTypeName().

Referenced by ApiRevisionDelete\execute(), and SpecialRevisionDelete\getList().

◆ extractBitfield()

static RevisionDeleter::extractBitfield ( array  $bitPars,
  $oldfield 
)
static

Put together a rev_deleted bitfield.

Since
1.22
Parameters
array$bitParsExtractBitParams() params
int$oldfieldCurrent bitfield
Returns
int

Definition at line 241 of file RevisionDeleter.php.

Referenced by SpecialRevisionDelete\buildCheckBoxes(), and RevDelList\setVisibility().

◆ getCanonicalTypeName()

static RevisionDeleter::getCanonicalTypeName (   $typeName)
static

Gets the canonical type name, if any.

Since
1.22
Parameters
string$typeName
Returns
string|null

Definition at line 67 of file RevisionDeleter.php.

Referenced by createList(), SpecialRevisionDelete\execute(), getRelationType(), getRestriction(), getRevdelConstant(), and suggestTarget().

◆ getChanges()

static RevisionDeleter::getChanges (   $n,
  $o 
)
static

Gets an array of message keys describing the changes made to the visibility of the revision.

If the resulting array is $arr, then $arr[0] will contain an array of keys describing the items that were hidden, $arr[1] will contain an array of keys describing the items that were unhidden, and $arr[2] will contain an array with a single message key, which can be one of "revdelete-restricted", "revdelete-unrestricted" indicating (un)suppression or null to indicate nothing in particular. You can turn the keys in $arr[0] and $arr[1] into message keys by appending -hid and -unhid to the keys respectively.

Parameters
int$nThe new bitfield.
int$oThe old bitfield.
Returns
array An array as described above.
Since
1.19 public

Definition at line 129 of file RevisionDeleter.php.

References checkItem().

Referenced by DeleteLogFormatter\getMessageParameters().

◆ getRelationType()

static RevisionDeleter::getRelationType (   $typeName)
static

Get DB field name for URL param...

Future code for other things may also track other types of revision-specific changes.

Parameters
string$typeName
Returns
string One of log_id/rev_id/fa_id/ar_timestamp/oi_archive_name

Definition at line 156 of file RevisionDeleter.php.

References getCanonicalTypeName().

Referenced by PopulateLogSearch\doDBUpdates(), SpecialRevisionDelete\getLogQueryCond(), and RevDelList\updateLog().

◆ getRestriction()

static RevisionDeleter::getRestriction (   $typeName)
static

Get the user right required for the RevDel type.

Since
1.22
Parameters
string$typeName
Returns
string User right

Definition at line 170 of file RevisionDeleter.php.

References getCanonicalTypeName().

Referenced by ApiRevisionDelete\execute(), and SpecialRevisionDelete\execute().

◆ getRevdelConstant()

static RevisionDeleter::getRevdelConstant (   $typeName)
static

Get the revision deletion constant for the RevDel type.

Since
1.22
Parameters
string$typeName
Returns
int RevDel constant

Definition at line 184 of file RevisionDeleter.php.

References getCanonicalTypeName().

Referenced by ApiRevisionDelete\execute(), and SpecialRevisionDelete\execute().

◆ getTypes()

static RevisionDeleter::getTypes ( )
static

Lists the valid possible types for revision deletion.

Since
1.22
Returns
array

Definition at line 56 of file RevisionDeleter.php.

Referenced by ApiRevisionDelete\getAllowedParams().

◆ suggestTarget()

static RevisionDeleter::suggestTarget (   $typeName,
  $target,
array  $ids 
)
static

Suggest a target for the revision deletion.

Since
1.22
Parameters
string$typeName
Title | null$targetUser-supplied target
array$ids
Returns
Title|null

Definition at line 200 of file RevisionDeleter.php.

References getCanonicalTypeName().

Referenced by ApiRevisionDelete\execute(), SpecialEditTags\execute(), and SpecialRevisionDelete\execute().

Member Data Documentation

◆ $allowedTypes

RevisionDeleter::$allowedTypes
staticprivate
Initial value:
= [
'revision' => RevDelRevisionList::class,
'archive' => RevDelArchiveList::class,
'oldimage' => RevDelFileList::class,
'filearchive' => RevDelArchivedFileList::class,
'logging' => RevDelLogList::class,
]

List of known revdel types, with their corresponding list classes.

Definition at line 33 of file RevisionDeleter.php.

◆ $deprecatedTypeMap

RevisionDeleter::$deprecatedTypeMap
staticprivate
Initial value:
= [
'oldid' => 'revision',
'artimestamp' => 'archive',
'oldimage' => 'oldimage',
'fileid' => 'filearchive',
'logid' => 'logging',
]

Type map to support old log entries.

Definition at line 42 of file RevisionDeleter.php.


The documentation for this class was generated from the following file: