MediaWiki
REL1_19
|
Class for a file system (FS) based file backend. More...
Public Member Functions | |
__construct (array $config) | |
getFileListInternal ($fullCont, $dirRel, array $params) | |
getLocalCopy (array $params) | |
getLocalReference (array $params) | |
isPathUsableInternal ($storagePath) | |
Protected Member Functions | |
chmod ($path) | |
Chmod a file, suppressing the warnings. | |
containerFSRoot ($shortCont, $fullCont) | |
Given the short (unresolved) and full (resolved) name of a container, return the file system path of the container. | |
doCleanInternal ($fullCont, $dirRel, array $params) | |
doClearCache (array $paths=null) | |
doCopyInternal (array $params) | |
doCreateInternal (array $params) | |
doDeleteInternal (array $params) | |
doGetFileStat (array $params) | |
doMoveInternal (array $params) | |
doPrepareInternal ($fullCont, $dirRel, array $params) | |
doSecureInternal ($fullCont, $dirRel, array $params) | |
doStoreInternal (array $params) | |
isLegalRelPath ($path) | |
Sanity check a relative file system path for validity. | |
resolveContainerPath ($container, $relStoragePath) | |
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 | |
$basePath | |
$containerPaths = array() | |
$fileMode | |
$hadWarningErrors = array() | |
Private Member Functions | |
handleWarning () |
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 24 of file FSFileBackend.php.
FSFileBackend::__construct | ( | array $ | config | ) |
Reimplemented from FileBackend.
Definition at line 40 of file FSFileBackend.php.
References $path.
FSFileBackend::chmod | ( | $ | path | ) | [protected] |
Chmod a file, suppressing the warnings.
$path | string Absolute file system path |
Definition at line 496 of file FSFileBackend.php.
References $ok, $path, wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by doCopyInternal(), doCreateInternal(), doStoreInternal(), and getLocalCopy().
FSFileBackend::containerFSRoot | ( | $ | shortCont, |
$ | fullCont | ||
) | [protected] |
Given the short (unresolved) and full (resolved) name of a container, return the file system path of the container.
$shortCont | string |
$fullCont | string |
Definition at line 102 of file FSFileBackend.php.
Referenced by doCleanInternal(), doPrepareInternal(), doSecureInternal(), getFileListInternal(), and resolveToFSPath().
FSFileBackend::doCleanInternal | ( | $ | fullCont, |
$ | dirRel, | ||
array $ | params | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 386 of file FSFileBackend.php.
References $dir, containerFSRoot(), Status\newGood(), FileBackend\splitStoragePath(), wfRestoreWarnings(), and wfSuppressWarnings().
FSFileBackend::doClearCache | ( | array $ | paths = null | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 427 of file FSFileBackend.php.
FSFileBackend::doCopyInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 188 of file FSFileBackend.php.
References $ok, chmod(), FileBackend\copy(), Status\newGood(), and resolveToFSPath().
FSFileBackend::doCreateInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 302 of file FSFileBackend.php.
References $ok, chmod(), Status\newGood(), and resolveToFSPath().
FSFileBackend::doDeleteInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 274 of file FSFileBackend.php.
References $ok, Status\newGood(), and resolveToFSPath().
FSFileBackend::doGetFileStat | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 402 of file FSFileBackend.php.
References resolveToFSPath(), trapWarnings(), untrapWarnings(), and wfTimestamp().
FSFileBackend::doMoveInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 230 of file FSFileBackend.php.
References $ok, Status\newGood(), resolveToFSPath(), and wfIsWindows().
FSFileBackend::doPrepareInternal | ( | $ | fullCont, |
$ | dirRel, | ||
array $ | params | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 338 of file FSFileBackend.php.
References $dir, containerFSRoot(), Status\newGood(), FileBackend\splitStoragePath(), and wfMkdirParents().
FSFileBackend::doSecureInternal | ( | $ | fullCont, |
$ | dirRel, | ||
array $ | params | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 356 of file FSFileBackend.php.
References $dir, containerFSRoot(), Status\newGood(), and FileBackend\splitStoragePath().
FSFileBackend::doStoreInternal | ( | array $ | params | ) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 152 of file FSFileBackend.php.
References $ok, chmod(), FileBackend\copy(), Status\newGood(), and resolveToFSPath().
FSFileBackend::getFileListInternal | ( | $ | fullCont, |
$ | dirRel, | ||
array $ | params | ||
) |
Reimplemented from FileBackendStore.
Definition at line 434 of file FSFileBackend.php.
References $dir, containerFSRoot(), FileBackend\splitStoragePath(), and wfDebug().
FSFileBackend::getLocalCopy | ( | array $ | params | ) |
Reimplemented from FileBackend.
Definition at line 465 of file FSFileBackend.php.
References $ext, $ok, chmod(), FileBackend\copy(), FileBackend\extensionFromPath(), TempFSFile\factory(), resolveToFSPath(), and wfBaseName().
FSFileBackend::getLocalReference | ( | array $ | params | ) |
Reimplemented from FileBackendStore.
Definition at line 454 of file FSFileBackend.php.
References resolveToFSPath().
FSFileBackend::handleWarning | ( | ) | [private] |
Definition at line 525 of file FSFileBackend.php.
FSFileBackend::isLegalRelPath | ( | $ | path | ) | [protected] |
Sanity check a relative file system path for validity.
$path | string Normalized relative path |
Definition at line 82 of file FSFileBackend.php.
References $path, and wfIsWindows().
Referenced by resolveContainerPath().
FSFileBackend::isPathUsableInternal | ( | $ | storagePath | ) |
Reimplemented from FileBackendStore.
Definition at line 133 of file FSFileBackend.php.
References $ok, and resolveToFSPath().
FSFileBackend::resolveContainerPath | ( | $ | container, |
$ | relStoragePath | ||
) | [protected] |
Reimplemented from FileBackendStore.
Definition at line 65 of file FSFileBackend.php.
References isLegalRelPath().
FSFileBackend::resolveToFSPath | ( | $ | storagePath | ) | [protected] |
Get the absolute file system path for a storage path.
$storagePath | string Storage path |
Definition at line 117 of file FSFileBackend.php.
References containerFSRoot(), FileBackendStore\resolveStoragePathReal(), and FileBackend\splitStoragePath().
Referenced by doCopyInternal(), doCreateInternal(), doDeleteInternal(), doGetFileStat(), doMoveInternal(), doStoreInternal(), getLocalCopy(), getLocalReference(), and isPathUsableInternal().
FSFileBackend::trapWarnings | ( | ) | [protected] |
Listen for E_WARNING errors and track whether any happen.
Definition at line 509 of file FSFileBackend.php.
Referenced by doGetFileStat().
FSFileBackend::untrapWarnings | ( | ) | [protected] |
Stop listening for E_WARNING errors and return true if any happened.
Definition at line 520 of file FSFileBackend.php.
Referenced by doGetFileStat().
FSFileBackend::$basePath [protected] |
Definition at line 25 of file FSFileBackend.php.
FSFileBackend::$containerPaths = array() [protected] |
Definition at line 27 of file FSFileBackend.php.
FSFileBackend::$fileMode [protected] |
Definition at line 28 of file FSFileBackend.php.
FSFileBackend::$hadWarningErrors = array() [protected] |
Definition at line 30 of file FSFileBackend.php.