X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Frevisiondelete%2FRevDelList.php;h=221359da27dacb3953e583bafb57f8ac561e0dd0;hb=c56c68cb67a40801f718a60463be48e4cf5ea9e3;hp=cf895bae8907b1da981e04a145c8706f97491256;hpb=695d7c28fe7036e9988ce92908185ebc41238296;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/revisiondelete/RevDelList.php b/includes/revisiondelete/RevDelList.php index cf895bae89..221359da27 100644 --- a/includes/revisiondelete/RevDelList.php +++ b/includes/revisiondelete/RevDelList.php @@ -207,7 +207,7 @@ abstract class RevDelList extends RevisionListBase { if ( $ok ) { $idsForLog[] = $item->getId(); - // If any item field was suppressed or unsupressed + // If any item field was suppressed or unsuppressed if ( ( $oldBits | $newBits ) & $this->getSuppressBit() ) { $logType = 'suppress'; } @@ -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(