MediaWiki  1.23.6
FileBackendMultiWrite Class Reference

Proxy backend that mirrors writes to several internal backends. More...

Inheritance diagram for FileBackendMultiWrite:
Collaboration diagram for FileBackendMultiWrite:

Public Member Functions

 __construct (array $config)
 Construct a proxy backend that consists of several internal backends. More...
 
 accessibilityCheck (array $paths)
 Check that a set of file paths are usable across all internal backends. 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...
 
 consistencyCheck (array $paths)
 Check that a set of files are consistent across all internal backends. More...
 
 directoryExists (array $params)
 Check if a directory exists at a given storage path. More...
 
 fileExists (array $params)
 Check if a file exists at a storage path in the 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...
 
 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...
 
 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...
 
 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...
 
 getScopedLocksForOps (array $ops, Status $status)
 Get an array of scoped locks needed for a batch of file operations. 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...
 
 resyncFiles (array $paths)
 Check that a set of files are consistent across all internal backends and re-synchronize those files againt the "multi master" if needed. More...
 
 streamFile (array $params)
 Stream the file at a storage path in the backend. More...
 
- Public Member Functions inherited from FileBackend
 clean (array $params)
 Delete a storage directory if it is empty. 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...
 
 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...
 
 getContainerStoragePath ( $container)
 Get the storage path for the given container for this backend. More...
 
 getFileContents (array $params)
 Get the contents of 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...
 
 getLocalReference (array $params)
 Returns a file system file, identical to the file at a storage path. 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...
 
 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...
 
 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...
 
 unlockFiles (array $paths, $type)
 Unlock the files at the given storage paths in the backend. More...
 

Public Attributes

const CHECK_SHA1 = 4
 
const CHECK_SIZE = 1
 
const CHECK_TIME = 2
 
- Public Attributes inherited from FileBackend
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)
 
 fileStoragePathsForOps (array $ops)
 Get a list of file storage paths to read or write for a list of operations. More...
 
 replicateContainerDirChanges ( $path)
 
 substOpBatchPaths (array $ops, FileBackendStore $backend)
 Substitute the backend name in storage path parameters for a set of operations with that of a given internal backend. More...
 
 substOpPaths (array $ops, FileBackendStore $backend)
 Same as substOpBatchPaths() but for a single operation. More...
 
 substPaths ( $paths, FileBackendStore $backend)
 Substitute the backend of storage paths with an internal backend's name. More...
 
 unsubstPaths ( $paths)
 Substitute the backend of internal storage paths with the proxy backend's name. More...
 
- Protected Member Functions inherited from FileBackend
 getScopedPHPBehaviorForOps ()
 Enter file operation scope. More...
 

Protected Attributes

string bool $autoResync = false
 
array $backends = array()
 Prioritized list of FileBackendStore objects. More...
 
int $masterIndex = -1
 Index of master backend *. More...
 
array $noPushDirConts = array()
 
bool $noPushQuickOps = false
 
int $syncChecks = 0
 Bitfield *. More...
 
- Protected Attributes inherited from FileBackend
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from FileBackend
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...
 
- Static Protected Member Functions inherited from FileBackend
static normalizeContainerPath ( $path)
 Validate and normalize a relative storage path. More...
 

Detailed Description

Proxy backend that mirrors writes to several internal backends.

This class defines a multi-write backend. Multiple backends can be registered to this proxy backend and it will act as a single backend. Use this when all access to those backends is through this proxy backend. At least one of the backends must be declared the "master" backend.

Only use this class when transitioning from one storage system to another.

Read operations are only done on the 'master' backend for consistency. Write operations are performed on all backends, in the order defined. If an operation fails on one backend it will be rolled back from the others.

Since
1.19

Definition at line 42 of file FileBackendMultiWrite.php.

Constructor & Destructor Documentation

◆ __construct()

FileBackendMultiWrite::__construct ( array  $config)

Construct a proxy backend that consists of several internal backends.

Locking, journaling, and read-only checks are handled by the proxy backend.

Additional $config params include:

  • backends : Array of backend config and multi-backend settings. Each value is the config used in the constructor of a FileBackendStore class, but with these additional settings:
    • class : The name of the backend class
    • isMultiMaster : This must be set for one backend.
    • template: : If given a backend name, this will use the config of that backend as a template. Values specified here take precedence.
  • syncChecks : Integer bitfield of internal backend sync checks to perform. Possible bits include the FileBackendMultiWrite::CHECK_* constants. There are constants for SIZE, TIME, and SHA1. The checks are done before allowing any file operations.
  • autoResync : Automatically resync the clone backends to the master backend when pre-operation sync checks fail. This should only be used if the master backend is stable and not missing any files. Use "conservative" to limit resyncing to copying newer master backend files over older (or non-existing) clone backend files. Cases that cannot be handled will result in operation abortion.
  • noPushQuickOps : (hack) Only apply doQuickOperations() to the master backend.
  • noPushDirConts : (hack) Only apply directory functions to the master backend.
Parameters
array$config
Exceptions
FileBackendError

Reimplemented from FileBackend.

Definition at line 91 of file FileBackendMultiWrite.php.

References FileBackend\$fileJournal, FileBackend\$name, FileBackend\$wikiId, array(), as, CHECK_SIZE, and FileBackendGroup\singleton().

Member Function Documentation

◆ accessibilityCheck()

FileBackendMultiWrite::accessibilityCheck ( array  $paths)

Check that a set of file paths are usable across all internal backends.

Parameters
array$pathsList of storage paths
Returns
Status

Definition at line 276 of file FileBackendMultiWrite.php.

References $path, as, Status\newGood(), and substPaths().

Referenced by doOperationsInternal().

◆ clearCache()

FileBackendMultiWrite::clearCache ( array  $paths = null)

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 from FileBackend.

Definition at line 652 of file FileBackendMultiWrite.php.

References as, and substPaths().

Referenced by doOperationsInternal().

◆ concatenate()

FileBackendMultiWrite::concatenate ( array  $params)

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 from FileBackend.

Definition at line 533 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ consistencyCheck()

FileBackendMultiWrite::consistencyCheck ( array  $paths)

Check that a set of files are consistent across all internal backends.

Parameters
array$pathsList of storage paths
Returns
Status

Definition at line 210 of file FileBackendMultiWrite.php.

References $masterIndex, $params, $path, array(), as, Status\newGood(), substOpPaths(), TS_UNIX, and wfTimestamp().

Referenced by doOperationsInternal().

◆ directoryExists()

FileBackendMultiWrite::directoryExists ( array  $params)

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 from FileBackend.

Definition at line 630 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ doClean()

FileBackendMultiWrite::doClean ( array  $params)
protected
See also
FileBackend::clean()

Reimplemented from FileBackend.

Definition at line 520 of file FileBackendMultiWrite.php.

References as, Status\newGood(), replicateContainerDirChanges(), and substOpPaths().

◆ doOperationsInternal()

FileBackendMultiWrite::doOperationsInternal ( array  $ops,
array  $opts 
)
finalprotected

◆ doPrepare()

FileBackendMultiWrite::doPrepare ( array  $params)
protected
See also
FileBackend::prepare()

Reimplemented from FileBackend.

Definition at line 481 of file FileBackendMultiWrite.php.

References as, Status\newGood(), replicateContainerDirChanges(), and substOpPaths().

◆ doPublish()

FileBackendMultiWrite::doPublish ( array  $params)
protected
See also
FileBackend::publish()

Reimplemented from FileBackend.

Definition at line 507 of file FileBackendMultiWrite.php.

References as, Status\newGood(), replicateContainerDirChanges(), and substOpPaths().

◆ doQuickOperationsInternal()

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

Reimplemented from FileBackend.

Definition at line 446 of file FileBackendMultiWrite.php.

References $masterIndex, as, Status\newGood(), and substOpBatchPaths().

◆ doSecure()

FileBackendMultiWrite::doSecure ( array  $params)
protected
See also
FileBackend::secure()

Reimplemented from FileBackend.

Definition at line 494 of file FileBackendMultiWrite.php.

References as, Status\newGood(), replicateContainerDirChanges(), and substOpPaths().

◆ fileExists()

FileBackendMultiWrite::fileExists ( array  $params)

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 from FileBackend.

Definition at line 540 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

Referenced by fileStoragePathsForOps().

◆ fileStoragePathsForOps()

FileBackendMultiWrite::fileStoragePathsForOps ( array  $ops)
protected

Get a list of file storage paths to read or write for a list of operations.

Parameters
array$opsSame format as doOperations()
Returns
array List of storage paths to files (does not include directories)

Definition at line 358 of file FileBackendMultiWrite.php.

References array(), as, and fileExists().

Referenced by doOperationsInternal().

◆ getDirectoryList()

FileBackendMultiWrite::getDirectoryList ( array  $params)

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 from FileBackend.

Definition at line 636 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getFeatures()

FileBackendMultiWrite::getFeatures ( )

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

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

Reimplemented from FileBackend.

Definition at line 648 of file FileBackendMultiWrite.php.

References $masterIndex.

◆ getFileContentsMulti()

FileBackendMultiWrite::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).

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 from FileBackend.

Definition at line 570 of file FileBackendMultiWrite.php.

References $masterIndex, $path, array(), as, substOpPaths(), and unsubstPaths().

◆ getFileHttpUrl()

FileBackendMultiWrite::getFileHttpUrl ( array  $params)

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 from FileBackend.

Definition at line 624 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getFileList()

FileBackendMultiWrite::getFileList ( array  $params)

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 from FileBackend.

Definition at line 642 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getFileProps()

FileBackendMultiWrite::getFileProps ( array  $params)

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 from FileBackend.

Definition at line 588 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getFileSha1Base36()

FileBackendMultiWrite::getFileSha1Base36 ( array  $params)

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 from FileBackend.

Definition at line 582 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getFileSize()

FileBackendMultiWrite::getFileSize ( array  $params)

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 from FileBackend.

Definition at line 552 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getFileStat()

FileBackendMultiWrite::getFileStat ( array  $params)

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 from FileBackend.

Definition at line 558 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getFileTimestamp()

FileBackendMultiWrite::getFileTimestamp ( array  $params)

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 from FileBackend.

Definition at line 546 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getFileXAttributes()

FileBackendMultiWrite::getFileXAttributes ( array  $params)

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 from FileBackend.

Definition at line 564 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ getLocalCopyMulti()

FileBackendMultiWrite::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).

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 from FileBackend.

Definition at line 612 of file FileBackendMultiWrite.php.

References $masterIndex, $path, array(), as, substOpPaths(), and unsubstPaths().

◆ getLocalReferenceMulti()

FileBackendMultiWrite::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).

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 from FileBackend.

Definition at line 600 of file FileBackendMultiWrite.php.

References $masterIndex, $path, array(), as, substOpPaths(), and unsubstPaths().

◆ getScopedLocksForOps()

FileBackendMultiWrite::getScopedLocksForOps ( array  $ops,
Status  $status 
)

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 from FileBackend.

Definition at line 669 of file FileBackendMultiWrite.php.

References $masterIndex, array(), FileBackend\getScopedFileLocks(), LockManager\LOCK_EX, LockManager\LOCK_UW, substOpBatchPaths(), and unsubstPaths().

Referenced by doOperationsInternal().

◆ preloadCache()

FileBackendMultiWrite::preloadCache ( array  $paths)

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 from FileBackend.

Definition at line 659 of file FileBackendMultiWrite.php.

References $masterIndex, and substPaths().

◆ preloadFileStat()

FileBackendMultiWrite::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 from FileBackend.

Definition at line 664 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ replicateContainerDirChanges()

FileBackendMultiWrite::replicateContainerDirChanges (   $path)
protected
Parameters
string$pathStorage path
Returns
bool Path container should have dir changes pushed to all backends

Definition at line 475 of file FileBackendMultiWrite.php.

References $path, list, and FileBackend\splitStoragePath().

Referenced by doClean(), doPrepare(), doPublish(), and doSecure().

◆ resyncFiles()

FileBackendMultiWrite::resyncFiles ( array  $paths)

Check that a set of files are consistent across all internal backends and re-synchronize those files againt the "multi master" if needed.

Parameters
array$pathsList of storage paths
Returns
Status

Definition at line 301 of file FileBackendMultiWrite.php.

References $masterIndex, $path, array(), as, name, Status\newGood(), and substPaths().

Referenced by doOperationsInternal().

◆ streamFile()

FileBackendMultiWrite::streamFile ( array  $params)

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 from FileBackend.

Definition at line 594 of file FileBackendMultiWrite.php.

References $masterIndex, and substOpPaths().

◆ substOpBatchPaths()

FileBackendMultiWrite::substOpBatchPaths ( array  $ops,
FileBackendStore  $backend 
)
protected

Substitute the backend name in storage path parameters for a set of operations with that of a given internal backend.

Parameters
array$opsList of file operation arrays
FileBackendStore$backend
Returns
array

Definition at line 389 of file FileBackendMultiWrite.php.

References array(), as, and substPaths().

Referenced by doOperationsInternal(), doQuickOperationsInternal(), getScopedLocksForOps(), and substOpPaths().

◆ substOpPaths()

◆ substPaths()

FileBackendMultiWrite::substPaths (   $paths,
FileBackendStore  $backend 
)
protected

Substitute the backend of storage paths with an internal backend's name.

Parameters
array | string$pathsList of paths or single string path
FileBackendStore$backend
Returns
array|string

Definition at line 424 of file FileBackendMultiWrite.php.

References StringUtils\escapeRegexReplacement(), and name.

Referenced by accessibilityCheck(), clearCache(), preloadCache(), resyncFiles(), and substOpBatchPaths().

◆ unsubstPaths()

FileBackendMultiWrite::unsubstPaths (   $paths)
protected

Substitute the backend of internal storage paths with the proxy backend's name.

Parameters
array | string$pathsList of paths or single string path
Returns
array|string

Definition at line 438 of file FileBackendMultiWrite.php.

References StringUtils\escapeRegexReplacement().

Referenced by getFileContentsMulti(), getLocalCopyMulti(), getLocalReferenceMulti(), and getScopedLocksForOps().

Member Data Documentation

◆ $autoResync

string bool FileBackendMultiWrite::$autoResync = false
protected

Definition at line 51 of file FileBackendMultiWrite.php.

◆ $backends

array FileBackendMultiWrite::$backends = array()
protected

Prioritized list of FileBackendStore objects.

array of (backend index => backends)

Definition at line 45 of file FileBackendMultiWrite.php.

◆ $masterIndex

◆ $noPushDirConts

array FileBackendMultiWrite::$noPushDirConts = array()
protected

Definition at line 53 of file FileBackendMultiWrite.php.

◆ $noPushQuickOps

bool FileBackendMultiWrite::$noPushQuickOps = false
protected

Definition at line 55 of file FileBackendMultiWrite.php.

◆ $syncChecks

int FileBackendMultiWrite::$syncChecks = 0
protected

Bitfield *.

Definition at line 49 of file FileBackendMultiWrite.php.

◆ CHECK_SHA1

const FileBackendMultiWrite::CHECK_SHA1 = 4

Definition at line 60 of file FileBackendMultiWrite.php.

◆ CHECK_SIZE

const FileBackendMultiWrite::CHECK_SIZE = 1

Definition at line 58 of file FileBackendMultiWrite.php.

Referenced by __construct().

◆ CHECK_TIME

const FileBackendMultiWrite::CHECK_TIME = 2

Definition at line 59 of file FileBackendMultiWrite.php.


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