Page MenuHomePhabricator

PageIdentity::getId needs to support reading from DB_PRIMARY for compat with Title::getArticleID
Open, Needs TriagePublic

Description

Title::getArticleID() has a $flags parameter, which can be set to Title::GAID_FOR_UPDATE (or various equivalents) to make sure the up-to-date ID is actually retrieved. Presumably PageIdentity::getId should support an equivalent feature, in case the page was created just now.

What should this look like? If the $flags parameter is only used for one flag, perhaps a getIdForUpdate() method would be better than adding a parameter, but with PHP 8's named function parameters on the horizon, perhaps a boolean parameter isn't so bad.

Event Timeline

There's a bit of work to be done beforehand, but this will be done via 'PageStore::reloadWithQueryFlags' method. We need to make PageStore use LinkCache first https://gerrit.wikimedia.org/r/c/mediawiki/core/+/697656, then make it track the query flags used for fetching staff.

For now you can use PageStore::getPageByReference if READ_LATEST is used.