MediaWiki  REL1_20
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)
 getDirectoryListInternal ($fullCont, $dirRel, array $params)
 getFileListInternal ($fullCont, $dirRel, array $params)
 getLocalCopy (array $params)
 getLocalReference (array $params)
 isPathUsableInternal ($storagePath)

Protected Member Functions

 _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)
 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 ()
 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)
 doMoveInternal (array $params)
 doPrepareInternal ($fullCont, $dirRel, array $params)
 doPublishInternal ($fullCont, $dirRel, array $params)
 doSecureInternal ($fullCont, $dirRel, array $params)
 doStoreInternal (array $params)
 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)
 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
Array $containerPaths = array()
 Map of container names to root paths *.
 $currentUser
 $fileMode
 $fileOwner
 $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 41 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 FileBackendStore.

Definition at line 58 of file FSFileBackend.php.


Member Function Documentation

FSFileBackend::_getResponseCopy ( errors,
Status status,
array $  params,
cmd 
) [protected]
FSFileBackend::_getResponseCreate ( errors,
Status status,
array $  params,
cmd 
) [protected]
FSFileBackend::_getResponseDelete ( errors,
Status status,
array $  params,
cmd 
) [protected]
FSFileBackend::_getResponseMove ( errors,
Status status,
array $  params,
cmd 
) [protected]
FSFileBackend::_getResponseStore ( errors,
Status status,
array $  params,
cmd 
) [protected]
FSFileBackend::chmod ( path) [protected]

Chmod a file, suppressing the warnings.

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

Definition at line 752 of file FSFileBackend.php.

FSFileBackend::cleanPathSlashes ( path) [protected]

Clean up directory separators for the given OS.

Parameters:
$pathstring FS path
Returns:
string

Definition at line 784 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.

Parameters:
$shortContstring
$fullContstring
Returns:
string|null

Definition at line 126 of file FSFileBackend.php.

See also:
FileBackendStore::directoriesAreVirtual()
Returns:
bool

Reimplemented from FileBackendStore.

Definition at line 708 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 563 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 605 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 242 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 416 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 370 of file FSFileBackend.php.

FSFileBackend::doDirectoryExists ( fullCont,
dirRel,
array $  params 
) [protected]
See also:
FileBackendStore::doDirectoryExists()
Returns:
bool|null

Reimplemented from FileBackendStore.

Definition at line 613 of file FSFileBackend.php.

FSFileBackend::doExecuteOpHandlesInternal ( array $  fileOpHandles) [protected]
See also:
FileBackendStore::doExecuteOpHandlesInternal()
Returns:
Array List of corresponding Status objects

Reimplemented from FileBackendStore.

Definition at line 716 of file FSFileBackend.php.

FSFileBackend::doGetFileStat ( array $  params) [protected]
See also:
FileBackendStore::doFileExists()
Returns:
array|bool|null

Reimplemented from FileBackendStore.

Definition at line 580 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 307 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 481 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 534 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 505 of file FSFileBackend.php.

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

Reimplemented from FileBackendStore.

Definition at line 183 of file FSFileBackend.php.

FSFileBackend::getDirectoryListInternal ( fullCont,
dirRel,
array $  params 
)
See also:
FileBackendStore::getDirectoryListInternal()
Returns:
Array|null

Reimplemented from FileBackendStore.

Definition at line 629 of file FSFileBackend.php.

FSFileBackend::getFileListInternal ( fullCont,
dirRel,
array $  params 
)
See also:
FileBackendStore::getFileListInternal()
Returns:
array|FSFileBackendFileList|null

Reimplemented from FileBackendStore.

Definition at line 648 of file FSFileBackend.php.

FSFileBackend::getLocalCopy ( array $  params)
See also:
FileBackendStore::getLocalCopy()
Returns:
null|TempFSFile

Reimplemented from FileBackend.

Definition at line 679 of file FSFileBackend.php.

FSFileBackend::getLocalReference ( array $  params)
See also:
FileBackendStore::getLocalReference()
Returns:
FSFile|null

Reimplemented from FileBackendStore.

Definition at line 667 of file FSFileBackend.php.

Returns:
bool

Definition at line 812 of file FSFileBackend.php.

Return the text of a .htaccess file to make a directory private.

Returns:
string

Definition at line 774 of file FSFileBackend.php.

Return the text of an index.html file to hide directory listings.

Returns:
string

Definition at line 765 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 106 of file FSFileBackend.php.

See also:
FileBackendStore::isPathUsableInternal()
Returns:
bool

Reimplemented from FileBackendStore.

Definition at line 158 of file FSFileBackend.php.

FSFileBackend::resolveContainerPath ( container,
relStoragePath 
) [protected]
See also:
FileBackendStore::resolveContainerPath()
Parameters:
$containerstring
$relStoragePathstring
Returns:
null|string

Reimplemented from FileBackendStore.

Definition at line 89 of file FSFileBackend.php.

FSFileBackend::resolveToFSPath ( storagePath) [protected]

Get the absolute file system path for a storage path.

Parameters:
$storagePathstring Storage path
Returns:
string|null

Definition at line 141 of file FSFileBackend.php.

FSFileBackend::trapWarnings ( ) [protected]

Listen for E_WARNING errors and track whether any happen.

Returns:
bool

Definition at line 793 of file FSFileBackend.php.

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

Returns:
bool

Definition at line 804 of file FSFileBackend.php.


Member Data Documentation

FSFileBackend::$basePath [protected]

Definition at line 42 of file FSFileBackend.php.

Array FSFileBackend::$containerPaths = array() [protected]

Map of container names to root paths *.

Definition at line 43 of file FSFileBackend.php.

FSFileBackend::$currentUser [protected]

Definition at line 46 of file FSFileBackend.php.

FSFileBackend::$fileMode [protected]

Definition at line 44 of file FSFileBackend.php.

FSFileBackend::$fileOwner [protected]

Definition at line 45 of file FSFileBackend.php.

FSFileBackend::$hadWarningErrors = array() [protected]

Definition at line 48 of file FSFileBackend.php.


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