Page MenuHomePhabricator

Make RevisionRecord::getId() take a wiki ID
Closed, ResolvedPublic

Description

Context:
When creating PageIdentity (T208776) we decided that the getId() method should require a wiki ID to be passed in if the page belongs to a wiki other than the local site. This prevents data corruption due to using an ID that belongs to one wiki in the context of another.

PageRecord will inherit this pattern from PageIdentity. RevisionRecord should use it as well.

Note that the change to the method signature is not a breaking one, since the parameter would be optional. However, it's a breaking change in behavior: code that loads a RevisionRecord from another wiki and then calls getId() on it will need to be updated. So this change needs to go through the deprecation process.

  • make RevisionRecord::getId() trigger a deprecation warning when called without parameters, if it doesn't belong to the local wiki ($this->mWiki is not false).
  • make RevisionRecord::getId() throw an exception if the $wikiId parameter does not match the $this->mWiki field. Compare PageIdentityValue::getId().

Related Objects

StatusSubtypeAssignedTask
Declineddchen
OpenNone
OpenNone
DuplicateNone
OpenNone
OpenNone
OpenNone
StalledNone
DuplicateNone
OpenNone
ResolvedNone
OpenNone
OpenNone
OpenNone
OpenNone
Resolvedppelberg
ResolvedKrinkle
OpenNone
ResolvedNone
ResolvedNone
StalledNone
OpenNone
OpenNone
Opendaniel
OpenNone
OpenNone
OpenNone
OpenNone
ResolvedPeter.ovchyn

Event Timeline

Change 658312 had a related patch set uploaded (by Vlad.shapik; owner: Vlad.shapik):
[mediawiki/core@master] RevisionRecord: make RevisionRecord::getId() take a wiki ID

https://gerrit.wikimedia.org/r/658312

Change 658312 merged by jenkins-bot:
[mediawiki/core@master] RevisionRecord: make RevisionRecord::getId() take a wiki ID

https://gerrit.wikimedia.org/r/658312

Pchelolo added a subscriber: Pchelolo.

Now we need to watch for wfDeprecated in production or any extension tests failures, and fix those.

Change 661114 had a related patch set uploaded (by Tobias Andersson; owner: Tobias Andersson):
[mediawiki/extensions/Wikibase@master] In T272485 the signature of RevisionRecord::getId changed to take a wiki parameter that is used asserting that the correct wiki is being used.

https://gerrit.wikimedia.org/r/661114