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