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