MediaWiki  1.33.0
BlobStoreFactory.php
Go to the documentation of this file.
1 <?php
21 namespace MediaWiki\Storage;
22 
23 use Config;
27 
36 
40  private $lbFactory;
41 
45  private $cache;
46 
50  private $config;
51 
55  private $contLang;
56 
57  public function __construct(
60  Config $mainConfig,
62  ) {
63  $this->lbFactory = $lbFactory;
64  $this->cache = $cache;
65  $this->config = $mainConfig;
66  $this->contLang = $contLang;
67  }
68 
76  public function newBlobStore( $wikiId = false ) {
77  return $this->newSqlBlobStore( $wikiId );
78  }
79 
87  public function newSqlBlobStore( $wikiId = false ) {
88  $lb = $this->lbFactory->getMainLB( $wikiId );
89  $store = new SqlBlobStore(
90  $lb,
91  $this->cache,
92  $wikiId
93  );
94 
95  $store->setCompressBlobs( $this->config->get( 'CompressRevisions' ) );
96  $store->setCacheExpiry( $this->config->get( 'RevisionCacheExpiry' ) );
97  $store->setUseExternalStore( $this->config->get( 'DefaultExternalStore' ) !== false );
98 
99  if ( $this->config->get( 'LegacyEncoding' ) ) {
100  $store->setLegacyEncoding( $this->config->get( 'LegacyEncoding' ), $this->contLang );
101  }
102 
103  return $store;
104  }
105 
106 }
MediaWiki\Storage\BlobStoreFactory\$lbFactory
LBFactory $lbFactory
Definition: BlobStoreFactory.php:40
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
MediaWiki\Storage\SqlBlobStore
Service for storing and loading Content objects.
Definition: SqlBlobStore.php:49
MediaWiki\Storage\BlobStoreFactory\newSqlBlobStore
newSqlBlobStore( $wikiId=false)
Definition: BlobStoreFactory.php:87
cache
you have access to all of the normal MediaWiki so you can get a DB use the cache
Definition: maintenance.txt:52
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
Config
Interface for configuration instances.
Definition: Config.php:28
MediaWiki\Storage\BlobStoreFactory\$cache
WANObjectCache $cache
Definition: BlobStoreFactory.php:45
MediaWiki\Storage\BlobStoreFactory\__construct
__construct(LBFactory $lbFactory, WANObjectCache $cache, Config $mainConfig, Language $contLang)
Definition: BlobStoreFactory.php:57
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
MediaWiki\Storage\BlobStoreFactory
Service for instantiating BlobStores.
Definition: BlobStoreFactory.php:35
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:116
MediaWiki\Storage\BlobStoreFactory\newBlobStore
newBlobStore( $wikiId=false)
Definition: BlobStoreFactory.php:76
MediaWiki\Storage\BlobStoreFactory\$config
Config $config
Definition: BlobStoreFactory.php:50
MediaWiki\Storage
Definition: BlobAccessException.php:23
Wikimedia\Rdbms\LBFactory
An interface for generating database load balancers.
Definition: LBFactory.php:39
Language
Internationalisation code.
Definition: Language.php:36
MediaWiki\Storage\BlobStoreFactory\$contLang
Language $contLang
Definition: BlobStoreFactory.php:55