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