Page MenuHomePhabricator

MovePage::moveToInternal() should use Title::getArticleId() not Title::exists()
Closed, ResolvedPublic

Description

moveToInternal() is a private, internal function whose code, in part, decides whether or not to delete the destination page before moving another page over it.

To make this decision, it uses Title::exists() which, in turn, checks if getArticleId() returns 0 (in which case it would false) but then also allows extensions to override this return value via the TitleExists hook.

Since the next step for MovePage::moveToInternal() is to call WikiPage::doDeleteArticleReal(), it should be more direct about determining if there is actually a database record for the page.

Event Timeline

MarkAHershberger renamed this task from MovePage::moveToInternal() should use Title::getId() not Title::exists() to MovePage::moveToInternal() should use Title::getArticleId() not Title::exists().Oct 15 2020, 8:46 PM
MarkAHershberger updated the task description. (Show Details)

Change 634341 had a related patch set uploaded (by MarkAHershberger; owner: MarkAHershberger):
[mediawiki/core@master] Use Title::getArticleID instead of Title::exists for internal check

https://gerrit.wikimedia.org/r/634341

Change 634341 merged by jenkins-bot:
[mediawiki/core@master] Use Title::getArticleID instead of Title::exists for internal check

https://gerrit.wikimedia.org/r/634341