From 564f39a0d979d7d6111e82970d73dd03d23b9ed1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C4=9Bj=20Such=C3=A1nek?= Date: Tue, 21 May 2019 20:17:20 +0200 Subject: [PATCH] WikiPage: Make prepareContentForEdit method not accept an integer This has been deprecated since 1.25. Bug: T220656 Change-Id: I94f5cb78adcfbec1fdafd89495c045e6f8fd9246 --- RELEASE-NOTES-1.34 | 2 ++ includes/page/WikiPage.php | 22 +++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index d9ac7bf08f..f6135160b4 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -173,6 +173,8 @@ because of Phabricator reports. * The LegacyHookPreAuthenticationProvider class, deprecated since its creation in 1.27, has been removed. * IP::isValidBlock(), deprecated in 1.30, has been removed. +* WikiPage::prepareContentForEdit now doesn't accept an integer for $revision, + was deprecated in 1.25. * … === Deprecations in 1.34 === diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 8f39650cbd..863a3f307e 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1962,9 +1962,7 @@ class WikiPage implements Page, IDBAccessObject { * @deprecated since 1.32, use getDerivedDataUpdater instead. * * @param Content $content - * @param Revision|RevisionRecord|int|null $revision Revision object. - * For backwards compatibility, a revision ID is also accepted, - * but this is deprecated. + * @param Revision|RevisionRecord|null $revision Revision object. * Used with vary-revision or vary-revision-id. * @param User|null $user * @param string|null $serialFormat IGNORED @@ -1987,19 +1985,13 @@ class WikiPage implements Page, IDBAccessObject { $user = $wgUser; } - if ( !is_object( $revision ) ) { - $revid = $revision; - // This code path is deprecated, and nothing is known to - // use it, so performance here shouldn't be a worry. - if ( $revid !== null ) { - wfDeprecated( __METHOD__ . ' with $revision = revision ID', '1.25' ); - $store = $this->getRevisionStore(); - $revision = $store->getRevisionById( $revid, Revision::READ_LATEST ); - } else { - $revision = null; + if ( $revision !== null ) { + if ( $revision instanceof Revision ) { + $revision = $revision->getRevisionRecord(); + } elseif ( !( $revision instanceof RevisionRecord ) ) { + throw new InvalidArgumentException( + __METHOD__ . ': invalid $revision argument type ' . gettype( $revision ) ); } - } elseif ( $revision instanceof Revision ) { - $revision = $revision->getRevisionRecord(); } $slots = RevisionSlotsUpdate::newFromContent( [ SlotRecord::MAIN => $content ] ); -- 2.20.1