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