mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 23:25:02 +00:00
9236575a1a
* Uses BagOfStuff caching instead of custom-made DB cache * By configuring the BagOfStuff cache in a way that it writes to the database no performance implications are expected * For WMF-use this should have no effect since restbase is used to cache stuff * Replaces Ib2c216f54e6817ee2c3be0355ba72bd4769ba6ea Bug: T349442 Change-Id: I1ce8ad9cf4c1a9ae71f447e4e067b39ee2601640
60 lines
2.1 KiB
PHP
60 lines
2.1 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Config\ServiceOptions;
|
|
use MediaWiki\Extension\Math\InputCheck\InputCheckFactory;
|
|
use MediaWiki\Extension\Math\Math;
|
|
use MediaWiki\Extension\Math\MathConfig;
|
|
use MediaWiki\Extension\Math\MathFormatter;
|
|
use MediaWiki\Extension\Math\MathWikibaseConnector;
|
|
use MediaWiki\Extension\Math\Render\RendererFactory;
|
|
use MediaWiki\Logger\LoggerFactory;
|
|
use MediaWiki\MediaWikiServices;
|
|
use Wikibase\Client\WikibaseClient;
|
|
use Wikibase\Lib\Formatters\SnakFormatter;
|
|
|
|
return [
|
|
'Math.CheckerFactory' => static function ( MediaWikiServices $services ): InputCheckFactory {
|
|
return new InputCheckFactory(
|
|
new ServiceOptions(
|
|
InputCheckFactory::CONSTRUCTOR_OPTIONS,
|
|
$services->getMainConfig()
|
|
),
|
|
$services->getMainWANObjectCache(),
|
|
$services->getHttpRequestFactory(),
|
|
LoggerFactory::getInstance( 'Math' )
|
|
);
|
|
},
|
|
'Math.Config' => static function ( MediaWikiServices $services ): MathConfig {
|
|
return new MathConfig(
|
|
new ServiceOptions( MathConfig::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
|
|
ExtensionRegistry::getInstance()
|
|
);
|
|
},
|
|
'Math.RendererFactory' => static function ( MediaWikiServices $services ): RendererFactory {
|
|
return new RendererFactory(
|
|
new ServiceOptions(
|
|
RendererFactory::CONSTRUCTOR_OPTIONS,
|
|
$services->getMainConfig()
|
|
),
|
|
Math::getMathConfig( $services ),
|
|
$services->getUserOptionsLookup(),
|
|
LoggerFactory::getInstance( 'Math' ),
|
|
$services->getMainWANObjectCache()
|
|
);
|
|
},
|
|
'Math.WikibaseConnector' => static function ( MediaWikiServices $services ): MathWikibaseConnector {
|
|
return new MathWikibaseConnector(
|
|
new ServiceOptions( MathWikibaseConnector::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ),
|
|
WikibaseClient::getRepoLinker( $services ),
|
|
$services->getLanguageFactory(),
|
|
$services->getLanguageNameUtils(),
|
|
WikibaseClient::getEntityRevisionLookup( $services ),
|
|
WikibaseClient::getFallbackLabelDescriptionLookupFactory( $services ),
|
|
WikibaseClient::getSite( $services ),
|
|
WikibaseClient::getEntityIdParser( $services ),
|
|
new MathFormatter( SnakFormatter::FORMAT_HTML ),
|
|
LoggerFactory::getInstance( 'Math' )
|
|
);
|
|
}
|
|
];
|