Merge "RevisionStore: Avoid exception on prev/next of deleted revision"
[lhc/web/wiklou.git] / includes / api / ApiRevisionDelete.php
index 5a51b28..c636ba1 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 /**
- * Created on Jun 25, 2013
- *
  * Copyright © 2013 Wikimedia Foundation and contributors
  *
  * This program is free software; you can redistribute it and/or modify
@@ -23,6 +21,8 @@
  * @since 1.23
  */
 
+use MediaWiki\Revision\RevisionRecord;
+
 /**
  * API interface to RevDel. The API equivalent of Special:RevisionDelete.
  * Requires API write mode to be enabled.
@@ -63,8 +63,8 @@ class ApiRevisionDelete extends ApiBase {
                }
                $bits = [
                        'content' => RevisionDeleter::getRevdelConstant( $params['type'] ),
-                       'comment' => Revision::DELETED_COMMENT,
-                       'user' => Revision::DELETED_USER,
+                       'comment' => RevisionRecord::DELETED_COMMENT,
+                       'user' => RevisionRecord::DELETED_USER,
                ];
                $bitfield = [];
                foreach ( $bits as $key => $bit ) {
@@ -79,11 +79,11 @@ class ApiRevisionDelete extends ApiBase {
 
                if ( $params['suppress'] === 'yes' ) {
                        $this->checkUserRightsAny( 'suppressrevision' );
-                       $bitfield[Revision::DELETED_RESTRICTED] = 1;
+                       $bitfield[RevisionRecord::DELETED_RESTRICTED] = 1;
                } elseif ( $params['suppress'] === 'no' ) {
-                       $bitfield[Revision::DELETED_RESTRICTED] = 0;
+                       $bitfield[RevisionRecord::DELETED_RESTRICTED] = 0;
                } else {
-                       $bitfield[Revision::DELETED_RESTRICTED] = -1;
+                       $bitfield[RevisionRecord::DELETED_RESTRICTED] = -1;
                }
 
                $targetObj = null;
@@ -116,11 +116,10 @@ class ApiRevisionDelete extends ApiBase {
                }
 
                $list->reloadFromMaster();
-               // @codingStandardsIgnoreStart Avoid function calls in a FOR loop test part
+               // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
                for ( $item = $list->reset(); $list->current(); $item = $list->next() ) {
                        $data['items'][$item->getId()] += $item->getApiData( $this->getResult() );
                }
-               // @codingStandardsIgnoreEnd
 
                $data['items'] = array_values( $data['items'] );
                ApiResult::setIndexedTagName( $data['items'], 'i' );