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