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