aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Revision/RevisionRecord.php
diff options
context:
space:
mode:
authorPeter Ovchyn <peter.ovchyn@speedandfunction.com>2021-02-07 22:10:03 +0200
committerPeter Ovchyn <peter.ovchyn@speedandfunction.com>2021-02-08 12:09:58 +0200
commite708b1d33f61e2be89050c25ed7ccbf9bfb9ef83 (patch)
treea6d30ca4e0c1534ed066aa4a05995698c6ce2b91 /includes/Revision/RevisionRecord.php
parente4f66891703413dbb06c231d51d8d54095975068 (diff)
downloadmediawikicore-e708b1d33f61e2be89050c25ed7ccbf9bfb9ef83.tar.gz
mediawikicore-e708b1d33f61e2be89050c25ed7ccbf9bfb9ef83.zip
Make RevisionRecord::getPageId() and :: getParentId take a wiki ID
Bug: T273284 Change-Id: Id191b54844aaefeeaca081ae00997f13cdb987cb
Diffstat (limited to 'includes/Revision/RevisionRecord.php')
-rw-r--r--includes/Revision/RevisionRecord.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/includes/Revision/RevisionRecord.php b/includes/Revision/RevisionRecord.php
index c5ad6c13edf0..dbd3f5a0dedd 100644
--- a/includes/Revision/RevisionRecord.php
+++ b/includes/Revision/RevisionRecord.php
@@ -287,7 +287,7 @@ abstract class RevisionRecord implements WikiAwareEntity {
$provided = $wikiId === self::LOCAL ? 'the local wiki' : "'{$wikiId}'";
$stored = $this->getWikiId() === self::LOCAL ? 'the local wiki' : "'{$this->getWikiId()}'";
- wfDeprecatedMsg( "Expected RevisionRecord to belong to $provided, "
+ wfDeprecatedMsg( __METHOD__ . ": Expected RevisionRecord to belong to $provided, "
. "but it belongs to $stored", '1.36' );
return $this->mId;
}
@@ -304,9 +304,18 @@ abstract class RevisionRecord implements WikiAwareEntity {
*
* MCR migration note: this replaces Revision::getParentId
*
+ * @param string|false $wikiId The wiki ID expected by the caller.
* @return int|null
*/
- public function getParentId() {
+ public function getParentId( $wikiId = self::LOCAL ) {
+ if ( $wikiId !== $this->getWikiId() ) {
+ $provided = $wikiId === self::LOCAL ? 'the local wiki' : "'{$wikiId}'";
+ $stored = $this->getWikiId() === self::LOCAL ? 'the local wiki' : "'{$this->getWikiId()}'";
+
+ wfDeprecatedMsg( __METHOD__ . ": Expected RevisionRecord to belong to $provided, "
+ . "but it belongs to $stored", '1.36' );
+ return $this->mParentId;
+ }
return $this->mParentId;
}
@@ -340,9 +349,18 @@ abstract class RevisionRecord implements WikiAwareEntity {
*
* MCR migration note: this replaces Revision::getPage
*
+ * @param string|false $wikiId The wiki ID expected by the caller.
* @return int
*/
- public function getPageId() {
+ public function getPageId( $wikiId = self::LOCAL ) {
+ if ( $wikiId !== $this->getWikiId() ) {
+ $provided = $wikiId === self::LOCAL ? 'the local wiki' : "'{$wikiId}'";
+ $stored = $this->getWikiId() === self::LOCAL ? 'the local wiki' : "'{$this->getWikiId()}'";
+
+ wfDeprecatedMsg( __METHOD__ . ": Expected RevisionRecord to belong to $provided, "
+ . "but it belongs to $stored", '1.36' );
+ return $this->mPageId;
+ }
return $this->mPageId;
}