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