Lucas_Werkmeister_WMDE added a comment.

  This change in MediaWiki core also fixes the test:
  
    diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
    index b5b538a85b..f1a37d3fe7 100644
    --- a/includes/page/WikiPage.php
    +++ b/includes/page/WikiPage.php
    @@ -1508,10 +1508,11 @@ public function updateRevisionOn(
     
                $result = $dbw->affectedRows() > 0;
                if ( $result ) {
                        $this->updateRedirectOn( $dbw, $rt, $lastRevIsRedirect 
);
                        $this->setLastEdit( $revision );
    +                   $this->mTitle->resetArticleID( $this->getId() );
                        $this->mRedirectTarget = null;
                        $this->mHasRedirectTarget = null;
                        $this->mPageIsRedirectField = (bool)$rt;
                        $this->mIsNew = (bool)$isNew;
                        $this->mIsRedirect = (bool)$isRedirect;
  
  The sequence of events seems to be:
  
  - The `Title` was just created. Its `mLatestID` is `false`, meaning “not 
loaded yet”.
  - `PageArchive::undeleteRevisions()` calls `WikiPage::updateRevisionOn()` to 
attach the latest revision to the page.
  - `WikiPage::updateRevisionOn()` loads its own page ID (article ID) so it can 
insert the page ID. (I think it even loads this from a replica DB?) This 
eventually causes the `mLatestID` of the `Title` to become `0`, meaning “no 
latest revision”. At this point, that’s correct, because the latest revision 
hasn’t been attached to the page yet.
  - `WikiPage::updateRevisionOn()` proceeds to update the `page` table, 
connecting the latest revision and updating the `page_latest` column.
  - `WikiPage::updateRevisionOn()` updates its own metadata, and the link 
cache, with the new latest revision that it just wrote to the database. 
However, it does not update the metadata of the `Title` object.
  - `PageArchive::undeleteRevisions()` continues, and calls the hook with the 
same `Title`, which still contains the `mLatestID = 0` even though this is now 
incorrect (the `page_latest` was updated).
  
  I’m not quite sure where this should be fixed (the above patch works but 
probably isn’t quite right), but I think it’s indeed a MediaWiki bug, and 
nothing that we should work around in Cognate.

TASK DETAIL
  https://phabricator.wikimedia.org/T283654

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: toan, dang, Lucas_Werkmeister_WMDE, Aklapper, DannyS712, Invadibot, 
maantietaja, Akuckartz, Iflorez, alaa_wmde, Nandana, Lahi, Gq86, Pablo-WMDE, 
GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, 
Jonas, Thibaut120094, Wikidata-bugs, aude, Lydia_Pintscher, Darkdadaah, 
Jdforrester-WMF, Addshore, Mbch331, Ltrlg
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to