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