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