Convert all array() syntax to []
[lhc/web/wiklou.git] / includes / revisiondelete / RevDelList.php
index 837557c..26e4b17 100644 (file)
@@ -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;
@@ -251,7 +270,7 @@ abstract class RevDelList extends RevisionListBase {
                if ( !$field ) {
                        throw new MWException( "Bad log URL param type!" );
                }
-               // Put things hidden from sysops in the oversight log
+               // Put things hidden from sysops in the suppression log
                if ( ( $params['newBits'] | $params['oldBits'] ) & $this->getSuppressBit() ) {
                        $logType = 'suppress';
                } else {
@@ -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'],
-               );
+               ];
        }
 
        /**