X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Frevisiondelete%2FRevDelList.php;h=26e4b17e8a9fced1da3e039b256547a2343e2e53;hb=ae69acacf567077b3f49d1fe6c3f3770e72a9093;hp=7aac3b8925073c1526b58973b212505358ac41bf;hpb=fc07bedeb4675fbf022a948be3568680e34af25f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/revisiondelete/RevDelList.php b/includes/revisiondelete/RevDelList.php index 7aac3b8925..26e4b17e8a 100644 --- a/includes/revisiondelete/RevDelList.php +++ b/includes/revisiondelete/RevDelList.php @@ -73,6 +73,25 @@ abstract class RevDelList extends RevisionListBase { return $target; } + /** + * Indicate whether any item in this list is suppressed + * @since 1.25 + * @return bool + */ + public function areAnySuppressed() { + $bit = $this->getSuppressBit(); + + // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed + for ( $this->reset(); $this->current(); $this->next() ) { + // @codingStandardsIgnoreEnd + $item = $this->current(); + if ( $item->getBits() & $bit ) { + return true; + } + } + return false; + } + /** * Set the visibility for the revisions in this list. Logging and * transactions are done here. @@ -99,11 +118,11 @@ abstract class RevDelList extends RevisionListBase { $status = Status::newGood(); $missing = array_flip( $this->ids ); $this->clearFileOps(); - $idsForLog = array(); - $authorIds = $authorIPs = array(); + $idsForLog = []; + $authorIds = $authorIPs = []; if ( $perItemStatus ) { - $status->itemStatuses = array(); + $status->itemStatuses = []; } // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed @@ -202,7 +221,7 @@ abstract class RevDelList extends RevisionListBase { // Log it // @FIXME: $newBits/$oldBits set in for loop, makes IDE warnings too - $this->updateLog( array( + $this->updateLog( [ 'title' => $this->title, 'count' => $successCount, 'newBits' => $newBits, @@ -211,7 +230,7 @@ abstract class RevDelList extends RevisionListBase { 'ids' => $idsForLog, 'authorIds' => $authorIds, 'authorIPs' => $authorIPs - ) ); + ] ); // Clear caches $that = $this; @@ -266,11 +285,11 @@ abstract class RevDelList extends RevisionListBase { $logEntry->setParameters( $logParams ); $logEntry->setPerformer( $this->getUser() ); // Allow for easy searching of deletion log items for revision/log items - $logEntry->setRelations( array( + $logEntry->setRelations( [ $field => $params['ids'], 'target_author_id' => $params['authorIds'], 'target_author_ip' => $params['authorIPs'], - ) ); + ] ); $logId = $logEntry->insert(); $logEntry->publish( $logId ); } @@ -289,12 +308,12 @@ abstract class RevDelList extends RevisionListBase { * @return array */ public function getLogParams( $params ) { - return array( + return [ '4::type' => $this->getType(), '5::ids' => $params['ids'], '6::ofield' => $params['oldBits'], '7::nfield' => $params['newBits'], - ); + ]; } /**