MediaWiki  REL1_19
FSFileBackend Class Reference

Class for a file system (FS) based file backend. More...

Inheritance diagram for FSFileBackend:
Collaboration diagram for FSFileBackend:

List of all members.

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 ()

Detailed Description

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.

Since:
1.19

Definition at line 24 of file FSFileBackend.php.


Constructor & Destructor Documentation

FSFileBackend::__construct ( array $  config)
See also:
FileBackendStore::__construct() Additional $config params include: basePath : File system directory that holds containers. containerPaths : Map of container names to custom file system directories. This should only be used for backwards-compatibility. fileMode : Octal UNIX file permissions to use on files stored.

Reimplemented from FileBackend.

Definition at line 40 of file FSFileBackend.php.

References $path.


Member Function Documentation

FSFileBackend::chmod ( path) [protected]

Chmod a file, suppressing the warnings.

Parameters:
$pathstring Absolute file system path
Returns:
bool Success

Definition at line 496 of file FSFileBackend.php.

References $ok, $path, wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by doCopyInternal(), doCreateInternal(), doStoreInternal(), and getLocalCopy().

Here is the call graph for this function:

Here is the caller graph for this function:

FSFileBackend::containerFSRoot ( shortCont,
fullCont 
) [protected]

Given the short (unresolved) and full (resolved) name of a container, return the file system path of the container.

Parameters:
$shortContstring
$fullContstring
Returns:
string|null

Definition at line 102 of file FSFileBackend.php.

Referenced by doCleanInternal(), doPrepareInternal(), doSecureInternal(), getFileListInternal(), and resolveToFSPath().

Here is the caller graph for this function:

FSFileBackend::doCleanInternal ( fullCont,
dirRel,
array $  params 
) [protected]
See also:
FileBackendStore::doCleanInternal()

Reimplemented from FileBackendStore.

Definition at line 386 of file FSFileBackend.php.

References $dir, containerFSRoot(), Status\newGood(), FileBackend\splitStoragePath(), wfRestoreWarnings(), and wfSuppressWarnings().

Here is the call graph for this function:

FSFileBackend::doClearCache ( array $  paths = null) [protected]
See also:
FileBackendStore::doClearCache()

Reimplemented from FileBackendStore.

Definition at line 427 of file FSFileBackend.php.

FSFileBackend::doCopyInternal ( array $  params) [protected]
See also:
FileBackendStore::doCopyInternal()

Reimplemented from FileBackendStore.

Definition at line 188 of file FSFileBackend.php.

References $ok, chmod(), FileBackend\copy(), Status\newGood(), and resolveToFSPath().

Here is the call graph for this function:

FSFileBackend::doCreateInternal ( array $  params) [protected]
See also:
FileBackendStore::doCreateInternal()

Reimplemented from FileBackendStore.

Definition at line 302 of file FSFileBackend.php.

References $ok, chmod(), Status\newGood(), and resolveToFSPath().

Here is the call graph for this function:

FSFileBackend::doDeleteInternal ( array $  params) [protected]
See also:
FileBackendStore::doDeleteInternal()

Reimplemented from FileBackendStore.

Definition at line 274 of file FSFileBackend.php.

References $ok, Status\newGood(), and resolveToFSPath().

Here is the call graph for this function:

FSFileBackend::doGetFileStat ( array $  params) [protected]
See also:
FileBackendStore::doFileExists()

Reimplemented from FileBackendStore.

Definition at line 402 of file FSFileBackend.php.

References resolveToFSPath(), trapWarnings(), untrapWarnings(), and wfTimestamp().

Here is the call graph for this function:

FSFileBackend::doMoveInternal ( array $  params) [protected]
See also:
FileBackendStore::doMoveInternal()

Reimplemented from FileBackendStore.

Definition at line 230 of file FSFileBackend.php.

References $ok, Status\newGood(), resolveToFSPath(), and wfIsWindows().

Here is the call graph for this function:

FSFileBackend::doPrepareInternal ( fullCont,
dirRel,
array $  params 
) [protected]
See also:
FileBackendStore::doPrepareInternal()

Reimplemented from FileBackendStore.

Definition at line 338 of file FSFileBackend.php.

References $dir, containerFSRoot(), Status\newGood(), FileBackend\splitStoragePath(), and wfMkdirParents().

Here is the call graph for this function:

FSFileBackend::doSecureInternal ( fullCont,
dirRel,
array $  params 
) [protected]
See also:
FileBackendStore::doSecureInternal()

Reimplemented from FileBackendStore.

Definition at line 356 of file FSFileBackend.php.

References $dir, containerFSRoot(), Status\newGood(), and FileBackend\splitStoragePath().

Here is the call graph for this function:

FSFileBackend::doStoreInternal ( array $  params) [protected]
See also:
FileBackendStore::doStoreInternal()

Reimplemented from FileBackendStore.

Definition at line 152 of file FSFileBackend.php.

References $ok, chmod(), FileBackend\copy(), Status\newGood(), and resolveToFSPath().

Here is the call graph for this function:

FSFileBackend::getFileListInternal ( fullCont,
dirRel,
array $  params 
)
See also:
FileBackendStore::getFileListInternal()

Reimplemented from FileBackendStore.

Definition at line 434 of file FSFileBackend.php.

References $dir, containerFSRoot(), FileBackend\splitStoragePath(), and wfDebug().

Here is the call graph for this function:

FSFileBackend::getLocalCopy ( array $  params)
See also:
FileBackendStore::getLocalCopy()

Reimplemented from FileBackend.

Definition at line 465 of file FSFileBackend.php.

References $ext, $ok, chmod(), FileBackend\copy(), FileBackend\extensionFromPath(), TempFSFile\factory(), resolveToFSPath(), and wfBaseName().

Here is the call graph for this function:

FSFileBackend::getLocalReference ( array $  params)
See also:
FileBackendStore::getLocalReference()

Reimplemented from FileBackendStore.

Definition at line 454 of file FSFileBackend.php.

References resolveToFSPath().

Here is the call graph for this function:

Definition at line 525 of file FSFileBackend.php.

FSFileBackend::isLegalRelPath ( path) [protected]

Sanity check a relative file system path for validity.

Parameters:
$pathstring Normalized relative path
Returns:
bool

Definition at line 82 of file FSFileBackend.php.

References $path, and wfIsWindows().

Referenced by resolveContainerPath().

Here is the call graph for this function:

Here is the caller graph for this function:

See also:
FileBackendStore::isPathUsableInternal()

Reimplemented from FileBackendStore.

Definition at line 133 of file FSFileBackend.php.

References $ok, and resolveToFSPath().

Here is the call graph for this function:

FSFileBackend::resolveContainerPath ( container,
relStoragePath 
) [protected]
See also:
FileBackendStore::resolveContainerPath()

Reimplemented from FileBackendStore.

Definition at line 65 of file FSFileBackend.php.

References isLegalRelPath().

Here is the call graph for this function:

FSFileBackend::resolveToFSPath ( storagePath) [protected]

Get the absolute file system path for a storage path.

Parameters:
$storagePathstring Storage path
Returns:
string|null

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().

Here is the call graph for this function:

Here is the caller graph for this function:

FSFileBackend::trapWarnings ( ) [protected]

Listen for E_WARNING errors and track whether any happen.

Returns:
bool

Definition at line 509 of file FSFileBackend.php.

Referenced by doGetFileStat().

Here is the caller graph for this function:

Stop listening for E_WARNING errors and return true if any happened.

Returns:
bool

Definition at line 520 of file FSFileBackend.php.

Referenced by doGetFileStat().

Here is the caller graph for this function:


Member Data Documentation

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.


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