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 ) {
156 $itemStatus = Status::newGood();
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 ) {
238 $status->itemStatuses[$id] = Status::newFatal(
'revdelete-modify-missing', $id );
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
277 DeferredUpdates::addCallableUpdate(
278 function ()
use ( $visibilityChangeMap ) {
281 DeferredUpdates::PRESEND,
285 $dbw->endAtomic( __METHOD__ );