Merge "API: Always select rc_user from database (regardless of rcprop=user)"
[lhc/web/wiklou.git] / includes / revisiondelete / RevDelArchivedFileItem.php
index b098422..ab9830f 100644 (file)
@@ -19,6 +19,8 @@
  * @ingroup RevisionDelete
  */
 
+use MediaWiki\Storage\RevisionRecord;
+
 /**
  * Item class for a filearchive table row
  */
@@ -29,11 +31,14 @@ class RevDelArchivedFileItem extends RevDelFileItem {
        protected $lockFile;
 
        public function __construct( $list, $row ) {
-               RevDelItem::__construct( $list, $row );
-               $this->file = ArchivedFile::newFromRow( $row );
+               parent::__construct( $list, $row );
                $this->lockFile = RepoGroup::singleton()->getLocalRepo()->newFile( $row->fa_name );
        }
 
+       protected static function initFile( $list, $row ) {
+               return ArchivedFile::newFromRow( $row );
+       }
+
        public function getIdField() {
                return 'fa_id';
        }
@@ -50,6 +55,10 @@ class RevDelArchivedFileItem extends RevDelFileItem {
                return 'fa_user_text';
        }
 
+       public function getAuthorActorField() {
+               return 'fa_actor';
+       }
+
        public function getId() {
                return $this->row->fa_id;
        }
@@ -102,8 +111,8 @@ class RevDelArchivedFileItem extends RevDelFileItem {
                        'width' => $file->getWidth(),
                        'height' => $file->getHeight(),
                        'size' => $file->getSize(),
-                       'userhidden' => (bool)$file->isDeleted( Revision::DELETED_USER ),
-                       'commenthidden' => (bool)$file->isDeleted( Revision::DELETED_COMMENT ),
+                       'userhidden' => (bool)$file->isDeleted( RevisionRecord::DELETED_USER ),
+                       'commenthidden' => (bool)$file->isDeleted( RevisionRecord::DELETED_COMMENT ),
                        'contenthidden' => (bool)$this->isDeleted(),
                ];
                if ( $this->canViewContent() ) {
@@ -117,13 +126,13 @@ class RevDelArchivedFileItem extends RevDelFileItem {
                                ),
                        ];
                }
-               if ( $file->userCan( Revision::DELETED_USER, $user ) ) {
+               if ( $file->userCan( RevisionRecord::DELETED_USER, $user ) ) {
                        $ret += [
                                'userid' => $file->getUser( 'id' ),
                                'user' => $file->getUser( 'text' ),
                        ];
                }
-               if ( $file->userCan( Revision::DELETED_COMMENT, $user ) ) {
+               if ( $file->userCan( RevisionRecord::DELETED_COMMENT, $user ) ) {
                        $ret += [
                                'comment' => $file->getRawDescription(),
                        ];