34 'revision' => RevDelRevisionList::class,
35 'archive' => RevDelArchiveList::class,
36 'oldimage' => RevDelFileList::class,
37 'filearchive' => RevDelArchivedFileList::class,
38 'logging' => RevDelLogList::class,
43 'oldid' =>
'revision',
44 'artimestamp' =>
'archive',
45 'oldimage' =>
'oldimage',
46 'fileid' =>
'filearchive',
57 return array_keys( self::ALLOWED_TYPES );
68 if ( isset( self::DEPRECATED_TYPE_MAP[$typeName] ) ) {
69 $typeName = self::DEPRECATED_TYPE_MAP[$typeName];
71 return isset( self::ALLOWED_TYPES[$typeName] ) ? $typeName :
null;
88 throw new MWException( __METHOD__ .
": Unknown RevDel type '$typeName'" );
90 $class = self::ALLOWED_TYPES[$typeName];
91 return new $class( $context,
$title, $ids );
105 protected static function checkItem( $desc, $field, $diff, $new, &$arr ) {
106 if ( $diff & $field ) {
107 $arr[( $new & $field ) ? 0 : 1][] = $desc;
131 $ret = [ 0 => [], 1 => [], 2 => [] ];
134 RevisionRecord::DELETED_TEXT, $diff, $n, $ret );
136 RevisionRecord::DELETED_COMMENT, $diff, $n, $ret );
138 RevisionRecord::DELETED_USER, $diff, $n, $ret );
140 if ( $diff & RevisionRecord::DELETED_RESTRICTED ) {
141 if ( $n & RevisionRecord::DELETED_RESTRICTED ) {
142 $ret[2][] =
'revdelete-restricted';
144 $ret[2][] =
'revdelete-unrestricted';
161 return call_user_func( [ self::ALLOWED_TYPES[$typeName],
'getRelationType' ] );
175 return call_user_func( [ self::ALLOWED_TYPES[$typeName],
'getRestriction' ] );
189 return call_user_func( [ self::ALLOWED_TYPES[$typeName],
'getRevdelConstant' ] );
205 return call_user_func( [ self::ALLOWED_TYPES[$typeName],
'suggestTarget' ], $target, $ids );
219 $exists =
$dbr->selectField(
'revision',
'1',
220 [
'rev_id' => $revid ], __METHOD__ );
226 $timestamp =
$dbr->selectField(
'archive',
'ar_timestamp',
227 [
'ar_namespace' =>
$title->getNamespace(),
228 'ar_title' =>
$title->getDBkey(),
229 'ar_rev_id' => $revid ], __METHOD__ );
244 foreach ( $bitPars as $const => $val ) {
247 } elseif ( $val == -1 ) {
248 $newBits |= ( $oldfield & $const );
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
General controller for RevDel, used by both SpecialRevisiondelete and ApiRevisionDelete.
const DEPRECATED_TYPE_MAP
Type map to support old log entries.
static getCanonicalTypeName( $typeName)
Gets the canonical type name, if any.
static createList( $typeName, IContextSource $context, Title $title, array $ids)
Instantiate the appropriate list class for a given list of IDs.
static getTypes()
Lists the valid possible types for revision deletion.
static checkItem( $desc, $field, $diff, $new, &$arr)
Checks for a change in the bitfield for a certain option and updates the provided array accordingly.
static getRelationType( $typeName)
Get DB field name for URL param... Future code for other things may also track other types of revisio...
static getChanges( $n, $o)
Gets an array of message keys describing the changes made to the visibility of the revision.
static suggestTarget( $typeName, $target, array $ids)
Suggest a target for the revision deletion.
const ALLOWED_TYPES
List of known revdel types, with their corresponding list classes.
static extractBitfield(array $bitPars, $oldfield)
Put together a rev_deleted bitfield.
static getRevdelConstant( $typeName)
Get the revision deletion constant for the RevDel type.
static getRestriction( $typeName)
Get the user right required for the RevDel type.
static checkRevisionExistence( $title, $revid)
Checks if a revision still exists in the revision table.
Represents a title within MediaWiki.
Interface for objects which can provide a MediaWiki context on request.