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