MediaWiki master
MediaWiki\FileBackend\FileBackendGroup Class Reference

Class to handle file backend registration. More...

Public Member Functions

 __construct (ServiceOptions $options, ReadOnlyMode $readOnlyMode, BagOStuff $srvCache, WANObjectCache $wanCache, MimeAnalyzer $mimeAnalyzer, LockManagerGroupFactory $lmgFactory, TempFSFileFactory $tmpFileFactory, ObjectFactory $objectFactory)
 
 backendFromPath ( $storagePath)
 Get an appropriate backend object from a storage path.
 
 config ( $name)
 Get the config array for a backend object with a given name.
 
 get ( $name)
 Get the backend object with a given name.
 
 guessMimeInternal ( $storagePath, $content, $fsPath)
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Protected Member Functions

 register (array $configs, $readOnlyReason=null)
 Register an array of file backend configurations.
 

Protected Attributes

array[] $backends = []
 (name => ('class' => string, 'config' => array, 'instance' => object))
 

Detailed Description

Class to handle file backend registration.

Since
1.19

Definition at line 51 of file FileBackendGroup.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\FileBackend\FileBackendGroup::__construct ( ServiceOptions $options,
ReadOnlyMode $readOnlyMode,
BagOStuff $srvCache,
WANObjectCache $wanCache,
MimeAnalyzer $mimeAnalyzer,
LockManagerGroupFactory $lmgFactory,
TempFSFileFactory $tmpFileFactory,
ObjectFactory $objectFactory )
Parameters
ServiceOptions$options
ReadOnlyMode$readOnlyMode
BagOStuff$srvCache
WANObjectCache$wanCache
MimeAnalyzer$mimeAnalyzer
LockManagerGroupFactory$lmgFactory
TempFSFileFactory$tmpFileFactory
ObjectFactory$objectFactory

Definition at line 100 of file FileBackendGroup.php.

References MediaWiki\MainConfigNames\DirectoryMode, MediaWiki\MainConfigNames\FileBackends, MediaWiki\MainConfigNames\ForeignFileRepos, MediaWiki\Config\ServiceOptions\get(), Wikimedia\Rdbms\ReadOnlyMode\getConfiguredReason(), and MediaWiki\MainConfigNames\LocalFileRepo.

Member Function Documentation

◆ backendFromPath()

MediaWiki\FileBackend\FileBackendGroup::backendFromPath ( $storagePath)

Get an appropriate backend object from a storage path.

Parameters
string$storagePath
Returns
FileBackend|null Backend or null on failure

Definition at line 267 of file FileBackendGroup.php.

◆ config()

MediaWiki\FileBackend\FileBackendGroup::config ( $name)

Get the config array for a backend object with a given name.

Parameters
string$name
Returns
array Parameters to FileBackend::__construct()
Exceptions
InvalidArgumentException

Definition at line 227 of file FileBackendGroup.php.

References Profiler\instance().

Referenced by MediaWiki\FileBackend\FileBackendGroup\get().

◆ get()

MediaWiki\FileBackend\FileBackendGroup::get ( $name)

Get the backend object with a given name.

Parameters
string$name
Returns
FileBackend
Exceptions
InvalidArgumentException

Definition at line 197 of file FileBackendGroup.php.

References MediaWiki\FileBackend\FileBackendGroup\config().

◆ guessMimeInternal()

MediaWiki\FileBackend\FileBackendGroup::guessMimeInternal ( $storagePath,
$content,
$fsPath )
Parameters
string$storagePath
string | null$content
string | null$fsPath
Returns
string
Since
1.27

Definition at line 283 of file FileBackendGroup.php.

◆ register()

MediaWiki\FileBackend\FileBackendGroup::register ( array $configs,
$readOnlyReason = null )
protected

Register an array of file backend configurations.

Parameters
array[]$configs
string | null$readOnlyReason
Exceptions
InvalidArgumentException

Definition at line 165 of file FileBackendGroup.php.

Member Data Documentation

◆ $backends

array [] MediaWiki\FileBackend\FileBackendGroup::$backends = []
protected

(name => ('class' => string, 'config' => array, 'instance' => object))

Definition at line 56 of file FileBackendGroup.php.

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\FileBackend\FileBackendGroup::CONSTRUCTOR_OPTIONS
Initial value:
= [
'fallbackWikiId',
]
const FileBackends
Name constant for the FileBackends setting, for use with Config::get()
const LocalFileRepo
Name constant for the LocalFileRepo setting, for use with Config::get()
const ForeignFileRepos
Name constant for the ForeignFileRepos setting, for use with Config::get()
const DirectoryMode
Name constant for the DirectoryMode setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 82 of file FileBackendGroup.php.


The documentation for this class was generated from the following file: