112 foreach ( $this as $item ) {
113 if ( $item->getBits() & $bit ) {
136 $bitPars = $params[
'value'];
137 $comment = $params[
'comment'];
138 $perItemStatus = $params[
'perItemStatus'] ??
false;
142 $dbw = $this->lbFactory->getMainLB()->getConnectionRef(
DB_PRIMARY );
143 $this->res = $this->
doQuery( $dbw );
146 if ( !$status->isGood() ) {
150 $dbw->startAtomic( __METHOD__, $dbw::ATOMIC_CANCELABLE );
151 $dbw->onTransactionResolution(
159 $missing = array_fill_keys( $this->ids,
true );
164 if ( $perItemStatus ) {
165 $status->itemStatuses = [];
177 $visibilityChangeMap = [];
180 foreach ( $this as $item ) {
181 unset( $missing[$item->getId()] );
183 if ( $perItemStatus ) {
185 $status->itemStatuses[$item->getId()] = $itemStatus;
187 $itemStatus = $status;
190 $oldBits = $item->getBits();
194 if ( $oldBits == $newBits ) {
195 $itemStatus->warning(
196 'revdelete-no-change', $item->formatDate(), $item->formatTime() );
197 $status->failCount++;
199 } elseif ( $oldBits == 0 && $newBits != 0 ) {
201 } elseif ( $oldBits != 0 && $newBits == 0 ) {
207 if ( $item->isHideCurrentOp( $newBits ) ) {
210 'revdelete-hide-current', $item->formatDate(), $item->formatTime() );
211 $status->failCount++;
213 } elseif ( !$item->canView() ) {
215 $msg = ( $opType ==
'show' ) ?
216 'revdelete-show-no-access' :
'revdelete-modify-no-access';
217 $itemStatus->error( $msg, $item->formatDate(), $item->formatTime() );
218 $status->failCount++;
221 } elseif ( $newBits == RevisionRecord::DELETED_RESTRICTED ) {
222 $itemStatus->warning(
223 'revdelete-only-restricted', $item->formatDate(), $item->formatTime() );
224 $status->failCount++;
229 $ok = $item->setBits( $newBits );
232 $idsForLog[] = $item->getId();
235 $logType =
'suppress';
238 $addedBits = ( $oldBits ^ $newBits ) & $newBits;
239 $removedBits = ( $oldBits ^ $newBits ) & $oldBits;
240 $virtualNewBits |= $addedBits;
241 $virtualOldBits |= $removedBits;
243 $status->successCount++;
244 $authorActors[] = $item->getAuthorActor();
248 $visibilityChangeMap[$item->getId()] = [
249 'oldBits' => $oldBits,
250 'newBits' => $newBits,
254 'revdelete-concurrent-change', $item->formatDate(), $item->formatTime() );
255 $status->failCount++;
260 foreach ( $missing as $id => $unused ) {
261 if ( $perItemStatus ) {
262 $status->itemStatuses[$id] =
Status::newFatal(
'revdelete-modify-missing', $id );
264 $status->error(
'revdelete-modify-missing', $id );
266 $status->failCount++;
269 if ( $status->successCount == 0 ) {
270 $dbw->endAtomic( __METHOD__ );
275 $successCount = $status->successCount;
279 if ( !$status->isOK() ) {
281 $dbw->cancelAtomic( __METHOD__ );
287 $authorFields[
'authorActors'] = $authorActors;
291 'page' => $this->page,
292 'count' => $successCount,
293 'newBits' => $virtualNewBits,
294 'oldBits' => $virtualOldBits,
295 'comment' => $comment,
297 'tags' => $params[
'tags'] ?? [],
303 function () use ( $visibilityChangeMap ) {
306 DeferredUpdates::PRESEND,
310 $dbw->endAtomic( __METHOD__ );
318 foreach ( $this as $item ) {
319 $status->merge( $item->lock() );
328 foreach ( $this as $item ) {
329 $status->merge( $item->unlock() );
341 $dbw = $this->lbFactory->getMainLB()->getConnectionRef(
DB_PRIMARY );
342 $this->res = $this->
doQuery( $dbw );
370 throw new MWException(
"Bad log URL param type!" );
376 $logEntry->setTarget( $params[
'page'] );
377 $logEntry->setComment( $params[
'comment'] );
378 $logEntry->setParameters( $logParams );
379 $logEntry->setPerformer( $this->
getUser() );
382 $field => $params[
'ids'],
384 if ( isset( $params[
'authorActors'] ) ) {
386 'target_author_actor' => $params[
'authorActors'],
389 $logEntry->setRelations( $relations );
391 $logEntry->addTags( $params[
'tags'] );
392 $logId = $logEntry->insert();
393 $logEntry->publish( $logId );
412 '5::ids' => $params[
'ids'],
413 '6::ofield' => $params[
'oldBits'],
414 '7::nfield' => $params[
'newBits'],
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
static addCallableUpdate( $callable, $stage=self::POSTSEND, $dbw=null)
Add an update to the pending update queue that invokes the specified callback when run.
Class for creating new log entries and inserting them into the database.
setVisibility(array $params)
Set the visibility for the revisions in this list.
areAnySuppressed()
Indicate whether any item in this list is suppressed.
static suggestTarget( $target, array $ids)
Suggest a target for the revision deletion Optionally override this function.
doPreCommitUpdates()
A hook for setVisibility(): do batch updates pre-commit.
static getRestriction()
Get the user right required for this list type Override this function.
getLogAction()
Get the log action for this list type.
clearFileOps()
Clear any data structures needed for doPreCommitUpdates() and doPostCommitUpdates() STUB.
static getRelationType()
Get the DB field name associated with the ID list.
doPostCommitUpdates(array $visibilityChangeMap)
A hook for setVisibility(): do any necessary updates post-commit.
getSuppressBit()
Get the integer value of the flag used for suppression.
getLogParams( $params)
Get log parameter array.
static getRevdelConstant()
Get the revision deletion constant for this list type Override this function.
reloadFromPrimary()
Reload the list data from the primary DB.
updateLog( $logType, $params)
Record a log entry on the action.
__construct(IContextSource $context, PageIdentity $page, array $ids, LBFactory $lbFactory)
static getRelationType( $typeName)
Get DB field name for URL param...
static extractBitfield(array $bitPars, $oldfield)
Put together a rev_deleted bitfield.
List for revision table items for a single page.
getType()
Get the internal type name of this list.
doQuery( $db)
Do the DB query to iterate through the objects.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
static newGood( $value=null)
Factory function for good results.
Interface for objects which can provide a MediaWiki context on request.
Interface for objects (potentially) representing an editable wiki page.