CategoryMembershipChange: Don't call Revision::getTimestamp

Check if a Revision object was passed before calling ::getTimestamp

Bug: T254966
Change-Id: Ibd7330e9de5052b99ed7168d59a14c2990f2c185
This commit is contained in:
DannyS712 2020-06-10 05:42:05 +00:00
parent f8cc519222
commit 3c811b5e3d

View file

@ -69,19 +69,18 @@ class CategoryMembershipChange {
*/
public function __construct( Title $pageTitle, $revision = null ) {
$this->pageTitle = $pageTitle;
if ( $revision === null ) {
$this->timestamp = wfTimestampNow();
} else {
$this->timestamp = $revision->getTimestamp();
}
if ( $revision instanceof Revision ) {
wfDeprecated(
'Revision for ' . __METHOD__,
'1.35'
);
$this->revision = $revision->getRevisionRecord();
$revision = $revision->getRevisionRecord();
}
$this->revision = $revision;
if ( $revision === null ) {
$this->timestamp = wfTimestampNow();
} else {
$this->revision = $revision;
$this->timestamp = $revision->getTimestamp();
}
$this->newForCategorizationCallback = [ RecentChange::class, 'newForCategorization' ];
}