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