Don't needlessly reset article ID

Title::resetArticleID() clears various caches and is meant for when a
page was inserted or moved or similar. I can't see any reason that it
needs to be called by Title::castFromPageIdentity. Doing so wastes
resources and prevents use of the method in unit tests. It is also
surprising for a cast to have side effects.

Change-Id: I71c523e7406d493c52199c3a5a9ca7cd414bb5eb
This commit is contained in:
Aryeh Gregor 2021-08-02 17:35:25 +03:00
parent c92ab13148
commit af97e72e76

View file

@ -387,7 +387,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
$title = self::makeTitle( $pageReference->getNamespace(), $pageReference->getDBkey() );
if ( $pageReference instanceof PageIdentity ) {
$title->resetArticleID( $pageReference->getId() );
$title->mArticleID = $pageReference->getId();
}
return $title;
}