30 parent::__construct( $context, $title );
85 foreach ( $this
as $item ) {
86 if ( $item->getBits() & $bit ) {
108 $bitPars = $params[
'value'];
110 $perItemStatus = isset( $params[
'perItemStatus'] ) ? $params[
'perItemStatus'] :
false;
115 $this->res = $this->
doQuery( $dbw );
122 $dbw->startAtomic( __METHOD__ );
123 $dbw->onTransactionResolution(
131 $missing = array_flip( $this->ids );
134 $authorIds = $authorIPs = [];
136 if ( $perItemStatus ) {
149 $visibilityChangeMap = [];
152 foreach ( $this
as $item ) {
153 unset( $missing[$item->getId()] );
155 if ( $perItemStatus ) {
157 $status->itemStatuses[$item->getId()] = $itemStatus;
162 $oldBits = $item->getBits();
166 if ( $oldBits == $newBits ) {
167 $itemStatus->warning(
168 'revdelete-no-change', $item->formatDate(), $item->formatTime() );
171 } elseif ( $oldBits == 0 && $newBits != 0 ) {
173 } elseif ( $oldBits != 0 && $newBits == 0 ) {
179 if ( $item->isHideCurrentOp( $newBits ) ) {
182 'revdelete-hide-current', $item->formatDate(), $item->formatTime() );
185 } elseif ( !$item->canView() ) {
187 $msg = ( $opType ==
'show' ) ?
188 'revdelete-show-no-access' :
'revdelete-modify-no-access';
189 $itemStatus->error( $msg, $item->formatDate(), $item->formatTime() );
194 $itemStatus->warning(
195 'revdelete-only-restricted', $item->formatDate(), $item->formatTime() );
201 $ok = $item->setBits( $newBits );
204 $idsForLog[] = $item->getId();
207 $logType =
'suppress';
210 $addedBits = ( $oldBits ^ $newBits ) & $newBits;
211 $removedBits = ( $oldBits ^ $newBits ) & $oldBits;
212 $virtualNewBits |= $addedBits;
213 $virtualOldBits |= $removedBits;
216 if ( $item->getAuthorId() > 0 ) {
217 $authorIds[] = $item->getAuthorId();
219 $authorIPs[] = $item->getAuthorName();
224 $visibilityChangeMap[$item->getId()] = [
225 'oldBits' => $oldBits,
226 'newBits' => $newBits,
230 'revdelete-concurrent-change', $item->formatDate(), $item->formatTime() );
236 foreach ( $missing
as $id => $unused ) {
237 if ( $perItemStatus ) {
240 $status->error(
'revdelete-modify-missing', $id );
245 if (
$status->successCount == 0 ) {
246 $dbw->endAtomic( __METHOD__ );
251 $successCount =
$status->successCount;
265 'title' => $this->
title,
266 'count' => $successCount,
267 'newBits' => $virtualNewBits,
268 'oldBits' => $virtualOldBits,
271 'authorIds' => $authorIds,
272 'authorIPs' => $authorIPs
278 function ()
use ( $visibilityChangeMap ) {
285 $dbw->endAtomic( __METHOD__ );
293 foreach ( $this
as $item ) {
294 $status->merge( $item->lock() );
303 foreach ( $this
as $item ) {
304 $status->merge( $item->unlock() );
316 $this->res = $this->
doQuery( $dbw );
336 throw new MWException(
"Bad log URL param type!" );
342 $logEntry->setTarget(
$params[
'title'] );
343 $logEntry->setComment(
$params[
'comment'] );
344 $logEntry->setParameters( $logParams );
345 $logEntry->setPerformer( $this->
getUser() );
347 $logEntry->setRelations( [
349 'target_author_id' =>
$params[
'authorIds'],
350 'target_author_ip' =>
$params[
'authorIPs'],
352 $logId = $logEntry->insert();
353 $logEntry->publish( $logId );
373 '6::ofield' =>
$params[
'oldBits'],
374 '7::nfield' =>
$params[
'newBits'],
clearFileOps()
Clear any data structures needed for doPreCommitUpdates() and doPostCommitUpdates() STUB...
Abstract base class for a list of deletable items.
Interface for objects which can provide a MediaWiki context on request.
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
updateLog($logType, $params)
Record a log entry on the action.
getType()
Get the internal type name of this list.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static newFatal($message)
Factory function for fatal errors.
getLogParams($params)
Get log parameter array.
static suggestTarget($target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
static isIPAddress($ip)
Determine if a string is as valid IP address or network (CIDR prefix).
List for revision table items for a single page.
areAnySuppressed()
Indicate whether any item in this list is suppressed.
getSuppressBit()
Get the integer value of the flag used for suppression.
setVisibility(array $params)
Set the visibility for the revisions in this list.
reloadFromMaster()
Reload the list data from the master DB.
getLogAction()
Get the log action for this list type.
__construct(IContextSource $context, Title $title, array $ids)
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.
static extractBitfield(array $bitPars, $oldfield)
Put together a rev_deleted bitfield.
doPostCommitUpdates(array $visibilityChangeMap)
A hook for setVisibility(): do any necessary updates post-commit.
static newGood($value=null)
Factory function for good results.
static getRelationType($typeName)
Get DB field name for URL param...
static getRestriction()
Get the user right required for this list type Override this function.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
doPreCommitUpdates()
A hook for setVisibility(): do batch updates pre-commit.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
wfGetLBFactory()
Get the load balancer factory object.
Class for creating log entries manually, to inject them into the database.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
static addCallableUpdate($callable, $stage=self::POSTSEND, IDatabase $dbw=null)
Add a callable update.
static getRelationType()
Get the DB field name associated with the ID list.
getUser()
Get the User object.
doQuery($db)
Do the DB query to iterate through the objects.