Add ObjectFactory as a service
[lhc/web/wiklou.git] / includes / MediaWikiServices.php
1 <?php
2
3 namespace MediaWiki;
4
5 use ActorMigration;
6 use CommentStore;
7 use Config;
8 use ConfigFactory;
9 use CryptHKDF;
10 use DateFormatterFactory;
11 use EventRelayerGroup;
12 use GenderCache;
13 use GlobalVarConfig;
14 use Hooks;
15 use IBufferingStatsdDataFactory;
16 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
17 use LocalisationCache;
18 use MediaWiki\Block\BlockManager;
19 use MediaWiki\Block\BlockRestrictionStore;
20 use MediaWiki\FileBackend\FSFile\TempFSFileFactory;
21 use MediaWiki\Http\HttpRequestFactory;
22 use MediaWiki\Page\MovePageFactory;
23 use MediaWiki\Permissions\PermissionManager;
24 use MediaWiki\Preferences\PreferencesFactory;
25 use MediaWiki\Revision\RevisionRenderer;
26 use MediaWiki\Revision\SlotRoleRegistry;
27 use MediaWiki\Shell\CommandFactory;
28 use MediaWiki\Special\SpecialPageFactory;
29 use MediaWiki\Storage\BlobStore;
30 use MediaWiki\Storage\BlobStoreFactory;
31 use MediaWiki\Storage\NameTableStore;
32 use MediaWiki\Storage\NameTableStoreFactory;
33 use MediaWiki\Revision\RevisionFactory;
34 use MediaWiki\Revision\RevisionLookup;
35 use MediaWiki\Revision\RevisionStore;
36 use OldRevisionImporter;
37 use MediaWiki\Revision\RevisionStoreFactory;
38 use UploadRevisionImporter;
39 use Wikimedia\Rdbms\ILoadBalancer;
40 use LinkCache;
41 use MediaHandlerFactory;
42 use MediaWiki\Config\ConfigRepository;
43 use MediaWiki\Linker\LinkRenderer;
44 use MediaWiki\Linker\LinkRendererFactory;
45 use MWException;
46 use MessageCache;
47 use MimeAnalyzer;
48 use NamespaceInfo;
49 use ObjectCache;
50 use Parser;
51 use ParserCache;
52 use ParserFactory;
53 use PasswordFactory;
54 use ProxyLookup;
55 use RepoGroup;
56 use ResourceLoader;
57 use SearchEngine;
58 use SearchEngineConfig;
59 use SearchEngineFactory;
60 use SiteLookup;
61 use SiteStore;
62 use WatchedItemStoreInterface;
63 use WatchedItemQueryService;
64 use SkinFactory;
65 use TitleFormatter;
66 use TitleParser;
67 use VirtualRESTServiceClient;
68 use Wikimedia\ObjectFactory;
69 use Wikimedia\Rdbms\LBFactory;
70 use Wikimedia\Services\SalvageableService;
71 use Wikimedia\Services\ServiceContainer;
72 use Wikimedia\Services\NoSuchServiceException;
73 use MediaWiki\Interwiki\InterwikiLookup;
74 use MagicWordFactory;
75 use MediaWiki\Storage\PageEditStash;
76
77 /**
78 * Service locator for MediaWiki core services.
79 *
80 * This program is free software; you can redistribute it and/or modify
81 * it under the terms of the GNU General Public License as published by
82 * the Free Software Foundation; either version 2 of the License, or
83 * (at your option) any later version.
84 *
85 * This program is distributed in the hope that it will be useful,
86 * but WITHOUT ANY WARRANTY; without even the implied warranty of
87 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88 * GNU General Public License for more details.
89 *
90 * You should have received a copy of the GNU General Public License along
91 * with this program; if not, write to the Free Software Foundation, Inc.,
92 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
93 * http://www.gnu.org/copyleft/gpl.html
94 *
95 * @file
96 *
97 * @since 1.27
98 */
99
100 /**
101 * MediaWikiServices is the service locator for the application scope of MediaWiki.
102 * Its implemented as a simple configurable DI container.
103 * MediaWikiServices acts as a top level factory/registry for top level services, and builds
104 * the network of service objects that defines MediaWiki's application logic.
105 * It acts as an entry point to MediaWiki's dependency injection mechanism.
106 *
107 * Services are defined in the "wiring" array passed to the constructor,
108 * or by calling defineService().
109 *
110 * @see docs/injection.txt for an overview of using dependency injection in the
111 * MediaWiki code base.
112 */
113 class MediaWikiServices extends ServiceContainer {
114
115 /**
116 * @var MediaWikiServices|null
117 */
118 private static $instance = null;
119
120 /**
121 * Returns the global default instance of the top level service locator.
122 *
123 * @since 1.27
124 *
125 * The default instance is initialized using the service instantiator functions
126 * defined in ServiceWiring.php.
127 *
128 * @note This should only be called by static functions! The instance returned here
129 * should not be passed around! Objects that need access to a service should have
130 * that service injected into the constructor, never a service locator!
131 *
132 * @return MediaWikiServices
133 */
134 public static function getInstance() {
135 if ( self::$instance === null ) {
136 // NOTE: constructing GlobalVarConfig here is not particularly pretty,
137 // but some information from the global scope has to be injected here,
138 // even if it's just a file name or database credentials to load
139 // configuration from.
140 $bootstrapConfig = new GlobalVarConfig();
141 self::$instance = self::newInstance( $bootstrapConfig, 'load' );
142 }
143
144 return self::$instance;
145 }
146
147 /**
148 * Replaces the global MediaWikiServices instance.
149 *
150 * @since 1.28
151 *
152 * @note This is for use in PHPUnit tests only!
153 *
154 * @throws MWException if called outside of PHPUnit tests.
155 *
156 * @param MediaWikiServices $services The new MediaWikiServices object.
157 *
158 * @return MediaWikiServices The old MediaWikiServices object, so it can be restored later.
159 */
160 public static function forceGlobalInstance( MediaWikiServices $services ) {
161 if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
162 throw new MWException( __METHOD__ . ' must not be used outside unit tests.' );
163 }
164
165 $old = self::getInstance();
166 self::$instance = $services;
167
168 return $old;
169 }
170
171 /**
172 * Creates a new instance of MediaWikiServices and sets it as the global default
173 * instance. getInstance() will return a different MediaWikiServices object
174 * after every call to resetGlobalInstance().
175 *
176 * @since 1.28
177 *
178 * @warning This should not be used during normal operation. It is intended for use
179 * when the configuration has changed significantly since bootstrap time, e.g.
180 * during the installation process or during testing.
181 *
182 * @warning Calling resetGlobalInstance() may leave the application in an inconsistent
183 * state. Calling this is only safe under the ASSUMPTION that NO REFERENCE to
184 * any of the services managed by MediaWikiServices exist. If any service objects
185 * managed by the old MediaWikiServices instance remain in use, they may INTERFERE
186 * with the operation of the services managed by the new MediaWikiServices.
187 * Operating with a mix of services created by the old and the new
188 * MediaWikiServices instance may lead to INCONSISTENCIES and even DATA LOSS!
189 * Any class implementing LAZY LOADING is especially prone to this problem,
190 * since instances would typically retain a reference to a storage layer service.
191 *
192 * @see forceGlobalInstance()
193 * @see resetGlobalInstance()
194 * @see resetBetweenTest()
195 *
196 * @param Config|null $bootstrapConfig The Config object to be registered as the
197 * 'BootstrapConfig' service. This has to contain at least the information
198 * needed to set up the 'ConfigFactory' service. If not given, the bootstrap
199 * config of the old instance of MediaWikiServices will be re-used. If there
200 * was no previous instance, a new GlobalVarConfig object will be used to
201 * bootstrap the services.
202 *
203 * @param string $quick Set this to "quick" to allow expensive resources to be re-used.
204 * See SalvageableService for details.
205 *
206 * @throws MWException If called after MW_SERVICE_BOOTSTRAP_COMPLETE has been defined in
207 * Setup.php (unless MW_PHPUNIT_TEST or MEDIAWIKI_INSTALL or RUN_MAINTENANCE_IF_MAIN
208 * is defined).
209 */
210 public static function resetGlobalInstance( Config $bootstrapConfig = null, $quick = '' ) {
211 if ( self::$instance === null ) {
212 // no global instance yet, nothing to reset
213 return;
214 }
215
216 self::failIfResetNotAllowed( __METHOD__ );
217
218 if ( $bootstrapConfig === null ) {
219 $bootstrapConfig = self::$instance->getBootstrapConfig();
220 }
221
222 $oldInstance = self::$instance;
223
224 self::$instance = self::newInstance( $bootstrapConfig, 'load' );
225 self::$instance->importWiring( $oldInstance, [ 'BootstrapConfig' ] );
226
227 if ( $quick === 'quick' ) {
228 self::$instance->salvage( $oldInstance );
229 } else {
230 $oldInstance->destroy();
231 }
232 }
233
234 /** @noinspection PhpDocSignatureInspection */
235
236 /**
237 * Salvages the state of any salvageable service instances in $other.
238 *
239 * @note $other will have been destroyed when salvage() returns.
240 *
241 * @param MediaWikiServices $other
242 */
243 private function salvage( self $other ) {
244 foreach ( $this->getServiceNames() as $name ) {
245 // The service could be new in the new instance and not registered in the
246 // other instance (e.g. an extension that was loaded after the instantiation of
247 // the other instance. Skip this service in this case. See T143974
248 try {
249 $oldService = $other->peekService( $name );
250 } catch ( NoSuchServiceException $e ) {
251 continue;
252 }
253
254 if ( $oldService instanceof SalvageableService ) {
255 /** @var SalvageableService $newService */
256 $newService = $this->getService( $name );
257 $newService->salvage( $oldService );
258 }
259 }
260
261 $other->destroy();
262 }
263
264 /**
265 * Creates a new MediaWikiServices instance and initializes it according to the
266 * given $bootstrapConfig. In particular, all wiring files defined in the
267 * ServiceWiringFiles setting are loaded, and the MediaWikiServices hook is called.
268 *
269 * @param Config|null $bootstrapConfig The Config object to be registered as the
270 * 'BootstrapConfig' service.
271 *
272 * @param string $loadWiring set this to 'load' to load the wiring files specified
273 * in the 'ServiceWiringFiles' setting in $bootstrapConfig.
274 *
275 * @return MediaWikiServices
276 * @throws MWException
277 * @throws \FatalError
278 */
279 private static function newInstance( Config $bootstrapConfig, $loadWiring = '' ) {
280 $instance = new self( $bootstrapConfig );
281
282 // Load the default wiring from the specified files.
283 if ( $loadWiring === 'load' ) {
284 $wiringFiles = $bootstrapConfig->get( 'ServiceWiringFiles' );
285 $instance->loadWiringFiles( $wiringFiles );
286 }
287
288 // Provide a traditional hook point to allow extensions to configure services.
289 Hooks::run( 'MediaWikiServices', [ $instance ] );
290
291 return $instance;
292 }
293
294 /**
295 * Disables all storage layer services. After calling this, any attempt to access the
296 * storage layer will result in an error. Use resetGlobalInstance() to restore normal
297 * operation.
298 *
299 * @since 1.28
300 *
301 * @warning This is intended for extreme situations only and should never be used
302 * while serving normal web requests. Legitimate use cases for this method include
303 * the installation process. Test fixtures may also use this, if the fixture relies
304 * on globalState.
305 *
306 * @see resetGlobalInstance()
307 * @see resetChildProcessServices()
308 */
309 public static function disableStorageBackend() {
310 // TODO: also disable some Caches, JobQueues, etc
311 $destroy = [ 'DBLoadBalancer', 'DBLoadBalancerFactory' ];
312 $services = self::getInstance();
313
314 foreach ( $destroy as $name ) {
315 $services->disableService( $name );
316 }
317
318 ObjectCache::clear();
319 }
320
321 /**
322 * Resets any services that may have become stale after a child process
323 * returns from after pcntl_fork(). It's also safe, but generally unnecessary,
324 * to call this method from the parent process.
325 *
326 * @since 1.28
327 *
328 * @note This is intended for use in the context of process forking only!
329 *
330 * @see resetGlobalInstance()
331 * @see disableStorageBackend()
332 */
333 public static function resetChildProcessServices() {
334 // NOTE: for now, just reset everything. Since we don't know the interdependencies
335 // between services, we can't do this more selectively at this time.
336 self::resetGlobalInstance();
337
338 // Child, reseed because there is no bug in PHP:
339 // https://bugs.php.net/bug.php?id=42465
340 mt_srand( getmypid() );
341 }
342
343 /**
344 * Resets the given service for testing purposes.
345 *
346 * @since 1.28
347 *
348 * @warning This is generally unsafe! Other services may still retain references
349 * to the stale service instance, leading to failures and inconsistencies. Subclasses
350 * may use this method to reset specific services under specific instances, but
351 * it should not be exposed to application logic.
352 *
353 * @note With proper dependency injection used throughout the codebase, this method
354 * should not be needed. It is provided to allow tests that pollute global service
355 * instances to clean up.
356 *
357 * @param string $name
358 * @param bool $destroy Whether the service instance should be destroyed if it exists.
359 * When set to false, any existing service instance will effectively be detached
360 * from the container.
361 *
362 * @throws MWException if called outside of PHPUnit tests.
363 */
364 public function resetServiceForTesting( $name, $destroy = true ) {
365 if ( !defined( 'MW_PHPUNIT_TEST' ) && !defined( 'MW_PARSER_TEST' ) ) {
366 throw new MWException( 'resetServiceForTesting() must not be used outside unit tests.' );
367 }
368
369 $this->resetService( $name, $destroy );
370 }
371
372 /**
373 * Convenience method that throws an exception unless it is called during a phase in which
374 * resetting of global services is allowed. In general, services should not be reset
375 * individually, since that may introduce inconsistencies.
376 *
377 * @since 1.28
378 *
379 * This method will throw an exception if:
380 *
381 * - self::$resetInProgress is false (to allow all services to be reset together
382 * via resetGlobalInstance)
383 * - and MEDIAWIKI_INSTALL is not defined (to allow services to be reset during installation)
384 * - and MW_PHPUNIT_TEST is not defined (to allow services to be reset during testing)
385 *
386 * This method is intended to be used to safeguard against accidentally resetting
387 * global service instances that are not yet managed by MediaWikiServices. It is
388 * defined here in the MediaWikiServices services class to have a central place
389 * for managing service bootstrapping and resetting.
390 *
391 * @param string $method the name of the caller method, as given by __METHOD__.
392 *
393 * @throws MWException if called outside bootstrap mode.
394 *
395 * @see resetGlobalInstance()
396 * @see forceGlobalInstance()
397 * @see disableStorageBackend()
398 */
399 public static function failIfResetNotAllowed( $method ) {
400 if ( !defined( 'MW_PHPUNIT_TEST' )
401 && !defined( 'MW_PARSER_TEST' )
402 && !defined( 'MEDIAWIKI_INSTALL' )
403 && !defined( 'RUN_MAINTENANCE_IF_MAIN' )
404 && defined( 'MW_SERVICE_BOOTSTRAP_COMPLETE' )
405 ) {
406 throw new MWException( $method . ' may only be called during bootstrapping and unit tests!' );
407 }
408 }
409
410 /**
411 * @param Config $config The Config object to be registered as the 'BootstrapConfig' service.
412 * This has to contain at least the information needed to set up the 'ConfigFactory'
413 * service.
414 */
415 public function __construct( Config $config ) {
416 parent::__construct();
417
418 // Register the given Config object as the bootstrap config service.
419 $this->defineService( 'BootstrapConfig', function () use ( $config ) {
420 return $config;
421 } );
422 }
423
424 // CONVENIENCE GETTERS ////////////////////////////////////////////////////
425
426 /**
427 * @since 1.31
428 * @return ActorMigration
429 */
430 public function getActorMigration() {
431 return $this->getService( 'ActorMigration' );
432 }
433
434 /**
435 * @since 1.34
436 * @return BadFileLookup
437 */
438 public function getBadFileLookup() : BadFileLookup {
439 return $this->getService( 'BadFileLookup' );
440 }
441
442 /**
443 * @since 1.31
444 * @return BlobStore
445 */
446 public function getBlobStore() {
447 return $this->getService( '_SqlBlobStore' );
448 }
449
450 /**
451 * @since 1.31
452 * @return BlobStoreFactory
453 */
454 public function getBlobStoreFactory() {
455 return $this->getService( 'BlobStoreFactory' );
456 }
457
458 /**
459 * @since 1.34
460 * @return BlockManager
461 */
462 public function getBlockManager() : BlockManager {
463 return $this->getService( 'BlockManager' );
464 }
465
466 /**
467 * @since 1.33
468 * @return BlockRestrictionStore
469 */
470 public function getBlockRestrictionStore() : BlockRestrictionStore {
471 return $this->getService( 'BlockRestrictionStore' );
472 }
473
474 /**
475 * Returns the Config object containing the bootstrap configuration.
476 * Bootstrap configuration would typically include database credentials
477 * and other information that may be needed before the ConfigFactory
478 * service can be instantiated.
479 *
480 * @note This should only be used during bootstrapping, in particular
481 * when creating the MainConfig service. Application logic should
482 * use getMainConfig() to get a Config instances.
483 *
484 * @since 1.27
485 * @return Config
486 */
487 public function getBootstrapConfig() {
488 return $this->getService( 'BootstrapConfig' );
489 }
490
491 /**
492 * @since 1.32
493 * @return NameTableStore
494 */
495 public function getChangeTagDefStore() {
496 return $this->getService( 'NameTableStoreFactory' )->getChangeTagDef();
497 }
498
499 /**
500 * @since 1.31
501 * @return CommentStore
502 */
503 public function getCommentStore() {
504 return $this->getService( 'CommentStore' );
505 }
506
507 /**
508 * @since 1.27
509 * @return ConfigFactory
510 */
511 public function getConfigFactory() {
512 return $this->getService( 'ConfigFactory' );
513 }
514
515 /**
516 * @since 1.32
517 * @return ConfigRepository
518 */
519 public function getConfigRepository() {
520 return $this->getService( 'ConfigRepository' );
521 }
522
523 /**
524 * @since 1.29
525 * @return \ConfiguredReadOnlyMode
526 */
527 public function getConfiguredReadOnlyMode() {
528 return $this->getService( 'ConfiguredReadOnlyMode' );
529 }
530
531 /**
532 * @since 1.32
533 * @return \Language
534 */
535 public function getContentLanguage() {
536 return $this->getService( 'ContentLanguage' );
537 }
538
539 /**
540 * @since 1.31
541 * @return NameTableStore
542 */
543 public function getContentModelStore() {
544 return $this->getService( 'NameTableStoreFactory' )->getContentModels();
545 }
546
547 /**
548 * @since 1.28
549 * @return CryptHKDF
550 */
551 public function getCryptHKDF() {
552 return $this->getService( 'CryptHKDF' );
553 }
554
555 /**
556 * @since 1.33
557 * @return DateFormatterFactory
558 */
559 public function getDateFormatterFactory() {
560 return $this->getService( 'DateFormatterFactory' );
561 }
562
563 /**
564 * @since 1.28
565 * @return ILoadBalancer The main DB load balancer for the local wiki.
566 */
567 public function getDBLoadBalancer() {
568 return $this->getService( 'DBLoadBalancer' );
569 }
570
571 /**
572 * @since 1.28
573 * @return LBFactory
574 */
575 public function getDBLoadBalancerFactory() {
576 return $this->getService( 'DBLoadBalancerFactory' );
577 }
578
579 /**
580 * @since 1.27
581 * @return EventRelayerGroup
582 */
583 public function getEventRelayerGroup() {
584 return $this->getService( 'EventRelayerGroup' );
585 }
586
587 /**
588 * @since 1.34
589 * @return \ExternalStoreAccess
590 */
591 public function getExternalStoreAccess() {
592 return $this->getService( 'ExternalStoreAccess' );
593 }
594
595 /**
596 * @since 1.31
597 * @return \ExternalStoreFactory
598 */
599 public function getExternalStoreFactory() {
600 return $this->getService( 'ExternalStoreFactory' );
601 }
602
603 /**
604 * @since 1.28
605 * @return GenderCache
606 */
607 public function getGenderCache() {
608 return $this->getService( 'GenderCache' );
609 }
610
611 /**
612 * @since 1.31
613 * @return HttpRequestFactory
614 */
615 public function getHttpRequestFactory() {
616 return $this->getService( 'HttpRequestFactory' );
617 }
618
619 /**
620 * @since 1.28
621 * @return InterwikiLookup
622 */
623 public function getInterwikiLookup() {
624 return $this->getService( 'InterwikiLookup' );
625 }
626
627 /**
628 * @since 1.28
629 * @return LinkCache
630 */
631 public function getLinkCache() {
632 return $this->getService( 'LinkCache' );
633 }
634
635 /**
636 * LinkRenderer instance that can be used
637 * if no custom options are needed
638 *
639 * @since 1.28
640 * @return LinkRenderer
641 */
642 public function getLinkRenderer() {
643 return $this->getService( 'LinkRenderer' );
644 }
645
646 /**
647 * @since 1.28
648 * @return LinkRendererFactory
649 */
650 public function getLinkRendererFactory() {
651 return $this->getService( 'LinkRendererFactory' );
652 }
653
654 /**
655 * @since 1.34
656 * @return LocalisationCache
657 */
658 public function getLocalisationCache() : LocalisationCache {
659 return $this->getService( 'LocalisationCache' );
660 }
661
662 /**
663 * @since 1.28
664 * @return \BagOStuff
665 */
666 public function getLocalServerObjectCache() {
667 return $this->getService( 'LocalServerObjectCache' );
668 }
669
670 /**
671 * @since 1.32
672 * @return MagicWordFactory
673 */
674 public function getMagicWordFactory() {
675 return $this->getService( 'MagicWordFactory' );
676 }
677
678 /**
679 * Returns the Config object that provides configuration for MediaWiki core.
680 * This may or may not be the same object that is returned by getBootstrapConfig().
681 *
682 * @since 1.27
683 * @return Config
684 */
685 public function getMainConfig() {
686 return $this->getService( 'MainConfig' );
687 }
688
689 /**
690 * @since 1.28
691 * @return \BagOStuff
692 */
693 public function getMainObjectStash() {
694 return $this->getService( 'MainObjectStash' );
695 }
696
697 /**
698 * @since 1.28
699 * @return \WANObjectCache
700 */
701 public function getMainWANObjectCache() {
702 return $this->getService( 'MainWANObjectCache' );
703 }
704
705 /**
706 * @since 1.28
707 * @return MediaHandlerFactory
708 */
709 public function getMediaHandlerFactory() {
710 return $this->getService( 'MediaHandlerFactory' );
711 }
712
713 /**
714 * @since 1.34
715 * @return MessageCache
716 */
717 public function getMessageCache() : MessageCache {
718 return $this->getService( 'MessageCache' );
719 }
720
721 /**
722 * @since 1.28
723 * @return MimeAnalyzer
724 */
725 public function getMimeAnalyzer() {
726 return $this->getService( 'MimeAnalyzer' );
727 }
728
729 /**
730 * @since 1.34
731 * @return MovePageFactory
732 */
733 public function getMovePageFactory() : MovePageFactory {
734 return $this->getService( 'MovePageFactory' );
735 }
736
737 /**
738 * @since 1.34
739 * @return NamespaceInfo
740 */
741 public function getNamespaceInfo() : NamespaceInfo {
742 return $this->getService( 'NamespaceInfo' );
743 }
744
745 /**
746 * @since 1.32
747 * @return NameTableStoreFactory
748 */
749 public function getNameTableStoreFactory() {
750 return $this->getService( 'NameTableStoreFactory' );
751 }
752
753 /**
754 * ObjectFactory is intended for instantiating "handlers" from declarative definitions,
755 * such as Action API modules, special pages, or REST API handlers.
756 *
757 * @since 1.34
758 * @return ObjectFactory
759 */
760 public function getObjectFactory() {
761 return $this->getService( 'ObjectFactory' );
762 }
763
764 /**
765 * @since 1.32
766 * @return OldRevisionImporter
767 */
768 public function getOldRevisionImporter() {
769 return $this->getService( 'OldRevisionImporter' );
770 }
771
772 /**
773 * @return PageEditStash
774 * @since 1.34
775 */
776 public function getPageEditStash() {
777 return $this->getService( 'PageEditStash' );
778 }
779
780 /**
781 * @since 1.29
782 * @return Parser
783 */
784 public function getParser() {
785 return $this->getService( 'Parser' );
786 }
787
788 /**
789 * @since 1.30
790 * @return ParserCache
791 */
792 public function getParserCache() {
793 return $this->getService( 'ParserCache' );
794 }
795
796 /**
797 * @since 1.32
798 * @return ParserFactory
799 */
800 public function getParserFactory() {
801 return $this->getService( 'ParserFactory' );
802 }
803
804 /**
805 * @since 1.32
806 * @return PasswordFactory
807 */
808 public function getPasswordFactory() {
809 return $this->getService( 'PasswordFactory' );
810 }
811
812 /**
813 * @since 1.32
814 * @return StatsdDataFactoryInterface
815 */
816 public function getPerDbNameStatsdDataFactory() {
817 return $this->getService( 'PerDbNameStatsdDataFactory' );
818 }
819
820 /**
821 * @since 1.33
822 * @return PermissionManager
823 */
824 public function getPermissionManager() {
825 return $this->getService( 'PermissionManager' );
826 }
827
828 /**
829 * @since 1.31
830 * @return PreferencesFactory
831 */
832 public function getPreferencesFactory() {
833 return $this->getService( 'PreferencesFactory' );
834 }
835
836 /**
837 * @since 1.28
838 * @return ProxyLookup
839 */
840 public function getProxyLookup() {
841 return $this->getService( 'ProxyLookup' );
842 }
843
844 /**
845 * @since 1.29
846 * @return \ReadOnlyMode
847 */
848 public function getReadOnlyMode() {
849 return $this->getService( 'ReadOnlyMode' );
850 }
851
852 /**
853 * @since 1.34
854 * @return RepoGroup
855 */
856 public function getRepoGroup() : RepoGroup {
857 return $this->getService( 'RepoGroup' );
858 }
859
860 /**
861 * @since 1.33
862 * @return ResourceLoader
863 */
864 public function getResourceLoader() {
865 return $this->getService( 'ResourceLoader' );
866 }
867
868 /**
869 * @since 1.31
870 * @return RevisionFactory
871 */
872 public function getRevisionFactory() {
873 return $this->getService( 'RevisionFactory' );
874 }
875
876 /**
877 * @since 1.31
878 * @return RevisionLookup
879 */
880 public function getRevisionLookup() {
881 return $this->getService( 'RevisionLookup' );
882 }
883
884 /**
885 * @since 1.32
886 * @return RevisionRenderer
887 */
888 public function getRevisionRenderer() {
889 return $this->getService( 'RevisionRenderer' );
890 }
891
892 /**
893 * @since 1.31
894 * @return RevisionStore
895 */
896 public function getRevisionStore() {
897 return $this->getService( 'RevisionStore' );
898 }
899
900 /**
901 * @since 1.32
902 * @return RevisionStoreFactory
903 */
904 public function getRevisionStoreFactory() {
905 return $this->getService( 'RevisionStoreFactory' );
906 }
907
908 /**
909 * @since 1.27
910 * @return SearchEngine
911 */
912 public function newSearchEngine() {
913 // New engine object every time, since they keep state
914 return $this->getService( 'SearchEngineFactory' )->create();
915 }
916
917 /**
918 * @since 1.27
919 * @return SearchEngineConfig
920 */
921 public function getSearchEngineConfig() {
922 return $this->getService( 'SearchEngineConfig' );
923 }
924
925 /**
926 * @since 1.27
927 * @return SearchEngineFactory
928 */
929 public function getSearchEngineFactory() {
930 return $this->getService( 'SearchEngineFactory' );
931 }
932
933 /**
934 * @since 1.30
935 * @return CommandFactory
936 */
937 public function getShellCommandFactory() {
938 return $this->getService( 'ShellCommandFactory' );
939 }
940
941 /**
942 * @since 1.27
943 * @return SiteLookup
944 */
945 public function getSiteLookup() {
946 return $this->getService( 'SiteLookup' );
947 }
948
949 /**
950 * @since 1.27
951 * @return SiteStore
952 */
953 public function getSiteStore() {
954 return $this->getService( 'SiteStore' );
955 }
956
957 /**
958 * @since 1.27
959 * @return SkinFactory
960 */
961 public function getSkinFactory() {
962 return $this->getService( 'SkinFactory' );
963 }
964
965 /**
966 * @since 1.33
967 * @return SlotRoleRegistry
968 */
969 public function getSlotRoleRegistry() {
970 return $this->getService( 'SlotRoleRegistry' );
971 }
972
973 /**
974 * @since 1.31
975 * @return NameTableStore
976 */
977 public function getSlotRoleStore() {
978 return $this->getService( 'NameTableStoreFactory' )->getSlotRoles();
979 }
980
981 /**
982 * @since 1.32
983 * @return SpecialPageFactory
984 */
985 public function getSpecialPageFactory() : SpecialPageFactory {
986 return $this->getService( 'SpecialPageFactory' );
987 }
988
989 /**
990 * @since 1.27
991 * @return IBufferingStatsdDataFactory
992 */
993 public function getStatsdDataFactory() {
994 return $this->getService( 'StatsdDataFactory' );
995 }
996
997 /**
998 * @since 1.34
999 * @return TempFSFileFactory
1000 */
1001 public function getTempFSFileFactory() : TempFSFileFactory {
1002 return $this->getService( 'TempFSFileFactory' );
1003 }
1004
1005 /**
1006 * @since 1.28
1007 * @return TitleFormatter
1008 */
1009 public function getTitleFormatter() {
1010 return $this->getService( 'TitleFormatter' );
1011 }
1012
1013 /**
1014 * @since 1.28
1015 * @return TitleParser
1016 */
1017 public function getTitleParser() {
1018 return $this->getService( 'TitleParser' );
1019 }
1020
1021 /**
1022 * @since 1.32
1023 * @return UploadRevisionImporter
1024 */
1025 public function getUploadRevisionImporter() {
1026 return $this->getService( 'UploadRevisionImporter' );
1027 }
1028
1029 /**
1030 * @since 1.28
1031 * @return VirtualRESTServiceClient
1032 */
1033 public function getVirtualRESTServiceClient() {
1034 return $this->getService( 'VirtualRESTServiceClient' );
1035 }
1036
1037 /**
1038 * @since 1.28
1039 * @return WatchedItemQueryService
1040 */
1041 public function getWatchedItemQueryService() {
1042 return $this->getService( 'WatchedItemQueryService' );
1043 }
1044
1045 /**
1046 * @since 1.28
1047 * @return WatchedItemStoreInterface
1048 */
1049 public function getWatchedItemStore() {
1050 return $this->getService( 'WatchedItemStore' );
1051 }
1052
1053 /**
1054 * @since 1.31
1055 * @return \OldRevisionImporter
1056 */
1057 public function getWikiRevisionOldRevisionImporter() {
1058 return $this->getService( 'OldRevisionImporter' );
1059 }
1060
1061 /**
1062 * @since 1.31
1063 * @return \OldRevisionImporter
1064 */
1065 public function getWikiRevisionOldRevisionImporterNoUpdates() {
1066 return $this->getService( 'WikiRevisionOldRevisionImporterNoUpdates' );
1067 }
1068
1069 /**
1070 * @since 1.31
1071 * @return \UploadRevisionImporter
1072 */
1073 public function getWikiRevisionUploadImporter() {
1074 return $this->getService( 'UploadRevisionImporter' );
1075 }
1076
1077 }