Merge "objectcache: Use variadic signature for makeKey()"
[lhc/web/wiklou.git] / includes / revisiondelete / RevDelList.php
index 7ddf587..680ae8e 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\RevisionRecord;
 
 /**
  * Abstract base class for a list of deletable items. The list class
@@ -195,7 +196,7 @@ abstract class RevDelList extends RevisionListBase {
                                $status->failCount++;
                                continue;
                        // Cannot just "hide from Sysops" without hiding any fields
-                       } elseif ( $newBits == Revision::DELETED_RESTRICTED ) {
+                       } elseif ( $newBits == RevisionRecord::DELETED_RESTRICTED ) {
                                $itemStatus->warning(
                                        'revdelete-only-restricted', $item->formatDate(), $item->formatTime() );
                                $status->failCount++;
@@ -224,8 +225,21 @@ abstract class RevDelList extends RevisionListBase {
                                        } elseif ( IP::isIPAddress( $item->getAuthorName() ) ) {
                                                $authorIPs[] = $item->getAuthorName();
                                        }
-                               }
-                               if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) {
+                                       if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) {
+                                               $actorId = $item->getAuthorActor();
+                                               // During migration, the actor field might be empty. If so, populate
+                                               // it here.
+                                               if ( !$actorId ) {
+                                                       if ( $item->getAuthorId() > 0 ) {
+                                                               $user = User::newFromId( $item->getAuthorId() );
+                                                       } else {
+                                                               $user = User::newFromName( $item->getAuthorName(), false );
+                                                       }
+                                                       $actorId = $user->getActorId( $dbw );
+                                               }
+                                               $authorActors[] = $actorId;
+                                       }
+                               } elseif ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) {
                                        $authorActors[] = $item->getAuthorActor();
                                }