*/
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
/**
* Prepare an edit in shared cache so that it can be reused on edit
$this->dieUsage( 'Unsupported content model/format', 'badmodelformat' );
}
+ $text = null;
+ $textHash = null;
if ( strlen( $params['stashedtexthash'] ) ) {
// Load from cache since the client indicates the text is the same as last stash
$textHash = $params['stashedtexthash'];
$cache->set( $textKey, $text, self::MAX_CACHE_TTL );
}
- $this->getStats()->increment( "editstash.cache_stores.$status" );
+ $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
+ $stats->increment( "editstash.cache_stores.$status" );
$this->getResult()->addValue(
null,
// De-duplicate requests on the same key
return self::ERROR_BUSY;
}
+ /** @noinspection PhpUnusedLocalVariableInspection */
$unlocker = new ScopedCallback( function () use ( $dbw, $key ) {
$dbw->unlock( $key, __METHOD__ );
} );
$cache = ObjectCache::getLocalClusterInstance();
$logger = LoggerFactory::getInstance( 'StashEdit' );
- $stats = RequestContext::getMain()->getStats();
+ $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
$key = self::getStashKey( $title, self::getContentHash( $content ), $user );
$editInfo = $cache->get( $key );
// so as to use its results and make use of the time spent parsing.
// Skip this logic if there no master connection in case this method
// is called on an HTTP GET request for some reason.
- $lb = wfGetLB();
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
$dbw = $lb->getAnyOpenConnection( $lb->getWriterIndex() );
if ( $dbw && $dbw->lock( $key, __METHOD__, 30 ) ) {
$editInfo = $cache->get( $key );