MediaWiki REL1_34
FileBackendGroup Class Reference

Class to handle file backend registration. More...

Collaboration diagram for FileBackendGroup:

Public Member Functions

 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)
 

Static Public Member Functions

static destroySingleton ()
 Destroy the singleton instance.
 
static singleton ()
 

Protected Member Functions

 __construct ()
 
 initFromGlobals ()
 Register file backends from the global variables.
 
 register (array $configs, $readOnlyReason=null)
 Register an array of file backend configurations.
 

Protected Attributes

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

Static Protected Attributes

static FileBackendGroup $instance = null
 

Detailed Description

Class to handle file backend registration.

Since
1.19

Definition at line 33 of file FileBackendGroup.php.

Constructor & Destructor Documentation

◆ __construct()

FileBackendGroup::__construct ( )
protected

Definition at line 40 of file FileBackendGroup.php.

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

References FileJournal\factory().

Referenced by get().

◆ destroySingleton()

static FileBackendGroup::destroySingleton ( )
static

Destroy the singleton instance.

Definition at line 58 of file FileBackendGroup.php.

Referenced by ForkController\prepareEnvironment().

◆ get()

FileBackendGroup::get (   $name)

Get the backend object with a given name.

Parameters
string$name
Returns
FileBackend
Exceptions
InvalidArgumentException

Definition at line 166 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 256 of file FileBackendGroup.php.

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

◆ initFromGlobals()

FileBackendGroup::initFromGlobals ( )
protected

Register file backends from the global variables.

Definition at line 65 of file FileBackendGroup.php.

References $wgDirectoryMode, $wgFileBackends, $wgForeignFileRepos, $wgLocalFileRepo, and wfConfiguredReadOnlyReason().

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

References wfWarn().

◆ singleton()

static FileBackendGroup::singleton ( )
static

Member Data Documentation

◆ $backends

array FileBackendGroup::$backends = []
protected

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

Definition at line 38 of file FileBackendGroup.php.

◆ $instance

FileBackendGroup FileBackendGroup::$instance = null
staticprotected

Definition at line 35 of file FileBackendGroup.php.

Referenced by singleton().


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