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