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