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