MediaWiki
REL1_23
|
Class for a file system (FS) based file backend. More...
Public Member Functions | |
__construct (array $config) | |
getDirectoryListInternal ($fullCont, $dirRel, array $params) | |
getFileListInternal ($fullCont, $dirRel, array $params) | |
handleWarning ($errno, $errstr) | |
isPathUsableInternal ($storagePath) | |
Check if a file can be created or changed at a given storage path. | |
Protected Member Functions | |
chmod ($path) | |
Chmod a file, suppressing the warnings. | |
cleanPathSlashes ($path) | |
Clean up directory separators for the given OS. | |
containerFSRoot ($shortCont, $fullCont) | |
Given the short (unresolved) and full (resolved) name of a container, return the file system path of the container. | |
directoriesAreVirtual () | |
Is this a key/value store where directories are just virtual? Virtual directories exists in so much as files exists that are prefixed with the directory path followed by a forward slash. | |
doCleanInternal ($fullCont, $dirRel, array $params) | |
doClearCache (array $paths=null) | |
doCopyInternal (array $params) | |
doCreateInternal (array $params) | |
doDeleteInternal (array $params) | |
doDirectoryExists ($fullCont, $dirRel, array $params) | |
doExecuteOpHandlesInternal (array $fileOpHandles) | |
doGetFileStat (array $params) | |
doGetLocalCopyMulti (array $params) | |
doGetLocalReferenceMulti (array $params) | |
doMoveInternal (array $params) | |
doPrepareInternal ($fullCont, $dirRel, array $params) | |
doPublishInternal ($fullCont, $dirRel, array $params) | |
doSecureInternal ($fullCont, $dirRel, array $params) | |
doStoreInternal (array $params) | |
getResponseCopy ($errors, Status $status, array $params, $cmd) | |
getResponseCreate ($errors, Status $status, array $params, $cmd) | |
getResponseDelete ($errors, Status $status, array $params, $cmd) | |
getResponseMove ($errors, Status $status, array $params, $cmd) | |
getResponseStore ($errors, Status $status, array $params, $cmd) | |
htaccessPrivate () | |
Return the text of a .htaccess file to make a directory private. | |
indexHtmlPrivate () | |
Return the text of an index.html file to hide directory listings. | |
isLegalRelPath ($path) | |
Sanity check a relative file system path for validity. | |
resolveContainerPath ($container, $relStoragePath) | |
Resolve a relative storage path, checking if it's allowed by the backend. | |
resolveToFSPath ($storagePath) | |
Get the absolute file system path for a storage path. | |
trapWarnings () | |
Listen for E_WARNING errors and track whether any happen. | |
untrapWarnings () | |
Stop listening for E_WARNING errors and return true if any happened. | |
Protected Attributes | |
string | $basePath |
Directory holding the container directories *. | |
array | $containerPaths = array() |
Map of container names to root paths for custom container paths *. | |
string | $currentUser |
OS username running this script *. | |
int | $fileMode |
File permission mode *. | |
string | $fileOwner |
Required OS username to own files *. | |
array | $hadWarningErrors = array() |
* |
Class for a file system (FS) based file backend.
All "containers" each map to a directory under the backend's base directory. For backwards-compatibility, some container paths can be set to custom paths. The wiki ID will not be used in any custom paths, so this should be avoided.
Having directories with thousands of files will diminish performance. Sharding can be accomplished by using FileRepo-style hash paths.
Status messages should avoid mentioning the internal FS paths. PHP warnings are assumed to be logged rather than output.
Definition at line 41 of file FSFileBackend.php.
FSFileBackend::__construct | ( | array $ | config | ) |
Reimplemented from FileBackendStore.
Definition at line 62 of file FSFileBackend.php.
FSFileBackend::chmod | ( | $ | path | ) | [protected] |
Chmod a file, suppressing the warnings.
string | $path | Absolute file system path |
Definition at line 727 of file FSFileBackend.php.
FSFileBackend::cleanPathSlashes | ( | $ | path | ) | [protected] |
Clean up directory separators for the given OS.
string | $path | FS path |
Definition at line 759 of file FSFileBackend.php.
FSFileBackend::containerFSRoot | ( | $ | shortCont, |
$ | fullCont | ||
) | [protected] |
Given the short (unresolved) and full (resolved) name of a container, return the file system path of the container.
string | $shortCont | |
string | $fullCont |
Definition at line 125 of file FSFileBackend.php.
FSFileBackend::directoriesAreVirtual | ( | ) | [protected] |
Is this a key/value store where directories are just virtual? Virtual directories exists in so much as files exists that are prefixed with the directory path followed by a forward slash.
Reimplemented from FileBackendStore.
Definition at line 687 of file FSFileBackend.php.
FSFileBackend::doCleanInternal | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
$container | ||
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 535 of file FSFileBackend.php.
FSFileBackend::doClearCache | ( | array $ | paths = null | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 574 of file FSFileBackend.php.
FSFileBackend::doCopyInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 280 of file FSFileBackend.php.
References Status\fatal().
FSFileBackend::doCreateInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 176 of file FSFileBackend.php.
FSFileBackend::doDeleteInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 401 of file FSFileBackend.php.
References Status\fatal().
FSFileBackend::doDirectoryExists | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
string | $container | Resolved container name |
string | $dir | Resolved path relative to container |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 578 of file FSFileBackend.php.
FSFileBackend::doExecuteOpHandlesInternal | ( | array $ | fileOpHandles | ) | [protected] |
array | $fileOpHandles |
FileBackendError |
Reimplemented from FileBackendStore.
Definition at line 691 of file FSFileBackend.php.
FSFileBackend::doGetFileStat | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 549 of file FSFileBackend.php.
FSFileBackend::doGetLocalCopyMulti | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 655 of file FSFileBackend.php.
FSFileBackend::doGetLocalReferenceMulti | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 640 of file FSFileBackend.php.
FSFileBackend::doMoveInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 344 of file FSFileBackend.php.
References Status\fatal().
FSFileBackend::doPrepareInternal | ( | $ | fullCont, |
$ | dirRel, | ||
array $ | params | ||
) | [protected] |
string | $fullCont | |
$dirRel | ||
array | $params |
Reimplemented from FileBackendStore.
Definition at line 455 of file FSFileBackend.php.
FSFileBackend::doPublishInternal | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
$container | ||
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 507 of file FSFileBackend.php.
FSFileBackend::doSecureInternal | ( | $ | container, |
$ | dir, | ||
array $ | params | ||
) | [protected] |
$container | ||
string | $dir | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 479 of file FSFileBackend.php.
FSFileBackend::doStoreInternal | ( | array $ | params | ) | [protected] |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 233 of file FSFileBackend.php.
References Status\fatal().
FSFileBackend::getDirectoryListInternal | ( | $ | fullCont, |
$ | dirRel, | ||
array $ | params | ||
) |
string | $fullCont | |
string | $dirRel | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 597 of file FSFileBackend.php.
FSFileBackend::getFileListInternal | ( | $ | fullCont, |
$ | dirRel, | ||
array $ | params | ||
) |
string | $fullCont | |
string | $dirRel | |
array | $params |
Reimplemented from FileBackendStore.
Definition at line 622 of file FSFileBackend.php.
FSFileBackend::getResponseCopy | ( | $ | errors, |
Status $ | status, | ||
array $ | params, | ||
$ | cmd | ||
) | [protected] |
Definition at line 337 of file FSFileBackend.php.
FSFileBackend::getResponseCreate | ( | $ | errors, |
Status $ | status, | ||
array $ | params, | ||
$ | cmd | ||
) | [protected] |
Definition at line 226 of file FSFileBackend.php.
FSFileBackend::getResponseDelete | ( | $ | errors, |
Status $ | status, | ||
array $ | params, | ||
$ | cmd | ||
) | [protected] |
Definition at line 442 of file FSFileBackend.php.
FSFileBackend::getResponseMove | ( | $ | errors, |
Status $ | status, | ||
array $ | params, | ||
$ | cmd | ||
) | [protected] |
Definition at line 394 of file FSFileBackend.php.
FSFileBackend::getResponseStore | ( | $ | errors, |
Status $ | status, | ||
array $ | params, | ||
$ | cmd | ||
) | [protected] |
Definition at line 273 of file FSFileBackend.php.
FSFileBackend::handleWarning | ( | $ | errno, |
$ | errstr | ||
) |
int | $errno | |
string | $errstr |
Definition at line 787 of file FSFileBackend.php.
FSFileBackend::htaccessPrivate | ( | ) | [protected] |
Return the text of a .htaccess file to make a directory private.
Definition at line 749 of file FSFileBackend.php.
FSFileBackend::indexHtmlPrivate | ( | ) | [protected] |
Return the text of an index.html file to hide directory listings.
Definition at line 740 of file FSFileBackend.php.
FSFileBackend::isLegalRelPath | ( | $ | path | ) | [protected] |
Sanity check a relative file system path for validity.
string | $path | Normalized relative path |
Definition at line 105 of file FSFileBackend.php.
FSFileBackend::isPathUsableInternal | ( | $ | storagePath | ) |
Check if a file can be created or changed at a given storage path.
FS backends should check if the parent directory exists, files can be written under it, and that any file already there is writable. Backends using key/value stores should check if the container exists.
string | $storagePath |
Reimplemented from FileBackendStore.
Definition at line 155 of file FSFileBackend.php.
FSFileBackend::resolveContainerPath | ( | $ | container, |
$ | relStoragePath | ||
) | [protected] |
Resolve a relative storage path, checking if it's allowed by the backend.
This is intended for internal use, such as encoding illegal chars or perhaps getting absolute paths (e.g. FS based backends). Note that the relative path may be the empty string (e.g. the path is simply to the container).
string | $container | Container name |
string | $relStoragePath | Storage path relative to the container |
Reimplemented from FileBackendStore.
Definition at line 87 of file FSFileBackend.php.
FSFileBackend::resolveToFSPath | ( | $ | storagePath | ) | [protected] |
Get the absolute file system path for a storage path.
string | $storagePath | Storage path |
Definition at line 141 of file FSFileBackend.php.
FSFileBackend::trapWarnings | ( | ) | [protected] |
Listen for E_WARNING errors and track whether any happen.
Definition at line 766 of file FSFileBackend.php.
FSFileBackend::untrapWarnings | ( | ) | [protected] |
Stop listening for E_WARNING errors and return true if any happened.
Definition at line 776 of file FSFileBackend.php.
string FSFileBackend::$basePath [protected] |
Directory holding the container directories *.
Definition at line 42 of file FSFileBackend.php.
Map of container names to root paths for custom container paths *.
Definition at line 44 of file FSFileBackend.php.
string FSFileBackend::$currentUser [protected] |
OS username running this script *.
Definition at line 50 of file FSFileBackend.php.
int FSFileBackend::$fileMode [protected] |
File permission mode *.
Definition at line 46 of file FSFileBackend.php.
string FSFileBackend::$fileOwner [protected] |
Required OS username to own files *.
Definition at line 48 of file FSFileBackend.php.
*
Definition at line 52 of file FSFileBackend.php.