MediaWiki
REL1_19
|
This class defines a multi-write backend. More...
Public Member Functions | |
__construct (array $config) | |
Construct a proxy backend that consists of several internal backends. | |
clearCache (array $paths=null) | |
concatenate (array $params) | |
consistencyCheck (array $paths) | |
Check that a set of files are consistent across all internal backends. | |
doClean (array $params) | |
doPrepare (array $params) | |
doSecure (array $params) | |
fileExists (array $params) | |
getFileContents (array $params) | |
getFileList (array $params) | |
getFileProps (array $params) | |
getFileSha1Base36 (array $params) | |
getFileSize (array $params) | |
getFileStat (array $params) | |
getFileTimestamp (array $params) | |
getLocalCopy (array $params) | |
getLocalReference (array $params) | |
streamFile (array $params) | |
Public Attributes | |
const | CHECK_SIZE = 1 |
const | CHECK_TIME = 2 |
Protected Member Functions | |
doOperationsInternal (array $ops, array $opts) | |
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. | |
substOpPaths (array $ops, FileBackendStore $backend) | |
Same as substOpBatchPaths() but for a single operation. | |
substPaths ($paths, FileBackendStore $backend) | |
Substitute the backend of storage paths with an internal backend's name. | |
unsubstPaths ($paths) | |
Substitute the backend of internal storage paths with the proxy backend's name. | |
Protected Attributes | |
$backends = array() | |
$masterIndex = -1 | |
$syncChecks = 0 |
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.
Definition at line 23 of file FileBackendMultiWrite.php.
FileBackendMultiWrite::__construct | ( | array $ | config | ) |
Construct a proxy backend that consists of several internal backends.
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. 'syncChecks' : Integer bitfield of internal backend sync checks to perform. Possible bits include self::CHECK_SIZE and self::CHECK_TIME. The checks are done before allowing any file operations.
$config | Array |
Reimplemented from FileBackend.
Definition at line 46 of file FileBackendMultiWrite.php.
References FileBackend\$name, and CHECK_SIZE.
FileBackendMultiWrite::clearCache | ( | array $ | paths = null | ) |
Reimplemented from FileBackend.
Definition at line 414 of file FileBackendMultiWrite.php.
References substPaths().
Referenced by doOperationsInternal().
FileBackendMultiWrite::concatenate | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 317 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::consistencyCheck | ( | array $ | paths | ) |
Check that a set of files are consistent across all internal backends.
$paths | Array |
Definition at line 168 of file FileBackendMultiWrite.php.
References $path, Status\newGood(), substOpPaths(), and wfTimestamp().
Referenced by doOperationsInternal().
FileBackendMultiWrite::doClean | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 305 of file FileBackendMultiWrite.php.
References Status\newGood(), and substOpPaths().
FileBackendMultiWrite::doOperationsInternal | ( | array $ | ops, |
array $ | opts | ||
) | [final, protected] |
Reimplemented from FileBackend.
Definition at line 80 of file FileBackendMultiWrite.php.
References $success, FileOp\attemptBatch(), clearCache(), consistencyCheck(), FileBackend\getScopedFileLocks(), LockManager\LOCK_EX, LockManager\LOCK_UW, Status\newGood(), substOpBatchPaths(), and unsubstPaths().
FileBackendMultiWrite::doPrepare | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 281 of file FileBackendMultiWrite.php.
References Status\newGood(), and substOpPaths().
FileBackendMultiWrite::doSecure | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 293 of file FileBackendMultiWrite.php.
References Status\newGood(), and substOpPaths().
FileBackendMultiWrite::fileExists | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 326 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getFileContents | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 358 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getFileList | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 406 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getFileProps | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 374 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getFileSha1Base36 | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 366 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getFileSize | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 342 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getFileStat | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 350 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getFileTimestamp | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 334 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getLocalCopy | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 398 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::getLocalReference | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 390 of file FileBackendMultiWrite.php.
References substOpPaths().
FileBackendMultiWrite::streamFile | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 382 of file FileBackendMultiWrite.php.
References substOpPaths().
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.
$ops | Array List of file operation arrays |
$backend | FileBackendStore |
Definition at line 223 of file FileBackendMultiWrite.php.
References substPaths().
Referenced by doOperationsInternal(), and substOpPaths().
FileBackendMultiWrite::substOpPaths | ( | array $ | ops, |
FileBackendStore $ | backend | ||
) | [protected] |
Same as substOpBatchPaths() but for a single operation.
$op | File operation array |
$backend | FileBackendStore |
Definition at line 244 of file FileBackendMultiWrite.php.
References substOpBatchPaths().
Referenced by concatenate(), consistencyCheck(), doClean(), doPrepare(), doSecure(), fileExists(), getFileContents(), getFileList(), getFileProps(), getFileSha1Base36(), getFileSize(), getFileStat(), getFileTimestamp(), getLocalCopy(), getLocalReference(), and streamFile().
FileBackendMultiWrite::substPaths | ( | $ | paths, |
FileBackendStore $ | backend | ||
) | [protected] |
Substitute the backend of storage paths with an internal backend's name.
$paths | Array|string List of paths or single string path |
$backend | FileBackendStore |
Definition at line 256 of file FileBackendMultiWrite.php.
References StringUtils\escapeRegexReplacement().
Referenced by clearCache(), and substOpBatchPaths().
FileBackendMultiWrite::unsubstPaths | ( | $ | paths | ) | [protected] |
Substitute the backend of internal storage paths with the proxy backend's name.
$paths | Array|string List of paths or single string path |
Definition at line 270 of file FileBackendMultiWrite.php.
References StringUtils\escapeRegexReplacement().
Referenced by doOperationsInternal().
FileBackendMultiWrite::$backends = array() [protected] |
Definition at line 25 of file FileBackendMultiWrite.php.
FileBackendMultiWrite::$masterIndex = -1 [protected] |
Definition at line 26 of file FileBackendMultiWrite.php.
FileBackendMultiWrite::$syncChecks = 0 [protected] |
Definition at line 27 of file FileBackendMultiWrite.php.
const FileBackendMultiWrite::CHECK_SIZE = 1 |
Definition at line 30 of file FileBackendMultiWrite.php.
Referenced by __construct().
const FileBackendMultiWrite::CHECK_TIME = 2 |
Definition at line 31 of file FileBackendMultiWrite.php.