MediaWiki REL1_32
BlobStoreFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Storage;
22
23use Config;
24use Language;
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}
Internationalisation code.
Definition Language.php:35
Service for instantiating BlobStores.
__construct(LBFactory $lbFactory, WANObjectCache $cache, Config $mainConfig, Language $contLang)
Service for storing and loading Content objects.
Multi-datacenter aware caching interface.
An interface for generating database load balancers.
Definition LBFactory.php:39
Interface for configuration instances.
Definition Config.php:28
you have access to all of the normal MediaWiki so you can get a DB use the cache