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