* @ingroup Ajax
*/
+use MediaWiki\MediaWikiServices;
+
/**
* @defgroup Ajax Ajax
*/
}
// Make sure DB commit succeeds before sending a response
- wfGetLBFactory()->commitMasterChanges( __METHOD__ );
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+ $lbFactory->commitMasterChanges( __METHOD__ );
$result->sendHeaders();
$result->printText();
$dbw->endAtomic( __METHOD__ );
} else {
// Page deleted but file still there? rollback page delete
- wfGetLBFactory()->rollbackMasterChanges( __METHOD__ );
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+ $lbFactory->rollbackMasterChanges( __METHOD__ );
}
} else {
// Done; nothing changed
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
use MediaWiki\Linker\LinkTarget;
+use MediaWiki\MediaWikiServices;
use Wikimedia\Assert\Assert;
use Wikimedia\ScopedCallback;
global $wgUpdateRowsPerQuery;
$dbw = $this->getConnectionRef( DB_MASTER );
- $factory = wfGetLBFactory();
+ $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
$watchersChunks = array_chunk( $watchers, $wgUpdateRowsPerQuery );
* @author Aaron Schulz
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Version of FileJournal that logs to a DB table
* @since 1.20
protected function getMasterDB() {
if ( !$this->dbw ) {
// Get a separate connection in autocommit mode
- $lb = wfGetLBFactory()->newMainLB();
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->newMainLB();
$this->dbw = $lb->getConnection( DB_MASTER, [], $this->wiki );
$this->dbw->clearFlag( DBO_TRX );
}
* @file
* @ingroup Deployment
*/
+use MediaWiki\MediaWikiServices;
/**
* Mysql update list and mysql-specific update functions.
foreach ( $res as $row ) {
$count = ( $count + 1 ) % 100;
if ( $count == 0 ) {
- wfGetLBFactory()->waitForReplication( [ 'wiki' => wfWikiID() ] );
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+ $lbFactory->waitForReplication( [ 'wiki' => wfWikiID() ] );
}
$this->db->insert( 'templatelinks',
[
* @ingroup Cache
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Job to purge the cache for all pages that link to or use another page or file
*
$touchTimestamp = wfTimestampNow();
$dbw = wfGetDB( DB_MASTER );
- $factory = wfGetLBFactory();
+ $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$ticket = $factory->getEmptyTransactionTicket( __METHOD__ );
// Update page_touched (skipping pages already touched since the root job).
// Check $wgUpdateRowsPerQuery for sanity; batch jobs are sized by that already.
* @ingroup RevisionDelete
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Abstract base class for a list of deletable items. The list class
* needs to be able to make a query from a set of identifiers to pull
$status->merge( $this->doPreCommitUpdates() );
if ( !$status->isOK() ) {
// Fatal error, such as no configured archive directory or I/O failures
- wfGetLBFactory()->rollbackMasterChanges( __METHOD__ );
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+ $lbFactory->rollbackMasterChanges( __METHOD__ );
return $status;
}
* @ingroup SpecialPage
*/
+use Mediawiki\MediaWikiServices;
+
/**
* A special page that allows users to export pages in a XML file
*
$buffer = WikiExporter::BUFFER;
} else {
// Use an unbuffered query; histories may be very long!
- $lb = wfGetLBFactory()->newMainLB();
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->newMainLB();
$db = $lb->getConnection( DB_REPLICA );
$buffer = WikiExporter::STREAM;