MediaWiki  REL1_31
BlobStoreFactory.php
Go to the documentation of this file.
1 <?php
21 namespace MediaWiki\Storage;
22 
23 use Config;
27 
36 
40  private $loadBalancer;
41 
45  private $cache;
46 
50  private $config;
51 
55  private $contLang;
56 
57  public function __construct(
60  Config $mainConfig,
62  ) {
63  $this->loadBalancer = $loadBalancer;
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  $store = new SqlBlobStore(
89  $this->loadBalancer,
90  $this->cache,
91  $wikiId
92  );
93 
94  $store->setCompressBlobs( $this->config->get( 'CompressRevisions' ) );
95  $store->setCacheExpiry( $this->config->get( 'RevisionCacheExpiry' ) );
96  $store->setUseExternalStore( $this->config->get( 'DefaultExternalStore' ) !== false );
97 
98  if ( $this->config->get( 'LegacyEncoding' ) ) {
99  $store->setLegacyEncoding( $this->config->get( 'LegacyEncoding' ), $this->contLang );
100  }
101 
102  return $store;
103  }
104 
105 }
use
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Definition: APACHE-LICENSE-2.0.txt:10
MediaWiki\Storage\BlobStoreFactory\__construct
__construct(LoadBalancer $loadBalancer, WANObjectCache $cache, Config $mainConfig, Language $contLang)
Definition: BlobStoreFactory.php:57
MediaWiki\Storage\SqlBlobStore
Service for storing and loading Content objects.
Definition: SqlBlobStore.php:50
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:55
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:37
Config
Interface for configuration instances.
Definition: Config.php:28
MediaWiki\Storage\BlobStoreFactory\$cache
WANObjectCache $cache
Definition: BlobStoreFactory.php:45
MediaWiki\Storage\BlobStoreFactory
Service for instantiating BlobStores.
Definition: BlobStoreFactory.php:35
Wikimedia\Rdbms\LoadBalancer
Database connection, tracking, load balancing, and transaction manager for a cluster.
Definition: LoadBalancer.php:41
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:87
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
MediaWiki\Storage\BlobStoreFactory\$loadBalancer
LoadBalancer $loadBalancer
Definition: BlobStoreFactory.php:40
Language
Internationalisation code.
Definition: Language.php:35
MediaWiki\Storage\BlobStoreFactory\$contLang
Language $contLang
Definition: BlobStoreFactory.php:55