Fix typos in DefaultSettings
[lhc/web/wiklou.git] / includes / revisiondelete / RevDelList.php
index c5cffea..221359d 100644 (file)
@@ -218,14 +218,27 @@ abstract class RevDelList extends RevisionListBase {
                                $virtualOldBits |= $removedBits;
 
                                $status->successCount++;
-                               if ( $wgActorTableSchemaMigrationStage <= MIGRATION_WRITE_BOTH ) {
+                               if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_OLD ) {
                                        if ( $item->getAuthorId() > 0 ) {
                                                $authorIds[] = $item->getAuthorId();
                                        } elseif ( IP::isIPAddress( $item->getAuthorName() ) ) {
                                                $authorIPs[] = $item->getAuthorName();
                                        }
-                               }
-                               if ( $wgActorTableSchemaMigrationStage >= MIGRATION_WRITE_BOTH ) {
+                                       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();
                                }
 
@@ -271,11 +284,11 @@ abstract class RevDelList extends RevisionListBase {
 
                // Log it
                $authorFields = [];
-               if ( $wgActorTableSchemaMigrationStage <= MIGRATION_WRITE_BOTH ) {
+               if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_OLD ) {
                        $authorFields['authorIds'] = $authorIds;
                        $authorFields['authorIPs'] = $authorIPs;
                }
-               if ( $wgActorTableSchemaMigrationStage >= MIGRATION_WRITE_BOTH ) {
+               if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) {
                        $authorFields['authorActors'] = $authorActors;
                }
                $this->updateLog(