if ( is_int( $from ) ) {
list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from );
- $data = $this->pageDataFromTitle( wfGetDB( $index ), $this->mTitle, $opts );
$loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
+ $db = $loadBalancer->getConnection( $index );
+ $data = $this->pageDataFromTitle( $db, $this->mTitle, $opts );
if ( !$data
&& $index == DB_REPLICA
) {
$from = self::READ_LATEST;
list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from );
- $data = $this->pageDataFromTitle( wfGetDB( $index ), $this->mTitle, $opts );
+ $db = $loadBalancer->getConnection( $index );
+ $data = $this->pageDataFromTitle( $db, $this->mTitle, $opts );
}
} else {
// No idea from where the caller got this data, assume replica DB.
) {
$baseRevId = null;
if ( $edittime && $sectionId !== 'new' ) {
- $dbr = wfGetDB( DB_REPLICA );
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
+ $dbr = $lb->getConnection( DB_REPLICA );
$rev = Revision::loadFromTimestamp( $dbr, $this->mTitle, $edittime );
// Try the master if this thread may have just added it.
// This could be abstracted into a Revision method, but we don't want
// to encourage loading of revisions by timestamp.
if ( !$rev
- && wfGetLB()->getServerCount() > 1
- && wfGetLB()->hasOrMadeRecentMasterChanges()
+ && $lb->getServerCount() > 1
+ && $lb->hasOrMadeRecentMasterChanges()
) {
- $dbw = wfGetDB( DB_MASTER );
+ $dbw = $lb->getConnection( DB_MASTER );
$rev = Revision::loadFromTimestamp( $dbw, $this->mTitle, $edittime );
}
if ( $rev ) {
$edit->newContent = $content;
$edit->oldContent = $this->getContent( Revision::RAW );
- // NOTE: B/C for hooks! don't use these fields!
- $edit->newText = $edit->newContent
- ? ContentHandler::getContentText( $edit->newContent )
- : '';
- $edit->oldText = $edit->oldContent
- ? ContentHandler::getContentText( $edit->oldContent )
- : '';
- $edit->pst = $edit->pstContent ? $edit->pstContent->serialize( $serialFormat ) : '';
-
if ( $edit->output ) {
$edit->output->setCacheTime( wfTimestampNow() );
}
$cascade = false;
if ( $limit['create'] != '' ) {
- $commentFields = CommentStore::newKey( 'pt_reason' )->insert( $dbw, $reason );
+ $commentFields = CommentStore::getStore()->insert( $dbw, 'pt_reason', $reason );
$dbw->replace( 'protected_titles',
[ [ 'pt_namespace', 'pt_title' ] ],
[
$content = null;
}
- $revCommentStore = new CommentStore( 'rev_comment' );
- $arCommentStore = new CommentStore( 'ar_comment' );
+ $commentStore = CommentStore::getStore();
$revQuery = Revision::getQueryInfo();
$bitfield = false;
$ipRevIds = [];
foreach ( $res as $row ) {
- $comment = $revCommentStore->getComment( $row );
+ $comment = $commentStore->getComment( 'rev_comment', $row );
$rowInsert = [
'ar_namespace' => $namespace,
'ar_title' => $dbKey,
'ar_page_id' => $id,
'ar_deleted' => $suppress ? $bitfield : $row->rev_deleted,
'ar_sha1' => $row->rev_sha1,
- ] + $arCommentStore->insert( $dbw, $comment );
+ ] + $commentStore->insert( $dbw, 'ar_comment', $comment );
if ( $wgContentHandlerUseDB ) {
$rowInsert['ar_content_model'] = $row->rev_content_model;
$rowInsert['ar_content_format'] = $row->rev_content_format;
*/
public static function onArticleDelete( Title $title ) {
// Update existence markers on article/talk tabs...
+ // Clear Backlink cache first so that purge jobs use more up-to-date backlink information
+ BacklinkCache::get( $title )->clear();
$other = $title->getOtherPage();
$other->purgeSquid();