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