MediaWiki  master
FileBackendGroup Class Reference

Class to handle file backend registration. More...

Collaboration diagram for FileBackendGroup:

Public Member Functions

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

Static Public Member Functions

static destroySingleton ()
 
static singleton ()
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Protected Member Functions

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

Protected Attributes

array[] $backends = []
 (name => ('class' => string, 'config' => array, 'instance' => object)) -var array<string,array{class:class-string,config:array,instance:object}> More...
 

Private Attributes

LockManagerGroupFactory $lmgFactory
 
MimeAnalyzer $mimeAnalyzer
 
ObjectFactory $objectFactory
 
ServiceOptions $options
 
BagOStuff $srvCache
 
TempFSFileFactory $tmpFileFactory
 
WANObjectCache $wanCache
 

Detailed Description

Class to handle file backend registration.

Since
1.19

Definition at line 37 of file FileBackendGroup.php.

Constructor & Destructor Documentation

◆ __construct()

FileBackendGroup::__construct ( ServiceOptions  $options,
ConfiguredReadOnlyMode  $configuredReadOnlyMode,
BagOStuff  $srvCache,
WANObjectCache  $wanCache,
MimeAnalyzer  $mimeAnalyzer,
LockManagerGroupFactory  $lmgFactory,
TempFSFileFactory  $tmpFileFactory,
ObjectFactory  $objectFactory 
)
Parameters
ServiceOptions$options
ConfiguredReadOnlyMode$configuredReadOnlyMode
BagOStuff$srvCache
WANObjectCache$wanCache
MimeAnalyzer$mimeAnalyzer
LockManagerGroupFactory$lmgFactory
TempFSFileFactory$tmpFileFactory
ObjectFactory$objectFactory

Definition at line 101 of file FileBackendGroup.php.

References $lmgFactory, $mimeAnalyzer, $objectFactory, $options, $srvCache, $tmpFileFactory, $wanCache, MediaWiki\Config\ServiceOptions\get(), and ConfiguredReadOnlyMode\getReason().

Member Function Documentation

◆ backendFromPath()

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 273 of file FileBackendGroup.php.

References FileBackend\splitStoragePath().

◆ config()

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 228 of file FileBackendGroup.php.

References Profiler\instance().

Referenced by get().

◆ destroySingleton()

static FileBackendGroup::destroySingleton ( )
static
Deprecated:
since 1.35, test framework should reset services between tests instead

Definition at line 87 of file FileBackendGroup.php.

◆ get()

FileBackendGroup::get (   $name)

Get the backend object with a given name.

Parameters
string$name
Returns
FileBackend
Exceptions
InvalidArgumentException

Definition at line 198 of file FileBackendGroup.php.

References config().

◆ guessMimeInternal()

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

Definition at line 289 of file FileBackendGroup.php.

References $content, $ext, $type, and FileBackend\extensionFromPath().

◆ register()

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.

◆ singleton()

static FileBackendGroup::singleton ( )
static
Deprecated:
since 1.35, inject the service instead
Returns
FileBackendGroup

Definition at line 80 of file FileBackendGroup.php.

Member Data Documentation

◆ $backends

array [] FileBackendGroup::$backends = []
protected

(name => ('class' => string, 'config' => array, 'instance' => object)) -var array<string,array{class:class-string,config:array,instance:object}>

Definition at line 42 of file FileBackendGroup.php.

◆ $lmgFactory

LockManagerGroupFactory FileBackendGroup::$lmgFactory
private

Definition at line 57 of file FileBackendGroup.php.

Referenced by __construct().

◆ $mimeAnalyzer

MimeAnalyzer FileBackendGroup::$mimeAnalyzer
private

Definition at line 54 of file FileBackendGroup.php.

Referenced by __construct().

◆ $objectFactory

ObjectFactory FileBackendGroup::$objectFactory
private

Definition at line 63 of file FileBackendGroup.php.

Referenced by __construct().

◆ $options

ServiceOptions FileBackendGroup::$options
private

Definition at line 45 of file FileBackendGroup.php.

Referenced by __construct().

◆ $srvCache

BagOStuff FileBackendGroup::$srvCache
private

Definition at line 48 of file FileBackendGroup.php.

Referenced by __construct().

◆ $tmpFileFactory

TempFSFileFactory FileBackendGroup::$tmpFileFactory
private

Definition at line 60 of file FileBackendGroup.php.

Referenced by __construct().

◆ $wanCache

WANObjectCache FileBackendGroup::$wanCache
private

Definition at line 51 of file FileBackendGroup.php.

Referenced by __construct().

◆ CONSTRUCTOR_OPTIONS

const FileBackendGroup::CONSTRUCTOR_OPTIONS
Initial value:
= [
'DirectoryMode',
'FileBackends',
'ForeignFileRepos',
'LocalFileRepo',
'fallbackWikiId',
]

Definition at line 68 of file FileBackendGroup.php.


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