Page MenuHomePhabricator

EditPage::getBaseRevision returns a revision
Closed, ResolvedPublic


It would be a breaking change to have it return a RevisionRecord instead, which is what it probably should be returning
$this->mBaseRevision = $revRecord ? new Revision( $revRecord ) : null;
The method also has a warning note

@warning this method is very poorly named. If the user opened the form with ?oldid=X, one might think of X as the "base revision", which is NOT what this returns, see oldid for that. One might further assume that this corresponds to the $baseRevId parameter of WikiPage::doEditContent, which is not the case either. getExpectedParentRevision() would perhaps be a better name.

Introduce EditPage::getExpectedParentRevision (or ...ParentRevisionRecord?) that returns a RevisionRecord instead
Have EditPage::getBaseRevision be a wrapper for the new method that returns a revision instead of a revision record
Replace uses in WMF deployed code, deprecate, etc

Event Timeline

DannyS712 triaged this task as Medium priority.Mar 27 2020, 6:59 AM
DannyS712 created this task.
DannyS712 moved this task from Unsorted to Next on the User-DannyS712 board.

Makes sense, killing two birds with one stone. There were talks about refactoring EditPage, but I guess the timeline of a major refactoring would be much longer

Change 585843 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Introduce EditPage::getBaseRevisionRecord, deprecate using Revision

Note that while there are a number of calls to getBaseRevision in the WikiBase repository, they do not refer to EditPage::getBaseRevision. Outside of the EditPage class itself, the only usage is in the TwoColConflict extension.

  1. Merge patch soft deprecating getBaseRevision and adding getExpectedParentRevision
  2. Update TwoColConflict
  3. Hard deprecate getBaseRevision (hopefully in 1.35)
  4. Remove getBaseRevision (hopefully in 1.36)

Change 585843 merged by jenkins-bot:
[mediawiki/core@master] Introduce EditPage::getExpectedParentRevision, deprecate using Revision

Change 588066 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/TwoColConflict@master] Use EditPage::getExpectedParentRevision when available

Change 588066 merged by jenkins-bot:
[mediawiki/extensions/TwoColConflict@master] Use EditPage::getExpectedParentRevision when available

Change 588451 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Hard deprecate EditPage::getBaseRevision

Change 588451 merged by jenkins-bot:
[mediawiki/core@master] Hard deprecate EditPage::getBaseRevision