These callers just need to load some data from DB_MASTER.
Subsequent code needing that latest title data should also use the
required flags, rather than relying on flakey global cache state.
Change-Id: I53248ea4b5bf1cd953f956c41b8244831ec5ef04
$mp = new MovePage( $oldSubpage, $newSubpage );
$method = $checkPermissions ? 'moveIfAllowed' : 'move';
+ /** @var Status $status */
$status = $mp->$method( $user, $reason, $createRedirect, $changeTags );
if ( $status->isOK() ) {
$status->setResult( true, $newSubpage->getPrefixedText() );
Hooks::run( 'TitleMoveStarting', [ $this->oldTitle, $this->newTitle, $user ] );
- $pageid = $this->oldTitle->getArticleID( Title::GAID_FOR_UPDATE );
+ $pageid = $this->oldTitle->getArticleID( Title::READ_LATEST );
$protected = $this->oldTitle->isProtected();
// Do the actual move; if this fails, it will throw an MWException(!)
$comment = CommentStoreComment::newUnsavedComment( $summary, null );
- $title = Title::newFromID( $pageId, Title::GAID_FOR_UPDATE );
+ $title = Title::newFromID( $pageId, Title::READ_LATEST );
if ( $title === null ) {
return null;
}
$canUseTitleNewFromId = ( $pageId !== null && $pageId > 0 && $this->dbDomain === false );
list( $dbMode, $dbOptions ) = DBAccessObjectUtils::getDBOptions( $queryFlags );
- $titleFlags = ( $dbMode == DB_MASTER ? Title::GAID_FOR_UPDATE : 0 );
// Loading by ID is best, but Title::newFromID does not support that for foreign IDs.
if ( $canUseTitleNewFromId ) {
+ $titleFlags = ( $dbMode == DB_MASTER ? Title::READ_LATEST : 0 );
// TODO: better foreign title handling (introduce TitleFactory)
$title = Title::newFromID( $pageId, $titleFlags );
if ( $title ) {
$titles = $pageSet->getGoodTitles();
$title = reset( $titles );
if ( $title ) {
- $revid = $title->getNextRevisionID( $params['newerthanrevid'], Title::GAID_FOR_UPDATE );
+ $revid = $title->getNextRevisionID( $params['newerthanrevid'], Title::READ_LATEST );
if ( $revid ) {
$timestamp = $dbw->timestamp(
MediaWikiServices::getInstance()->getRevisionStore()->getTimestampFromId( $title, $revid )
*
* @param bool|null $update
* @return bool
+ * @deprecated Since 1.34
*/
public function forUpdate( $update = null ) {
return wfSetVar( $this->mForUpdate, $update );
if ( !$this->mId ) {
// NOTE: subclasses may initialize mId before calling this constructor!
- $this->mId = $title->getArticleID( Title::GAID_FOR_UPDATE );
+ $this->mId = $title->getArticleID( Title::READ_LATEST );
}
if ( !$this->mId ) {
$title = $page->getTitle();
// Get the latest ID since acquirePageLock() in runForTitle() flushed the transaction.
// This is used to detect edits/moves after loadPageData() but before the scope lock.
- // The works around the chicken/egg problem of determining the scope lock key name.
- $latest = $title->getLatestRevID( Title::GAID_FOR_UPDATE );
+ // The works around the chicken/egg problem of determining the scope lock key name
+ $latest = $title->getLatestRevID( Title::READ_LATEST );
$triggeringRevisionId = $this->params['triggeringRevisionId'] ?? null;
if ( $triggeringRevisionId && $triggeringRevisionId !== $latest ) {
// Try using the replica DB first, then try the master
$rev = $this->mTitle->getFirstRevision();
if ( !$rev ) {
- $rev = $this->mTitle->getFirstRevision( Title::GAID_FOR_UPDATE );
+ $rev = $this->mTitle->getFirstRevision( Title::READ_LATEST );
}
return $rev;
}
// If there is a new, unseen, revision, use its timestamp
$nextid = $oldid
- ? $title->getNextRevisionID( $oldid, Title::GAID_FOR_UPDATE )
+ ? $title->getNextRevisionID( $oldid, Title::READ_LATEST )
: null;
if ( $nextid ) {
$this->setNewtalk( true, Revision::newFromId( $nextid ) );
* @param Title $title
*/
protected function moveInconsistentPage( $row, Title $title ) {
- if ( $title->exists( Title::GAID_FOR_UPDATE )
+ if ( $title->exists( Title::READ_LATEST )
|| $title->getInterwiki()
|| !$title->canExist()
) {
$this->assertEquals(
false,
$title->exists(),
- 'exists() should rely on link cache unless GAID_FOR_UPDATE is used'
+ 'exists() should rely on link cache unless READ_LATEST is used'
);
$this->assertEquals(
true,
- $title->exists( Title::GAID_FOR_UPDATE ),
- 'exists() should re-query database when GAID_FOR_UPDATE is used'
+ $title->exists( Title::READ_LATEST ),
+ 'exists() should re-query database when READ_LATEST is used'
);
}
$jobs->loadParamsAndArgs( null, [ 'quiet' => true ], null );
$jobs->execute();
- $this->assertFalse( Title::newFromText( $name )->exists( Title::GAID_FOR_UPDATE ) );
+ $this->assertFalse( Title::newFromText( $name )->exists( Title::READ_LATEST ) );
}
public function testDeleteNonexistent() {
// Make a few edits for us to play with
for ( $i = 1; $i <= 5; $i++ ) {
self::editPage( self::$page, MWCryptRand::generateHex( 10 ), 'summary' );
- $this->revs[] = Title::newFromText( self::$page )
- ->getLatestRevID( Title::GAID_FOR_UPDATE );
+ $this->revs[] = Title::newFromText( self::$page )->getLatestRevID( Title::READ_LATEST );
}
}