DerivedPageDataUpdater::prepareUpdate deprecate passing a Revision
Revision can be in the $options array Callers also need to be updated Bug: T255909 Change-Id: I22aa89aaab546b98b516cf344655589550a13457
This commit is contained in:
parent
ad4a3ba45f
commit
f47b779f56
3 changed files with 27 additions and 7 deletions
|
|
@ -766,6 +766,11 @@ because of Phabricator reports.
|
|||
getSubitemList() methods directly.
|
||||
* OutputPage::getCSPNonce() is deprecated, use OutputPage::getCSP()->getNonce()
|
||||
instead.
|
||||
* DerivedPageDataUpdater::prepareUpdate accepted as its second parameter an
|
||||
optional array of options. Specifying the value of the `oldrevision` key of
|
||||
the array to be a Revision object, rather than a RevisionRecord object, is
|
||||
hard deprecated. The same applies to the options parameter in
|
||||
WikiPage::doEditUpdates.
|
||||
* Skin::makeI18nUrl() and makeNSUrl() have been deprecated, no longer used.
|
||||
* Title::countAuthorsBetween and Title::getAuthorsBetween were hard deprecated.
|
||||
Use respective methods in RevisionStore instead.
|
||||
|
|
|
|||
|
|
@ -1074,7 +1074,8 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
|
|||
* - created: bool, whether the revision created the page (default false)
|
||||
* - moved: bool, whether the page was moved (default false)
|
||||
* - restored: bool, whether the page was undeleted (default false)
|
||||
* - oldrevision: Revision object for the pre-update revision (default null)
|
||||
* - oldrevision: RevisionRecord object for the pre-update revision (default null)
|
||||
* can also be a Revision object, which is deprecated since 1.35
|
||||
* - triggeringUser: The user triggering the update (UserIdentity, defaults to the
|
||||
* user who created the revision)
|
||||
* - oldredirect: bool, null, or string 'no-change' (default null):
|
||||
|
|
@ -1099,9 +1100,16 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
|
|||
* of ParserOutput objects. (default: null) (since 1.33)
|
||||
*/
|
||||
public function prepareUpdate( RevisionRecord $revision, array $options = [] ) {
|
||||
if ( isset( $options['oldrevision'] ) && $options['oldrevision'] instanceof Revision ) {
|
||||
wfDeprecated(
|
||||
__METHOD__ . ' with the `oldrevision` option being a ' .
|
||||
'Revision object',
|
||||
'1.35'
|
||||
);
|
||||
$options['oldrevision'] = $options['oldrevision']->getRevisionRecord();
|
||||
}
|
||||
Assert::parameter(
|
||||
!isset( $options['oldrevision'] )
|
||||
|| $options['oldrevision'] instanceof Revision
|
||||
|| $options['oldrevision'] instanceof RevisionRecord,
|
||||
'$options["oldrevision"]',
|
||||
'must be a RevisionRecord (or Revision)'
|
||||
|
|
@ -1147,7 +1155,7 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
|
|||
$oldId = $this->pageState['oldId'] ?? 0;
|
||||
$this->options['newrev'] = ( $revision->getId() !== $oldId );
|
||||
} elseif ( isset( $this->options['oldrevision'] ) ) {
|
||||
/** @var Revision|RevisionRecord $oldRev */
|
||||
/** @var RevisionRecord $oldRev */
|
||||
$oldRev = $this->options['oldrevision'];
|
||||
$oldId = $oldRev->getId();
|
||||
$this->options['newrev'] = ( $revision->getId() !== $oldId );
|
||||
|
|
@ -1215,9 +1223,7 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
|
|||
|
||||
if ( isset( $this->options['oldrevision'] ) ) {
|
||||
$rev = $this->options['oldrevision'];
|
||||
$this->pageState['oldRevision'] = $rev instanceof Revision
|
||||
? $rev->getRevisionRecord()
|
||||
: $rev;
|
||||
$this->pageState['oldRevision'] = $rev;
|
||||
}
|
||||
} else {
|
||||
// This is a null-edit, so the old revision IS the new revision!
|
||||
|
|
|
|||
|
|
@ -2085,7 +2085,8 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
* - created: bool, whether the revision created the page (default false)
|
||||
* - moved: bool, whether the page was moved (default false)
|
||||
* - restored: bool, whether the page was undeleted (default false)
|
||||
* - oldrevision: Revision object for the pre-update revision (default null)
|
||||
* - oldrevision: RevisionRecord object for the pre-update revision (default null)
|
||||
* can also be a Revision object, but that is deprecated since 1.35
|
||||
* - oldcountable: bool, null, or string 'no-change' (default null):
|
||||
* - bool: whether the page was counted as an article before that
|
||||
* revision, only used in changed is true and created is false
|
||||
|
|
@ -2102,6 +2103,14 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
wfDeprecated( __METHOD__ . ' with a Revision object', '1.35' );
|
||||
$revisionRecord = $revisionRecord->getRevisionRecord();
|
||||
}
|
||||
if ( isset( $options['oldrevision'] ) && $options['oldrevision'] instanceof Revision ) {
|
||||
wfDeprecated(
|
||||
__METHOD__ . ' with the `oldrevision` option being a ' .
|
||||
'Revision object',
|
||||
'1.35'
|
||||
);
|
||||
$options['oldrevision'] = $options['oldrevision']->getRevisionRecord();
|
||||
}
|
||||
|
||||
$options += [
|
||||
'causeAction' => 'edit-page',
|
||||
|
|
|
|||
Loading…
Reference in a new issue