8445842b9ed950ab2047f8ec10223c93083c8cae
[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\Page\MovePageFactory;
23 use MediaWiki\Permissions\PermissionManager;
24 use MediaWiki\Preferences\PreferencesFactory;
25 use MediaWiki\Revision\RevisionRenderer;
26 use MediaWiki\Revision\SlotRoleRegistry;
27 use MediaWiki\Shell\CommandFactory;
28 use MediaWiki\Special\SpecialPageFactory;
29 use MediaWiki\Storage\BlobStore;
30 use MediaWiki\Storage\BlobStoreFactory;
31 use MediaWiki\Storage\NameTableStore;
32 use MediaWiki\Storage\NameTableStoreFactory;
33 use MediaWiki\Revision\RevisionFactory;
34 use MediaWiki\Revision\RevisionLookup;
35 use MediaWiki\Revision\RevisionStore;
36 use OldRevisionImporter;
37 use MediaWiki\Revision\RevisionStoreFactory;
38 use UploadRevisionImporter;
39 use Wikimedia\Rdbms\ILoadBalancer;
40 use LinkCache;
41 use MediaHandlerFactory;
42 use MediaWiki\Config\ConfigRepository;
43 use MediaWiki\Linker\LinkRenderer;
44 use MediaWiki\Linker\LinkRendererFactory;
45 use MWException;
46 use MessageCache;
47 use MimeAnalyzer;
48 use NamespaceInfo;
49 use ObjectCache;
50 use Parser;
51 use ParserCache;
52 use ParserFactory;
53 use PasswordFactory;
54 use ProxyLookup;
55 use RepoGroup;
56 use ResourceLoader;
57 use SearchEngine;
58 use SearchEngineConfig;
59 use SearchEngineFactory;
60 use SiteLookup;
61 use SiteStore;
62 use WatchedItemStoreInterface;
63 use WatchedItemQueryService;
64 use SkinFactory;
65 use TitleFormatter;
66 use TitleParser;
67 use VirtualRESTServiceClient;
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.34
655 * @return LocalisationCache
656 */
657 public function getLocalisationCache() : LocalisationCache {
658 return $this->getService( 'LocalisationCache' );
659 }
660
661 /**
662 * @since 1.28
663 * @return \BagOStuff
664 */
665 public function getLocalServerObjectCache() {
666 return $this->getService( 'LocalServerObjectCache' );
667 }
668
669 /**
670 * @since 1.32
671 * @return MagicWordFactory
672 */
673 public function getMagicWordFactory() {
674 return $this->getService( 'MagicWordFactory' );
675 }
676
677 /**
678 * Returns the Config object that provides configuration for MediaWiki core.
679 * This may or may not be the same object that is returned by getBootstrapConfig().
680 *
681 * @since 1.27
682 * @return Config
683 */
684 public function getMainConfig() {
685 return $this->getService( 'MainConfig' );
686 }
687
688 /**
689 * @since 1.28
690 * @return \BagOStuff
691 */
692 public function getMainObjectStash() {
693 return $this->getService( 'MainObjectStash' );
694 }
695
696 /**
697 * @since 1.28
698 * @return \WANObjectCache
699 */
700 public function getMainWANObjectCache() {
701 return $this->getService( 'MainWANObjectCache' );
702 }
703
704 /**
705 * @since 1.28
706 * @return MediaHandlerFactory
707 */
708 public function getMediaHandlerFactory() {
709 return $this->getService( 'MediaHandlerFactory' );
710 }
711
712 /**
713 * @since 1.34
714 * @return MessageCache
715 */
716 public function getMessageCache() : MessageCache {
717 return $this->getService( 'MessageCache' );
718 }
719
720 /**
721 * @since 1.28
722 * @return MimeAnalyzer
723 */
724 public function getMimeAnalyzer() {
725 return $this->getService( 'MimeAnalyzer' );
726 }
727
728 /**
729 * @since 1.34
730 * @return MovePageFactory
731 */
732 public function getMovePageFactory() : MovePageFactory {
733 return $this->getService( 'MovePageFactory' );
734 }
735
736 /**
737 * @since 1.34
738 * @return NamespaceInfo
739 */
740 public function getNamespaceInfo() : NamespaceInfo {
741 return $this->getService( 'NamespaceInfo' );
742 }
743
744 /**
745 * @since 1.32
746 * @return NameTableStoreFactory
747 */
748 public function getNameTableStoreFactory() {
749 return $this->getService( 'NameTableStoreFactory' );
750 }
751
752 /**
753 * @since 1.32
754 * @return OldRevisionImporter
755 */
756 public function getOldRevisionImporter() {
757 return $this->getService( 'OldRevisionImporter' );
758 }
759
760 /**
761 * @return PageEditStash
762 * @since 1.34
763 */
764 public function getPageEditStash() {
765 return $this->getService( 'PageEditStash' );
766 }
767
768 /**
769 * @since 1.29
770 * @return Parser
771 */
772 public function getParser() {
773 return $this->getService( 'Parser' );
774 }
775
776 /**
777 * @since 1.30
778 * @return ParserCache
779 */
780 public function getParserCache() {
781 return $this->getService( 'ParserCache' );
782 }
783
784 /**
785 * @since 1.32
786 * @return ParserFactory
787 */
788 public function getParserFactory() {
789 return $this->getService( 'ParserFactory' );
790 }
791
792 /**
793 * @since 1.32
794 * @return PasswordFactory
795 */
796 public function getPasswordFactory() {
797 return $this->getService( 'PasswordFactory' );
798 }
799
800 /**
801 * @since 1.32
802 * @return StatsdDataFactoryInterface
803 */
804 public function getPerDbNameStatsdDataFactory() {
805 return $this->getService( 'PerDbNameStatsdDataFactory' );
806 }
807
808 /**
809 * @since 1.33
810 * @return PermissionManager
811 */
812 public function getPermissionManager() {
813 return $this->getService( 'PermissionManager' );
814 }
815
816 /**
817 * @since 1.31
818 * @return PreferencesFactory
819 */
820 public function getPreferencesFactory() {
821 return $this->getService( 'PreferencesFactory' );
822 }
823
824 /**
825 * @since 1.28
826 * @return ProxyLookup
827 */
828 public function getProxyLookup() {
829 return $this->getService( 'ProxyLookup' );
830 }
831
832 /**
833 * @since 1.29
834 * @return \ReadOnlyMode
835 */
836 public function getReadOnlyMode() {
837 return $this->getService( 'ReadOnlyMode' );
838 }
839
840 /**
841 * @since 1.34
842 * @return RepoGroup
843 */
844 public function getRepoGroup() : RepoGroup {
845 return $this->getService( 'RepoGroup' );
846 }
847
848 /**
849 * @since 1.33
850 * @return ResourceLoader
851 */
852 public function getResourceLoader() {
853 return $this->getService( 'ResourceLoader' );
854 }
855
856 /**
857 * @since 1.31
858 * @return RevisionFactory
859 */
860 public function getRevisionFactory() {
861 return $this->getService( 'RevisionFactory' );
862 }
863
864 /**
865 * @since 1.31
866 * @return RevisionLookup
867 */
868 public function getRevisionLookup() {
869 return $this->getService( 'RevisionLookup' );
870 }
871
872 /**
873 * @since 1.32
874 * @return RevisionRenderer
875 */
876 public function getRevisionRenderer() {
877 return $this->getService( 'RevisionRenderer' );
878 }
879
880 /**
881 * @since 1.31
882 * @return RevisionStore
883 */
884 public function getRevisionStore() {
885 return $this->getService( 'RevisionStore' );
886 }
887
888 /**
889 * @since 1.32
890 * @return RevisionStoreFactory
891 */
892 public function getRevisionStoreFactory() {
893 return $this->getService( 'RevisionStoreFactory' );
894 }
895
896 /**
897 * @since 1.27
898 * @return SearchEngine
899 */
900 public function newSearchEngine() {
901 // New engine object every time, since they keep state
902 return $this->getService( 'SearchEngineFactory' )->create();
903 }
904
905 /**
906 * @since 1.27
907 * @return SearchEngineConfig
908 */
909 public function getSearchEngineConfig() {
910 return $this->getService( 'SearchEngineConfig' );
911 }
912
913 /**
914 * @since 1.27
915 * @return SearchEngineFactory
916 */
917 public function getSearchEngineFactory() {
918 return $this->getService( 'SearchEngineFactory' );
919 }
920
921 /**
922 * @since 1.30
923 * @return CommandFactory
924 */
925 public function getShellCommandFactory() {
926 return $this->getService( 'ShellCommandFactory' );
927 }
928
929 /**
930 * @since 1.27
931 * @return SiteLookup
932 */
933 public function getSiteLookup() {
934 return $this->getService( 'SiteLookup' );
935 }
936
937 /**
938 * @since 1.27
939 * @return SiteStore
940 */
941 public function getSiteStore() {
942 return $this->getService( 'SiteStore' );
943 }
944
945 /**
946 * @since 1.27
947 * @return SkinFactory
948 */
949 public function getSkinFactory() {
950 return $this->getService( 'SkinFactory' );
951 }
952
953 /**
954 * @since 1.33
955 * @return SlotRoleRegistry
956 */
957 public function getSlotRoleRegistry() {
958 return $this->getService( 'SlotRoleRegistry' );
959 }
960
961 /**
962 * @since 1.31
963 * @return NameTableStore
964 */
965 public function getSlotRoleStore() {
966 return $this->getService( 'NameTableStoreFactory' )->getSlotRoles();
967 }
968
969 /**
970 * @since 1.32
971 * @return SpecialPageFactory
972 */
973 public function getSpecialPageFactory() : SpecialPageFactory {
974 return $this->getService( 'SpecialPageFactory' );
975 }
976
977 /**
978 * @since 1.27
979 * @return IBufferingStatsdDataFactory
980 */
981 public function getStatsdDataFactory() {
982 return $this->getService( 'StatsdDataFactory' );
983 }
984
985 /**
986 * @since 1.34
987 * @return TempFSFileFactory
988 */
989 public function getTempFSFileFactory() : TempFSFileFactory {
990 return $this->getService( 'TempFSFileFactory' );
991 }
992
993 /**
994 * @since 1.28
995 * @return TitleFormatter
996 */
997 public function getTitleFormatter() {
998 return $this->getService( 'TitleFormatter' );
999 }
1000
1001 /**
1002 * @since 1.28
1003 * @return TitleParser
1004 */
1005 public function getTitleParser() {
1006 return $this->getService( 'TitleParser' );
1007 }
1008
1009 /**
1010 * @since 1.32
1011 * @return UploadRevisionImporter
1012 */
1013 public function getUploadRevisionImporter() {
1014 return $this->getService( 'UploadRevisionImporter' );
1015 }
1016
1017 /**
1018 * @since 1.28
1019 * @return VirtualRESTServiceClient
1020 */
1021 public function getVirtualRESTServiceClient() {
1022 return $this->getService( 'VirtualRESTServiceClient' );
1023 }
1024
1025 /**
1026 * @since 1.28
1027 * @return WatchedItemQueryService
1028 */
1029 public function getWatchedItemQueryService() {
1030 return $this->getService( 'WatchedItemQueryService' );
1031 }
1032
1033 /**
1034 * @since 1.28
1035 * @return WatchedItemStoreInterface
1036 */
1037 public function getWatchedItemStore() {
1038 return $this->getService( 'WatchedItemStore' );
1039 }
1040
1041 /**
1042 * @since 1.31
1043 * @return \OldRevisionImporter
1044 */
1045 public function getWikiRevisionOldRevisionImporter() {
1046 return $this->getService( 'OldRevisionImporter' );
1047 }
1048
1049 /**
1050 * @since 1.31
1051 * @return \OldRevisionImporter
1052 */
1053 public function getWikiRevisionOldRevisionImporterNoUpdates() {
1054 return $this->getService( 'WikiRevisionOldRevisionImporterNoUpdates' );
1055 }
1056
1057 /**
1058 * @since 1.31
1059 * @return \UploadRevisionImporter
1060 */
1061 public function getWikiRevisionUploadImporter() {
1062 return $this->getService( 'UploadRevisionImporter' );
1063 }
1064
1065 }