MediaWiki  1.23.0
FileBackend Class Reference

Base class for all file backend classes (including multi-write backends). More...

Inheritance diagram for FileBackend:
Collaboration diagram for FileBackend:

Public Member Functions

 __construct (array $config)
 Create a new backend instance from configuration. More...
 
 clean (array $params)
 Delete a storage directory if it is empty. More...
 
 clearCache (array $paths=null)
 Invalidate any in-process file stat and property cache. More...
 
 concatenate (array $params)
 Concatenate a list of storage files into a single file system file. More...
 
 copy (array $params, array $opts=array())
 Performs a single copy operation. More...
 
 create (array $params, array $opts=array())
 Performs a single create operation. More...
 
 delete (array $params, array $opts=array())
 Performs a single delete operation. More...
 
 describe (array $params, array $opts=array())
 Performs a single describe operation. More...
 
 directoryExists (array $params)
 Check if a directory exists at a given storage path. More...
 
 doOperation (array $op, array $opts=array())
 Same as doOperations() except it takes a single operation. More...
 
 doOperations (array $ops, array $opts=array())
 This is the main entry point into the backend for write operations. More...
 
 doQuickOperation (array $op)
 Same as doQuickOperations() except it takes a single operation. More...
 
 doQuickOperations (array $ops, array $opts=array())
 Perform a set of independent file operations on some files. More...
 
 fileExists (array $params)
 Check if a file exists at a storage path in the backend. More...
 
 getContainerStoragePath ( $container)
 Get the storage path for the given container for this backend. More...
 
 getDirectoryList (array $params)
 Get an iterator to list all directories under a storage directory. More...
 
 getFeatures ()
 Get the a bitfield of extra features supported by the backend medium. More...
 
 getFileContents (array $params)
 Get the contents of a file at a storage path in the backend. More...
 
 getFileContentsMulti (array $params)
 Like getFileContents() except it takes an array of storage paths and returns a map of storage paths to strings (or null on failure). More...
 
 getFileHttpUrl (array $params)
 Return an HTTP URL to a given file that requires no authentication to use. More...
 
 getFileList (array $params)
 Get an iterator to list all stored files under a storage directory. More...
 
 getFileProps (array $params)
 Get the properties of the file at a storage path in the backend. More...
 
 getFileSha1Base36 (array $params)
 Get a SHA-1 hash of the file at a storage path in the backend. More...
 
 getFileSize (array $params)
 Get the size (bytes) of a file at a storage path in the backend. More...
 
 getFileStat (array $params)
 Get quick information about a file at a storage path in the backend. More...
 
 getFileTimestamp (array $params)
 Get the last-modified timestamp of the file at a storage path. More...
 
 getFileXAttributes (array $params)
 Get metadata about a file at a storage path in the backend. More...
 
 getJournal ()
 Get the file journal object for this backend. More...
 
 getLocalCopy (array $params)
 Get a local copy on disk of the file at a storage path in the backend. More...
 
 getLocalCopyMulti (array $params)
 Like getLocalCopy() except it takes an array of storage paths and returns a map of storage paths to TempFSFile objects (or null on failure). More...
 
 getLocalReference (array $params)
 Returns a file system file, identical to the file at a storage path. More...
 
 getLocalReferenceMulti (array $params)
 Like getLocalReference() except it takes an array of storage paths and returns a map of storage paths to FSFile objects (or null on failure). More...
 
 getName ()
 Get the unique backend name. More...
 
 getReadOnlyReason ()
 Get an explanatory message if this backend is read-only. More...
 
 getRootStoragePath ()
 Get the root storage path of this backend. More...
 
 getScopedFileLocks (array $paths, $type, Status $status)
 Lock the files at the given storage paths in the backend. More...
 
 getScopedLocksForOps (array $ops, Status $status)
 Get an array of scoped locks needed for a batch of file operations. More...
 
 getTopDirectoryList (array $params)
 Same as FileBackend::getDirectoryList() except only lists directories that are immediately under the given directory. More...
 
 getTopFileList (array $params)
 Same as FileBackend::getFileList() except only lists files that are immediately under the given directory. More...
 
 getWikiId ()
 Get the wiki identifier used for this backend (possibly empty). More...
 
 hasFeatures ( $bitfield)
 Check if the backend medium supports a field of extra features. More...
 
 isReadOnly ()
 Check if this backend is read-only. More...
 
 lockFiles (array $paths, $type)
 Lock the files at the given storage paths in the backend. More...
 
 move (array $params, array $opts=array())
 Performs a single move operation. More...
 
 preloadCache (array $paths)
 Preload persistent file stat cache and property cache into in-process cache. More...
 
 preloadFileStat (array $params)
 Preload file stat information (concurrently if possible) into in-process cache. More...
 
 prepare (array $params)
 Prepare a storage directory for usage. More...
 
 publish (array $params)
 Remove measures to block web access to a storage directory and the container it belongs to. More...
 
 quickCopy (array $params)
 Performs a single quick copy operation. More...
 
 quickCreate (array $params)
 Performs a single quick create operation. More...
 
 quickDelete (array $params)
 Performs a single quick delete operation. More...
 
 quickDescribe (array $params)
 Performs a single quick describe operation. More...
 
 quickMove (array $params)
 Performs a single quick move operation. More...
 
 quickStore (array $params)
 Performs a single quick store operation. More...
 
 secure (array $params)
 Take measures to block web access to a storage directory and the container it belongs to. More...
 
 store (array $params, array $opts=array())
 Performs a single store operation. More...
 
 streamFile (array $params)
 Stream the file at a storage path in the backend. More...
 
 unlockFiles (array $paths, $type)
 Unlock the files at the given storage paths in the backend. More...
 

Static Public Member Functions

static extensionFromPath ( $path)
 Get the final extension from a storage or FS path. More...
 
static isPathTraversalFree ( $path)
 Check if a relative path has no directory traversals. More...
 
static isStoragePath ( $path)
 Check if a given path is a "mwstore://" path. More...
 
static makeContentDisposition ( $type, $filename='')
 Build a Content-Disposition header value per RFC 6266. More...
 
static normalizeStoragePath ( $storagePath)
 Normalize a storage path by cleaning up directory separators. More...
 
static parentStoragePath ( $storagePath)
 Get the parent storage directory of a storage path. More...
 
static splitStoragePath ( $storagePath)
 Split a storage path into a backend name, a container name, and a relative file path. More...
 

Public Attributes

const ATTR_HEADERS = 1
 Flags for supported features. More...
 
const ATTR_METADATA = 2
 

Protected Member Functions

 doClean (array $params)
 
 doOperationsInternal (array $ops, array $opts)
 
 doPrepare (array $params)
 
 doPublish (array $params)
 
 doQuickOperationsInternal (array $ops)
 
 doSecure (array $params)
 
 getScopedPHPBehaviorForOps ()
 Enter file operation scope. More...
 

Static Protected Member Functions

static normalizeContainerPath ( $path)
 Validate and normalize a relative storage path. More...
 

Protected Attributes

int $concurrency
 How many operations can be done in parallel *. More...
 
FileJournal $fileJournal
 
LockManager $lockManager
 
string $name
 Unique backend name *. More...
 
string $parallelize
 When to do operations in parallel *. More...
 
string $readOnly
 Read-only explanation message *. More...
 
string $wikiId
 Unique wiki name *. More...
 

Detailed Description

Base class for all file backend classes (including multi-write backends).

This class defines the methods as abstract that subclasses must implement. Outside callers can assume that all backends will have these functions.

All "storage paths" are of the format "mwstore://<backend>/<container>/<path>". The "backend" portion is unique name for MediaWiki to refer to a backend, while the "container" portion is a top-level directory of the backend. The "path" portion is a relative path that uses UNIX file system (FS) notation, though any particular backend may not actually be using a local filesystem. Therefore, the relative paths are only virtual.

Backend contents are stored under wiki-specific container names by default. Global (qualified) backends are achieved by configuring the "wiki ID" to a constant. For legacy reasons, the FSFileBackend class allows manually setting the paths of containers to ones that do not respect the "wiki ID".

In key/value (object) stores, containers are the only hierarchy (the rest is emulated). FS-based backends are somewhat more restrictive due to the existence of real directory files; a regular file cannot have the same name as a directory. Other backends with virtual directories may not have this limitation. Callers should store files in such a way that no files and directories are under the same path.

In general, this class allows for callers to access storage through the same interface, without regard to the underlying storage system. However, calling code must follow certain patterns and be aware of certain things to ensure compatibility:

  • a) Always call prepare() on the parent directory before trying to put a file there; key/value stores only need the container to exist first, but filesystems need all the parent directories to exist first (prepare() is aware of all this)
  • b) Always call clean() on a directory when it might become empty to avoid empty directory buildup on filesystems; key/value stores never have empty directories, so doing this helps preserve consistency in both cases
  • c) Likewise, do not rely on the existence of empty directories for anything; calling directoryExists() on a path that prepare() was previously called on will return false for key/value stores if there are no files under that path
  • d) Never alter the resulting FSFile returned from getLocalReference(), as it could either be a copy of the source file in /tmp or the original source file itself
  • e) Use a file layout that results in never attempting to store files over directories or directories over files; key/value stores allow this but filesystems do not
  • f) Use ASCII file names (e.g. base32, IDs, hashes) to avoid Unicode issues in Windows
  • g) Do not assume that move operations are atomic (difficult with key/value stores)
  • h) Do not assume that file stat or read operations always have immediate consistency; various methods have a "latest" flag that should always be used if up-to-date information is required (this trades performance for correctness as needed)
  • i) Do not assume that directory listings have immediate consistency

Methods of subclasses should avoid throwing exceptions at all costs. As a corollary, external dependencies should be kept to a minimum.

Since
1.19

Definition at line 85 of file FileBackend.php.

Constructor & Destructor Documentation

◆ __construct()

FileBackend::__construct ( array  $config)

Create a new backend instance from configuration.

This should only be called from within FileBackendGroup.

Parameters
array$configParameters include:
  • name : The unique name of this backend. This should consist of alphanumberic, '-', and '_' characters. This name should not be changed after use (e.g. with journaling). Note that the name is not used in actual container names.
  • wikiId : Prefix to container names that is unique to this backend. It should only consist of alphanumberic, '-', and '_' characters. This ID is what avoids collisions if multiple logical backends use the same storage system, so this should be set carefully.
  • lockManager : LockManager object to use for any file locking. If not provided, then no file locking will be enforced.
  • fileJournal : FileJournal object to use for logging changes to files. If not provided, then change journaling will be disabled.
  • readOnly : Write operations are disallowed if this is a non-empty string. It should be an explanation for the backend being read-only.
  • parallelize : When to do file operations in parallel (when possible). Allowed values are "implicit", "explicit" and "off".
  • concurrency : How many file operations can be done in parallel.
Exceptions
FileBackendException

Reimplemented in SwiftFileBackend, FileBackendMultiWrite, FileBackendStore, and FSFileBackend.

Definition at line 128 of file FileBackend.php.

References array(), FileJournal\factory(), name, LockManagerGroup\singleton(), wfDeprecated(), and wfWikiID().

Member Function Documentation

◆ clean()

FileBackend::clean ( array  $params)
final

Delete a storage directory if it is empty.

Backends using key/value stores may do nothing unless the directory is that of an empty container, in which case it will be deleted.

Parameters
array$paramsParameters include:
  • dir : storage directory
  • recursive : recursively delete empty subdirectories first (since 1.20)
  • bypassReadOnly : allow writes in read-only mode (since 1.20)
Returns
Status

Definition at line 838 of file FileBackend.php.

References $params, doClean(), getScopedPHPBehaviorForOps(), isReadOnly(), name, and Status\newFatal().

◆ clearCache()

FileBackend::clearCache ( array  $paths = null)
abstract

Invalidate any in-process file stat and property cache.

If $paths is given, then only the cache for those files will be cleared.

See also
FileBackend::getFileStat()
Parameters
array$pathsStorage paths (optional)

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by CopyFileBackend\copyFileBatch().

◆ concatenate()

FileBackend::concatenate ( array  $params)
abstract

Concatenate a list of storage files into a single file system file.

The target path should refer to a file that is already locked or otherwise safe from modification from other processes. Normally, the file will be a new temp file, which should be adequate.

Parameters
array$paramsOperation parameters, include:
  • srcs : ordered source storage paths (e.g. chunk1, chunk2, ...)
  • dst : file system path to 0-byte temp file
  • parallelize : try to do operations in parallel when possible
Returns
Status

Reimplemented in FileBackendMultiWrite, and FileBackendStore.

◆ copy()

FileBackend::copy ( array  $params,
array  $opts = array() 
)
final

Performs a single copy operation.

This sets $params['op'] to 'copy' and passes it to doOperation().

See also
FileBackend::doOperation()
Parameters
array$paramsOperation parameters
array$optsOperation options
Returns
Status

Definition at line 444 of file FileBackend.php.

References array(), and doOperation().

Referenced by FSFileBackend\doCopyInternal(), FSFileBackend\doGetLocalCopyMulti(), and FSFileBackend\doStoreInternal().

◆ create()

FileBackend::create ( array  $params,
array  $opts = array() 
)
final

Performs a single create operation.

This sets $params['op'] to 'create' and passes it to doOperation().

See also
FileBackend::doOperation()
Parameters
array$paramsOperation parameters
array$optsOperation options
Returns
Status

Definition at line 416 of file FileBackend.php.

References array(), and doOperation().

◆ delete()

FileBackend::delete ( array  $params,
array  $opts = array() 
)
final

Performs a single delete operation.

This sets $params['op'] to 'delete' and passes it to doOperation().

See also
FileBackend::doOperation()
Parameters
array$paramsOperation parameters
array$optsOperation options
Returns
Status

Definition at line 472 of file FileBackend.php.

References array(), and doOperation().

◆ describe()

FileBackend::describe ( array  $params,
array  $opts = array() 
)
final

Performs a single describe operation.

This sets $params['op'] to 'describe' and passes it to doOperation().

See also
FileBackend::doOperation()
Parameters
array$paramsOperation parameters
array$optsOperation options
Returns
Status
Since
1.21

Definition at line 487 of file FileBackend.php.

References array(), and doOperation().

◆ directoryExists()

FileBackend::directoryExists ( array  $params)
abstract

Check if a directory exists at a given storage path.

Backends using key/value stores will check if the path is a virtual directory, meaning there are files under the given directory.

Storage backends with eventual consistency might return stale data.

Parameters
array$paramsParameters include:
  • dir : storage directory
Returns
bool|null Returns null on failure
Since
1.20

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

◆ doClean()

FileBackend::doClean ( array  $params)
abstractprotected
See also
FileBackend::clean()

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by clean().

◆ doOperation()

FileBackend::doOperation ( array  $op,
array  $opts = array() 
)
final

Same as doOperations() except it takes a single operation.

If you are doing a batch of operations that should either all succeed or all fail, then use that function instead.

See also
FileBackend::doOperations()
Parameters
array$opOperation
array$optsOperation options
Returns
Status

Definition at line 402 of file FileBackend.php.

References array(), and doOperations().

Referenced by LocalRepo\cleanupDeletedBatch(), copy(), create(), delete(), describe(), move(), and store().

◆ doOperations()

FileBackend::doOperations ( array  $ops,
array  $opts = array() 
)
final

This is the main entry point into the backend for write operations.

Callers supply an ordered list of operations to perform as a transaction. Files will be locked, the stat cache cleared, and then the operations attempted. If any serious errors occur, all attempted operations will be rolled back.

$ops is an array of arrays. The outer array holds a list of operations. Each inner array is a set of key value pairs that specify an operation.

Supported operations and their parameters. The supported actions are:

  • create
  • store
  • copy
  • move
  • delete
  • describe (since 1.21)
  • null

a) Create a new file in storage with the contents of a string

'op' => 'create',
'dst' => <storage path>,
'content' => <string of new file contents>,
'overwrite' => <boolean>,
'overwriteSame' => <boolean>,
'headers' => <HTTP header name/value map> # since 1.21
);

b) Copy a file system file into storage

'op' => 'store',
'src' => <file system path>,
'dst' => <storage path>,
'overwrite' => <boolean>,
'overwriteSame' => <boolean>,
'headers' => <HTTP header name/value map> # since 1.21
)

c) Copy a file within storage

'op' => 'copy',
'src' => <storage path>,
'dst' => <storage path>,
'overwrite' => <boolean>,
'overwriteSame' => <boolean>,
'ignoreMissingSource' => <boolean>, # since 1.21
'headers' => <HTTP header name/value map> # since 1.21
)

d) Move a file within storage

'op' => 'move',
'src' => <storage path>,
'dst' => <storage path>,
'overwrite' => <boolean>,
'overwriteSame' => <boolean>,
'ignoreMissingSource' => <boolean>, # since 1.21
'headers' => <HTTP header name/value map> # since 1.21
)

e) Delete a file within storage

'op' => 'delete',
'src' => <storage path>,
'ignoreMissingSource' => <boolean>
)

f) Update metadata for a file within storage

'op' => 'describe',
'src' => <storage path>,
'headers' => <HTTP header name/value map>
)

g) Do nothing (no-op)

'op' => 'null',
)

Boolean flags for operations (operation-specific):

  • ignoreMissingSource : The operation will simply succeed and do nothing if the source file does not exist.
  • overwrite : Any destination file will be overwritten.
  • overwriteSame : If a file already exists at the destination with the same contents, then do nothing to the destination file instead of giving an error. This does not compare headers. This option is ignored if 'overwrite' is already provided.
  • headers : If supplied, the result of merging these headers with any existing source file headers (replacing conflicting ones) will be set as the destination file headers. Headers are deleted if their value is set to the empty string. When a file has headers they are included in responses to GET and HEAD requests to the backing store for that file. Header values should be no larger than 255 bytes, except for Content-Disposition. The system might ignore or truncate any headers that are too long to store (exact limits will vary). Backends that don't support metadata ignore this. (since 1.21)

$opts is an associative of boolean flags, including:

  • force : Operation precondition errors no longer trigger an abort. Any remaining operations are still attempted. Unexpected failures may still cause remaining operations to be aborted.
  • nonLocking : No locks are acquired for the operations. This can increase performance for non-critical writes. This has no effect unless the 'force' flag is set.
  • nonJournaled : Don't log this operation batch in the file journal. This limits the ability of recovery scripts.
  • parallelize : Try to do operations in parallel when possible.
  • bypassReadOnly : Allow writes in read-only mode. (since 1.20)
  • preserveCache : Don't clear the process cache before checking files. This should only be used if all entries in the process cache were added after the files were already locked. (since 1.20)
Remarks
Remarks on locking: File system paths given to operations should refer to files that are already locked or otherwise safe from modification from other processes. Normally these files will be new temp files, which should be adequate.
Return value:

This returns a Status, which contains all warnings and fatals that occurred during the operation. The 'failCount', 'successCount', and 'success' members will reflect each operation attempted.

The status will be "OK" unless:

  • a) unexpected operation errors occurred (network partitions, disk full...)
  • b) significant operation errors occurred and 'force' was not set
Parameters
array$opsList of operations to execute in order
array$optsBatch operation options
Returns
Status

Definition at line 367 of file FileBackend.php.

References as, doOperationsInternal(), getScopedPHPBehaviorForOps(), isReadOnly(), name, Status\newFatal(), and Status\newGood().

Referenced by FileRepo\deleteBatch(), doOperation(), FileRepo\publishBatch(), and FileRepo\storeBatch().

◆ doOperationsInternal()

FileBackend::doOperationsInternal ( array  $ops,
array  $opts 
)
abstractprotected

◆ doPrepare()

FileBackend::doPrepare ( array  $params)
abstractprotected
See also
FileBackend::prepare()

Reimplemented in FileBackendMultiWrite, and FileBackendStore.

Referenced by prepare().

◆ doPublish()

FileBackend::doPublish ( array  $params)
abstractprotected
See also
FileBackend::publish()

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by publish().

◆ doQuickOperation()

FileBackend::doQuickOperation ( array  $op)
final

Same as doQuickOperations() except it takes a single operation.

If you are doing a batch of operations, then use that function instead.

See also
FileBackend::doQuickOperations()
Parameters
array$opOperation
Returns
Status
Since
1.20

Definition at line 634 of file FileBackend.php.

References array(), and doQuickOperations().

Referenced by quickCopy(), quickCreate(), quickDelete(), quickDescribe(), quickMove(), and quickStore().

◆ doQuickOperations()

FileBackend::doQuickOperations ( array  $ops,
array  $opts = array() 
)
final

Perform a set of independent file operations on some files.

This does no locking, nor journaling, and possibly no stat calls. Any destination files that already exist will be overwritten. This should only be used on non-original files, like cache files.

Supported operations and their parameters:

  • create
  • store
  • copy
  • move
  • delete
  • describe (since 1.21)
  • null

a) Create a new file in storage with the contents of a string

'op' => 'create',
'dst' => <storage path>,
'content' => <string of new file contents>,
'headers' => <HTTP header name/value map> # since 1.21
)

b) Copy a file system file into storage

'op' => 'store',
'src' => <file system path>,
'dst' => <storage path>,
'headers' => <HTTP header name/value map> # since 1.21
)

c) Copy a file within storage

'op' => 'copy',
'src' => <storage path>,
'dst' => <storage path>,
'ignoreMissingSource' => <boolean>, # since 1.21
'headers' => <HTTP header name/value map> # since 1.21
)

d) Move a file within storage

'op' => 'move',
'src' => <storage path>,
'dst' => <storage path>,
'ignoreMissingSource' => <boolean>, # since 1.21
'headers' => <HTTP header name/value map> # since 1.21
)

e) Delete a file within storage

'op' => 'delete',
'src' => <storage path>,
'ignoreMissingSource' => <boolean>
)

f) Update metadata for a file within storage

'op' => 'describe',
'src' => <storage path>,
'headers' => <HTTP header name/value map>
)

g) Do nothing (no-op)

'op' => 'null',
)
Boolean flags for operations (operation-specific):
  • ignoreMissingSource : The operation will simply succeed and do nothing if the source file does not exist.
  • headers : If supplied with a header name/value map, the backend will reply with these headers when GETs/HEADs of the destination file are made. Header values should be smaller than 256 bytes. Content-Disposition headers can be longer, though the system might ignore or truncate ones that are too long to store. Existing headers will remain, but these will replace any conflicting previous headers, and headers will be removed if they are set to an empty string. Backends that don't support metadata ignore this. (since 1.21)

$opts is an associative of boolean flags, including:

  • bypassReadOnly : Allow writes in read-only mode (since 1.20)
Return value:
This returns a Status, which contains all warnings and fatals that occurred during the operation. The 'failCount', 'successCount', and 'success' members will reflect each operation attempted for the given files. The status will be considered "OK" as long as no fatal errors occurred.
Parameters
array$opsSet of operations to execute
array$optsBatch operation options
Returns
Status
Since
1.20

Definition at line 601 of file FileBackend.php.

References as, doQuickOperationsInternal(), getScopedPHPBehaviorForOps(), isReadOnly(), name, Status\newFatal(), and Status\newGood().

Referenced by CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), doQuickOperation(), and SyncFileBackend\syncFileBatch().

◆ doQuickOperationsInternal()

FileBackend::doQuickOperationsInternal ( array  $ops)
abstractprotected
See also
FileBackend::doQuickOperations()
Since
1.20

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by doQuickOperations().

◆ doSecure()

FileBackend::doSecure ( array  $params)
abstractprotected
See also
FileBackend::secure()

Reimplemented in FileBackendMultiWrite, and FileBackendStore.

Referenced by secure().

◆ extensionFromPath()

static FileBackend::extensionFromPath (   $path)
staticfinal

◆ fileExists()

FileBackend::fileExists ( array  $params)
abstract

Check if a file exists at a storage path in the backend.

This returns false if only a directory exists at the path.

Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
bool|null Returns null on failure

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by CopyFileBackend\copyFileBatch(), ForeignAPIRepo\getThumbUrlFromCache(), and SyncFileBackend\syncFileBatch().

◆ getContainerStoragePath()

FileBackend::getContainerStoragePath (   $container)
final

Get the storage path for the given container for this backend.

Parameters
string$containerContainer name
Returns
string Storage path
Since
1.21

Definition at line 1310 of file FileBackend.php.

References getRootStoragePath().

◆ getDirectoryList()

FileBackend::getDirectoryList ( array  $params)
abstract

Get an iterator to list all directories under a storage directory.

If the directory is of the form "mwstore://backend/container", then all directories in the container will be listed. If the directory is of form "mwstore://backend/container/dir", then all directories directly under that directory will be listed. Results will be storage directories relative to the given directory.

Storage backends with eventual consistency might return stale data.

Failures during iteration can result in FileBackendError exceptions (since 1.22).

Parameters
array$paramsParameters include:
  • dir : storage directory
  • topOnly : only return direct child dirs of the directory
Returns
Traversable|Array|null Returns null on failure
Since
1.20

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by getTopDirectoryList().

◆ getFeatures()

FileBackend::getFeatures ( )

Get the a bitfield of extra features supported by the backend medium.

Returns
integer Bitfield of FileBackend::ATTR_* flags
Since
1.23

Reimplemented in FileBackendMultiWrite, and SwiftFileBackend.

Definition at line 206 of file FileBackend.php.

Referenced by hasFeatures().

◆ getFileContents()

FileBackend::getFileContents ( array  $params)
final

Get the contents of a file at a storage path in the backend.

This should be avoided for potentially large files.

Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
string|bool Returns false on failure

Definition at line 899 of file FileBackend.php.

References $params, array(), and getFileContentsMulti().

◆ getFileContentsMulti()

FileBackend::getFileContentsMulti ( array  $params)
abstract

Like getFileContents() except it takes an array of storage paths and returns a map of storage paths to strings (or null on failure).

The map keys (paths) are in the same order as the provided list of paths.

See also
FileBackend::getFileContents()
Parameters
array$paramsParameters include:
  • srcs : list of source storage paths
  • latest : use the latest available data
  • parallelize : try to do operations in parallel when possible
Returns
array Map of (path name => string or false on failure)
Since
1.20

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by getFileContents().

◆ getFileHttpUrl()

FileBackend::getFileHttpUrl ( array  $params)
abstract

Return an HTTP URL to a given file that requires no authentication to use.

The URL may be pre-authenticated (via some token in the URL) and temporary. This will return null if the backend cannot make an HTTP URL for the file.

This is useful for key/value stores when using scripts that seek around large files and those scripts (and the backend) support HTTP Range headers. Otherwise, one would need to use getLocalReference(), which involves loading the entire file on to local disk.

Parameters
array$paramsParameters include:
  • src : source storage path
  • ttl : lifetime (seconds) if pre-authenticated; default is 1 day
Returns
string|null
Since
1.21

Reimplemented in SwiftFileBackend, FileBackendStore, and FileBackendMultiWrite.

◆ getFileList()

FileBackend::getFileList ( array  $params)
abstract

Get an iterator to list all stored files under a storage directory.

If the directory is of the form "mwstore://backend/container", then all files in the container will be listed. If the directory is of form "mwstore://backend/container/dir", then all files under that directory will be listed. Results will be storage paths relative to the given directory.

Storage backends with eventual consistency might return stale data.

Failures during iteration can result in FileBackendError exceptions (since 1.22).

Parameters
array$paramsParameters include:
  • dir : storage directory
  • topOnly : only return direct child files of the directory (since 1.20)
  • adviseStat : set to true if stat requests will be made on the files (since 1.22)
Returns
Traversable|Array|null Returns null on failure

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by CopyFileBackend\getListingDiffRel(), and getTopFileList().

◆ getFileProps()

FileBackend::getFileProps ( array  $params)
abstract

Get the properties of the file at a storage path in the backend.

This gives the result of FSFile::getProps() on a local copy of the file.

Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
array Returns FSFile::placeholderProps() on failure

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

◆ getFileSha1Base36()

FileBackend::getFileSha1Base36 ( array  $params)
abstract

Get a SHA-1 hash of the file at a storage path in the backend.

Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
string|bool Hash string or false on failure

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by SyncFileBackend\filesAreSame(), and CopyFileBackend\filesAreSame().

◆ getFileSize()

FileBackend::getFileSize ( array  $params)
abstract

Get the size (bytes) of a file at a storage path in the backend.

Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
int|bool Returns false on failure

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by SyncFileBackend\filesAreSame().

◆ getFileStat()

FileBackend::getFileStat ( array  $params)
abstract

Get quick information about a file at a storage path in the backend.

If the file does not exist, then this returns false. Otherwise, the result is an associative array that includes:

  • mtime : the last-modified timestamp (TS_MW)
  • size : the file size (bytes) Additional values may be included for internal use only.
Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
array|bool|null Returns null on failure

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by CopyFileBackend\filesAreSame().

◆ getFileTimestamp()

FileBackend::getFileTimestamp ( array  $params)
abstract

Get the last-modified timestamp of the file at a storage path.

Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
string|bool TS_MW timestamp or false on failure

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by ForeignAPIRepo\getThumbUrlFromCache().

◆ getFileXAttributes()

FileBackend::getFileXAttributes ( array  $params)
abstract

Get metadata about a file at a storage path in the backend.

If the file does not exist, then this returns false. Otherwise, the result is an associative array that includes:

  • headers : map of HTTP headers used for GET/HEAD requests (name => value)
  • metadata : map of file metadata (name => value) Metadata keys and headers names will be returned in all lower-case. Additional values may be included for internal use only.

Use FileBackend::hasFeatures() to check how well this is supported.

Parameters
array$params$params include:
  • src : source storage path
  • latest : use the latest available data
Returns
Array|bool Returns false on failure
Since
1.23

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

◆ getJournal()

FileBackend::getJournal ( )
final

Get the file journal object for this backend.

Returns
FileJournal

Definition at line 1319 of file FileBackend.php.

References $fileJournal.

Referenced by SyncFileBackend\syncBackends().

◆ getLocalCopy()

FileBackend::getLocalCopy ( array  $params)
final

Get a local copy on disk of the file at a storage path in the backend.

The temporary copy will have the same file extension as the source. Temporary files may be purged when the file object falls out of scope.

Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
TempFSFile|null Returns null on failure

Definition at line 1054 of file FileBackend.php.

References $params, array(), and getLocalCopyMulti().

Referenced by SwiftFileBackend\addMissingMetadata().

◆ getLocalCopyMulti()

FileBackend::getLocalCopyMulti ( array  $params)
abstract

Like getLocalCopy() except it takes an array of storage paths and returns a map of storage paths to TempFSFile objects (or null on failure).

The map keys (paths) are in the same order as the provided list of paths.

See also
FileBackend::getLocalCopy()
Parameters
array$paramsParameters include:
  • srcs : list of source storage paths
  • latest : use the latest available data
  • parallelize : try to do operations in parallel when possible
Returns
array Map of (path name => TempFSFile or null on failure)
Since
1.20

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by getLocalCopy().

◆ getLocalReference()

FileBackend::getLocalReference ( array  $params)
final

Returns a file system file, identical to the file at a storage path.

The file returned is either:

  • a) A local copy of the file at a storage path in the backend. The temporary copy will have the same extension as the source.
  • b) An original of the file at a storage path in the backend. Temporary files may be purged when the file object falls out of scope.

Write operations should never be done on this file as some backends may do internal tracking or may be instances of FileBackendMultiWrite. In that later case, there are copies of the file that must stay in sync. Additionally, further calls to this function may return the same file.

Parameters
array$paramsParameters include:
  • src : source storage path
  • latest : use the latest available data
Returns
FSFile|null Returns null on failure

Definition at line 1021 of file FileBackend.php.

References $params, array(), and getLocalReferenceMulti().

Referenced by CopyFileBackend\copyFileBatch(), FileBackendStore\doConcatenate(), FileBackendStore\doGetFileSha1Base36(), FileBackendStore\doStreamFile(), FileBackendStore\getFileProps(), and SyncFileBackend\syncFileBatch().

◆ getLocalReferenceMulti()

FileBackend::getLocalReferenceMulti ( array  $params)
abstract

Like getLocalReference() except it takes an array of storage paths and returns a map of storage paths to FSFile objects (or null on failure).

The map keys (paths) are in the same order as the provided list of paths.

See also
FileBackend::getLocalReference()
Parameters
array$paramsParameters include:
  • srcs : list of source storage paths
  • latest : use the latest available data
  • parallelize : try to do operations in parallel when possible
Returns
array Map of (path name => FSFile or null on failure)
Since
1.20

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Referenced by CopyFileBackend\copyFileBatch(), and getLocalReference().

◆ getName()

FileBackend::getName ( )
final

Get the unique backend name.

We may have multiple different backends of the same type. For example, we can have two Swift backends using different proxies.

Returns
string

Definition at line 167 of file FileBackend.php.

References $name.

Referenced by TestFileOpPerformance\doPerfTest(), FileBackendStore\executeOpHandlesInternal(), SyncFileBackend\replaceNamePaths(), and SyncFileBackend\syncFileBatch().

◆ getReadOnlyReason()

FileBackend::getReadOnlyReason ( )
final

Get an explanatory message if this backend is read-only.

Returns
string|bool Returns false if the backend is not read-only

Definition at line 196 of file FileBackend.php.

◆ getRootStoragePath()

FileBackend::getRootStoragePath ( )
final

Get the root storage path of this backend.

All container paths are "subdirectories" of this path.

Returns
string Storage path
Since
1.20

Definition at line 1299 of file FileBackend.php.

Referenced by CopyFileBackend\copyFileBatch(), CopyFileBackend\delFileBatch(), getContainerStoragePath(), and CopyFileBackend\getListingDiffRel().

◆ getScopedFileLocks()

FileBackend::getScopedFileLocks ( array  $paths,
  $type,
Status  $status 
)
final

Lock the files at the given storage paths in the backend.

This will either lock all the files or none (on failure). On failure, the status object will be updated with errors.

Once the return value goes out scope, the locks will be released and the status updated. Unlock fatals will not change the status "OK" value.

See also
ScopedLock::factory()
Parameters
array$pathsList of storage paths or map of lock types to path lists
int | string$typeLockManager::LOCK_* constant or "mixed"
Status$statusStatus to update on lock/unlock
Returns
ScopedLock|null Returns null on failure

Definition at line 1262 of file FileBackend.php.

References $type, as, and ScopedLock\factory().

Referenced by SwiftFileBackend\addMissingMetadata(), FileBackendStore\concatenate(), FileBackendStore\doClean(), FileBackendStore\doOperationsInternal(), FileBackendMultiWrite\getScopedLocksForOps(), FileBackendStore\getScopedLocksForOps(), and SyncFileBackend\syncFileBatch().

◆ getScopedLocksForOps()

FileBackend::getScopedLocksForOps ( array  $ops,
Status  $status 
)
abstract

Get an array of scoped locks needed for a batch of file operations.

Normally, FileBackend::doOperations() handles locking, unless the 'nonLocking' param is passed in. This function is useful if you want the files to be locked for a broader scope than just when the files are changing. For example, if you need to update DB metadata, you may want to keep the files locked until finished.

See also
FileBackend::doOperations()
Parameters
array$opsList of file operations to FileBackend::doOperations()
Status$statusStatus to update on lock/unlock
Returns
array List of ScopedFileLocks or null values
Since
1.20

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

◆ getScopedPHPBehaviorForOps()

FileBackend::getScopedPHPBehaviorForOps ( )
finalprotected

Enter file operation scope.

This just makes PHP ignore user aborts/disconnects until the return value leaves scope. This returns null and does nothing in CLI mode.

Returns
ScopedCallback|null

Definition at line 858 of file FileBackend.php.

Referenced by clean(), doOperations(), doQuickOperations(), prepare(), publish(), and secure().

◆ getTopDirectoryList()

FileBackend::getTopDirectoryList ( array  $params)
final

Same as FileBackend::getDirectoryList() except only lists directories that are immediately under the given directory.

Storage backends with eventual consistency might return stale data.

Failures during iteration can result in FileBackendError exceptions (since 1.22).

Parameters
array$paramsParameters include:
  • dir : storage directory
Returns
Traversable|Array|null Returns null on failure
Since
1.20

Definition at line 1142 of file FileBackend.php.

References array(), and getDirectoryList().

Referenced by FileBackendStore\doClean().

◆ getTopFileList()

FileBackend::getTopFileList ( array  $params)
final

Same as FileBackend::getFileList() except only lists files that are immediately under the given directory.

Storage backends with eventual consistency might return stale data.

Failures during iteration can result in FileBackendError exceptions (since 1.22).

Parameters
array$paramsParameters include:
  • dir : storage directory
  • adviseStat : set to true if stat requests will be made on the files (since 1.22)
Returns
Traversable|Array|null Returns null on failure
Since
1.20

Definition at line 1180 of file FileBackend.php.

References array(), and getFileList().

◆ getWikiId()

FileBackend::getWikiId ( )
final

Get the wiki identifier used for this backend (possibly empty).

Note that this might not be in the same format as wfWikiID().

Returns
string
Since
1.20

Definition at line 178 of file FileBackend.php.

References $wikiId.

Referenced by CopyFileBackend\copyFileBatch(), and CopyFileBackend\delFileBatch().

◆ hasFeatures()

FileBackend::hasFeatures (   $bitfield)
final

Check if the backend medium supports a field of extra features.

Returns
integer Bitfield of FileBackend::ATTR_* flags
bool
Since
1.23

Definition at line 217 of file FileBackend.php.

References getFeatures().

◆ isPathTraversalFree()

static FileBackend::isPathTraversalFree (   $path)
staticfinal

Check if a relative path has no directory traversals.

Parameters
string$path
Returns
bool
Since
1.20

Definition at line 1413 of file FileBackend.php.

References $path.

Referenced by FileRepo\validateFilename().

◆ isReadOnly()

FileBackend::isReadOnly ( )
final

Check if this backend is read-only.

Returns
bool

Definition at line 187 of file FileBackend.php.

Referenced by clean(), doOperations(), doQuickOperations(), prepare(), publish(), and secure().

◆ isStoragePath()

static FileBackend::isStoragePath (   $path)
staticfinal

Check if a given path is a "mwstore://" path.

This does not do any further validation or any existence checks.

Parameters
string$path
Returns
bool

Definition at line 1330 of file FileBackend.php.

References $path.

Referenced by ForeignAPIRepo\fileExistsBatch(), MediaTransformOutput\getLocalCopyPath(), UploadBase\initializePathInfo(), FileOp\normalizeIfValidStoragePath(), FileRepo\publishBatch(), FileRepo\quickImportBatch(), FileRepo\storeBatch(), StreamFile\stream(), MediaTransformOutput\streamFile(), FileBackendTest\testIsStoragePath(), and LocalFile\upload().

◆ lockFiles()

FileBackend::lockFiles ( array  $paths,
  $type 
)
final

Lock the files at the given storage paths in the backend.

This will either lock all the files or none (on failure).

Callers should consider using getScopedFileLocks() instead.

Parameters
array$pathsStorage paths
int$typeLockManager::LOCK_* constant
Returns
Status

Definition at line 1228 of file FileBackend.php.

References $type.

◆ makeContentDisposition()

static FileBackend::makeContentDisposition (   $type,
  $filename = '' 
)
staticfinal

Build a Content-Disposition header value per RFC 6266.

Parameters
string$typeOne of (attachment, inline)
string$filenameSuggested file name (should not contain slashes)
Exceptions
FileBackendError
Returns
string
Since
1.20

Definition at line 1426 of file FileBackend.php.

References $type, and array().

Referenced by File\getThumbDisposition().

◆ move()

FileBackend::move ( array  $params,
array  $opts = array() 
)
final

Performs a single move operation.

This sets $params['op'] to 'move' and passes it to doOperation().

See also
FileBackend::doOperation()
Parameters
array$paramsOperation parameters
array$optsOperation options
Returns
Status

Definition at line 458 of file FileBackend.php.

References array(), and doOperation().

◆ normalizeContainerPath()

static FileBackend::normalizeContainerPath (   $path)
staticfinalprotected

Validate and normalize a relative storage path.

Null is returned if the path involves directory traversal. Traversal is insecure for FS backends and broken for others.

This uses the same traversal protection as Title::secureAndSplit().

Parameters
string$pathStorage path relative to a container
Returns
string|null

Definition at line 1452 of file FileBackend.php.

References $path.

Referenced by normalizeStoragePath(), and FileBackendStore\resolveStoragePath().

◆ normalizeStoragePath()

static FileBackend::normalizeStoragePath (   $storagePath)
staticfinal

◆ parentStoragePath()

static FileBackend::parentStoragePath (   $storagePath)
staticfinal

Get the parent storage directory of a storage path.

This returns a path like "mwstore://backend/container", "mwstore://backend/container/...", or null if there is no parent.

Parameters
string$storagePath
Returns
string|null

Definition at line 1387 of file FileBackend.php.

References list, and splitStoragePath().

Referenced by StoreBatchTest\tearDown(), and FileBackendTest\testParentStoragePath().

◆ preloadCache()

FileBackend::preloadCache ( array  $paths)
abstract

Preload persistent file stat cache and property cache into in-process cache.

This should be used when stat calls will be made on a known list of a many files.

See also
FileBackend::getFileStat()
Parameters
array$pathsStorage paths

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

◆ preloadFileStat()

FileBackend::preloadFileStat ( array  $params)

Preload file stat information (concurrently if possible) into in-process cache.

This should be used when stat calls will be made on a known list of a many files.

See also
FileBackend::getFileStat()
Parameters
array$paramsParameters include:
  • srcs : list of source storage paths
  • latest : use the latest available data
Since
1.23

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

Definition at line 1215 of file FileBackend.php.

Referenced by SyncFileBackend\syncFileBatch().

◆ prepare()

FileBackend::prepare ( array  $params)
final

Prepare a storage directory for usage.

This will create any required containers and parent directories. Backends using key/value stores only need to create the container.

The 'noAccess' and 'noListing' parameters works the same as in secure(), except they are only applied if the directory/container had to be created. These flags should always be set for directories that have private files. However, setting them is not guaranteed to actually do anything. Additional server configuration may be needed to achieve the desired effect.

Parameters
array$paramsParameters include:
  • dir : storage directory
  • noAccess : try to deny file access (since 1.20)
  • noListing : try to deny file listing (since 1.20)
  • bypassReadOnly : allow writes in read-only mode (since 1.20)
Returns
Status

Definition at line 754 of file FileBackend.php.

References $params, doPrepare(), getScopedPHPBehaviorForOps(), isReadOnly(), name, and Status\newFatal().

Referenced by CopyFileBackend\copyFileBatch(), TestFileOpPerformance\doPerfTest(), ForeignAPIRepo\getThumbUrlFromCache(), and SyncFileBackend\syncFileBatch().

◆ publish()

FileBackend::publish ( array  $params)
final

Remove measures to block web access to a storage directory and the container it belongs to.

FS backends might remove .htaccess files whereas key/value store backends might grant container access to the storage user representing end-users in web requests. This essentially can undo the result of secure() calls.

This is not guaranteed to actually make files or listings publically viewable. Additional server configuration may be needed to achieve the desired effect.

Parameters
array$paramsParameters include:
  • dir : storage directory
  • access : try to allow file access
  • listing : try to allow file listing
  • bypassReadOnly : allow writes in read-only mode (since 1.20)
Returns
Status
Since
1.20

Definition at line 814 of file FileBackend.php.

References $params, doPublish(), getScopedPHPBehaviorForOps(), isReadOnly(), name, and Status\newFatal().

◆ quickCopy()

FileBackend::quickCopy ( array  $params)
final

Performs a single quick copy operation.

This sets $params['op'] to 'copy' and passes it to doQuickOperation().

See also
FileBackend::doQuickOperation()
Parameters
array$paramsOperation parameters
Returns
Status
Since
1.20

Definition at line 676 of file FileBackend.php.

References array(), and doQuickOperation().

◆ quickCreate()

FileBackend::quickCreate ( array  $params)
final

Performs a single quick create operation.

This sets $params['op'] to 'create' and passes it to doQuickOperation().

See also
FileBackend::doQuickOperation()
Parameters
array$paramsOperation parameters
Returns
Status
Since
1.20

Definition at line 648 of file FileBackend.php.

References array(), and doQuickOperation().

Referenced by ForeignAPIRepo\getThumbUrlFromCache().

◆ quickDelete()

FileBackend::quickDelete ( array  $params)
final

Performs a single quick delete operation.

This sets $params['op'] to 'delete' and passes it to doQuickOperation().

See also
FileBackend::doQuickOperation()
Parameters
array$paramsOperation parameters
Returns
Status
Since
1.20

Definition at line 704 of file FileBackend.php.

References array(), and doQuickOperation().

◆ quickDescribe()

FileBackend::quickDescribe ( array  $params)
final

Performs a single quick describe operation.

This sets $params['op'] to 'describe' and passes it to doQuickOperation().

See also
FileBackend::doQuickOperation()
Parameters
array$paramsOperation parameters
Returns
Status
Since
1.21

Definition at line 718 of file FileBackend.php.

References array(), and doQuickOperation().

◆ quickMove()

FileBackend::quickMove ( array  $params)
final

Performs a single quick move operation.

This sets $params['op'] to 'move' and passes it to doQuickOperation().

See also
FileBackend::doQuickOperation()
Parameters
array$paramsOperation parameters
Returns
Status
Since
1.20

Definition at line 690 of file FileBackend.php.

References array(), and doQuickOperation().

◆ quickStore()

FileBackend::quickStore ( array  $params)
final

Performs a single quick store operation.

This sets $params['op'] to 'store' and passes it to doQuickOperation().

See also
FileBackend::doQuickOperation()
Parameters
array$paramsOperation parameters
Returns
Status
Since
1.20

Definition at line 662 of file FileBackend.php.

References array(), and doQuickOperation().

◆ secure()

FileBackend::secure ( array  $params)
final

Take measures to block web access to a storage directory and the container it belongs to.

FS backends might add .htaccess files whereas key/value store backends might revoke container access to the storage user representing end-users in web requests.

This is not guaranteed to actually make files or listings publically hidden. Additional server configuration may be needed to achieve the desired effect.

Parameters
array$paramsParameters include:
  • dir : storage directory
  • noAccess : try to deny file access
  • noListing : try to deny file listing
  • bypassReadOnly : allow writes in read-only mode (since 1.20)
Returns
Status

Definition at line 783 of file FileBackend.php.

References $params, doSecure(), getScopedPHPBehaviorForOps(), isReadOnly(), name, and Status\newFatal().

◆ splitStoragePath()

◆ store()

FileBackend::store ( array  $params,
array  $opts = array() 
)
final

Performs a single store operation.

This sets $params['op'] to 'store' and passes it to doOperation().

See also
FileBackend::doOperation()
Parameters
array$paramsOperation parameters
array$optsOperation options
Returns
Status

Definition at line 430 of file FileBackend.php.

References array(), and doOperation().

◆ streamFile()

FileBackend::streamFile ( array  $params)
abstract

Stream the file at a storage path in the backend.

If the file does not exists, an HTTP 404 error will be given. Appropriate HTTP headers (Status, Content-Type, Content-Length) will be sent if streaming began, while none will be sent otherwise. Implementations should flush the output buffer before sending data.

Parameters
array$paramsParameters include:
  • src : source storage path
  • headers : list of additional HTTP headers to send on success
  • latest : use the latest available data
Returns
Status

Reimplemented in FileBackendStore, and FileBackendMultiWrite.

◆ unlockFiles()

FileBackend::unlockFiles ( array  $paths,
  $type 
)
final

Unlock the files at the given storage paths in the backend.

Parameters
array$pathsStorage paths
int$typeLockManager::LOCK_* constant
Returns
Status

Definition at line 1241 of file FileBackend.php.

References $type.

Member Data Documentation

◆ $concurrency

int FileBackend::$concurrency
protected

How many operations can be done in parallel *.

Definition at line 94 of file FileBackend.php.

Referenced by FileBackendStore\doQuickOperationsInternal(), and FileBackendStore\setConcurrencyFlags().

◆ $fileJournal

FileJournal FileBackend::$fileJournal
protected

Definition at line 98 of file FileBackend.php.

Referenced by FileBackendMultiWrite\__construct(), and getJournal().

◆ $lockManager

LockManager FileBackend::$lockManager
protected

Definition at line 96 of file FileBackend.php.

◆ $name

◆ $parallelize

string FileBackend::$parallelize
protected

When to do operations in parallel *.

Definition at line 92 of file FileBackend.php.

◆ $readOnly

string FileBackend::$readOnly
protected

Read-only explanation message *.

Definition at line 90 of file FileBackend.php.

◆ $wikiId

string FileBackend::$wikiId
protected

Unique wiki name *.

Definition at line 88 of file FileBackend.php.

Referenced by FileBackendMultiWrite\__construct(), and getWikiId().

◆ ATTR_HEADERS

const FileBackend::ATTR_HEADERS = 1

Flags for supported features.

Definition at line 101 of file FileBackend.php.

Referenced by FileBackendTest\doTestDescribe(), and SwiftFileBackend\getFeatures().

◆ ATTR_METADATA

const FileBackend::ATTR_METADATA = 2

Definition at line 102 of file FileBackend.php.

Referenced by SwiftFileBackend\getFeatures().


The documentation for this class was generated from the following file:
of
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
Definition: globals.txt:10
contents
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their contents
Definition: database.txt:2
system
processing should stop and the error should be shown to the user if you wanted to authenticate users to a custom system(LDAP, another PHP program, whatever)
file
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
Definition: hooks.txt:93
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
storage
For QUnit the mediawiki tests qunit testrunner dependency will be added to any module it s the URL of the revision text in external storage
Definition: hooks.txt:2107
name
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
Definition: design.txt:12