BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
FSFileBackend Class Reference

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

Inheritance diagram for FSFileBackend:
Collaboration diagram for FSFileBackend:

Public Member Functions

 __construct (array $config)
 
 getFeatures ()
 
 isPathUsableInternal ($storagePath)
 
 getDirectoryListInternal ($fullCont, $dirRel, array $params)
 
 getFileListInternal ($fullCont, $dirRel, array $params)
 
 handleWarning ($errno, $errstr)
 
- Public Member Functions inherited from FileBackendStore
 __construct (array $config)
 
 maxFileSizeInternal ()
 
 isPathUsableInternal ($storagePath)
 
 createInternal (array $params)
 
 storeInternal (array $params)
 
 copyInternal (array $params)
 
 deleteInternal (array $params)
 
 moveInternal (array $params)
 
 describeInternal (array $params)
 
 nullInternal (array $params)
 
 concatenate (array $params)
 
 fileExists (array $params)
 
 getFileTimestamp (array $params)
 
 getFileSize (array $params)
 
 getFileStat (array $params)
 
 getFileContentsMulti (array $params)
 
 getFileXAttributes (array $params)
 
 getFileSha1Base36 (array $params)
 
 getFileProps (array $params)
 
 getLocalReferenceMulti (array $params)
 
 getLocalCopyMulti (array $params)
 
 getFileHttpUrl (array $params)
 
 streamFile (array $params)
 
 directoryExists (array $params)
 
 getDirectoryList (array $params)
 
 getDirectoryListInternal ($container, $dir, array $params)
 
 getFileList (array $params)
 
 getFileListInternal ($container, $dir, array $params)
 
 getOperationsInternal (array $ops)
 
 getPathsToLockForOpsInternal (array $performOps)
 
 getScopedLocksForOps (array $ops, Status $status)
 
 executeOpHandlesInternal (array $fileOpHandles)
 
 preloadCache (array $paths)
 
 clearCache (array $paths=null)
 
 preloadFileStat (array $params)
 
 isSingleShardPathInternal ($storagePath)
 
- Public Member Functions inherited from FileBackend
 __construct (array $config)
 
 getName ()
 
 getWikiId ()
 
 isReadOnly ()
 
 getReadOnlyReason ()
 
 getFeatures ()
 
 hasFeatures ($bitfield)
 
 doOperations (array $ops, array $opts=[])
 
 doOperation (array $op, array $opts=[])
 
 create (array $params, array $opts=[])
 
 store (array $params, array $opts=[])
 
 copy (array $params, array $opts=[])
 
 move (array $params, array $opts=[])
 
 delete (array $params, array $opts=[])
 
 describe (array $params, array $opts=[])
 
 doQuickOperations (array $ops, array $opts=[])
 
 doQuickOperation (array $op)
 
 quickCreate (array $params)
 
 quickStore (array $params)
 
 quickCopy (array $params)
 
 quickMove (array $params)
 
 quickDelete (array $params)
 
 quickDescribe (array $params)
 
 concatenate (array $params)
 
 prepare (array $params)
 
 secure (array $params)
 
 publish (array $params)
 
 clean (array $params)
 
 fileExists (array $params)
 
 getFileTimestamp (array $params)
 
 getFileContents (array $params)
 
 getFileContentsMulti (array $params)
 
 getFileXAttributes (array $params)
 
 getFileSize (array $params)
 
 getFileStat (array $params)
 
 getFileSha1Base36 (array $params)
 
 getFileProps (array $params)
 
 streamFile (array $params)
 
 getLocalReference (array $params)
 
 getLocalReferenceMulti (array $params)
 
 getLocalCopy (array $params)
 
 getLocalCopyMulti (array $params)
 
 getFileHttpUrl (array $params)
 
 directoryExists (array $params)
 
 getDirectoryList (array $params)
 
 getTopDirectoryList (array $params)
 
 getFileList (array $params)
 
 getTopFileList (array $params)
 
 preloadCache (array $paths)
 
 clearCache (array $paths=null)
 
 preloadFileStat (array $params)
 
 lockFiles (array $paths, $type, $timeout=0)
 
 unlockFiles (array $paths, $type)
 
 getScopedFileLocks (array $paths, $type, Status $status, $timeout=0)
 
 getScopedLocksForOps (array $ops, Status $status)
 
 getRootStoragePath ()
 
 getContainerStoragePath ($container)
 
 getJournal ()
 

Protected Member Functions

 resolveContainerPath ($container, $relStoragePath)
 
 isLegalRelPath ($path)
 
 containerFSRoot ($shortCont, $fullCont)
 
 resolveToFSPath ($storagePath)
 
 doCreateInternal (array $params)
 
 doStoreInternal (array $params)
 
 doCopyInternal (array $params)
 
 doMoveInternal (array $params)
 
 doDeleteInternal (array $params)
 
 doPrepareInternal ($fullCont, $dirRel, array $params)
 
 doSecureInternal ($fullCont, $dirRel, array $params)
 
 doPublishInternal ($fullCont, $dirRel, array $params)
 
 doCleanInternal ($fullCont, $dirRel, array $params)
 
 doGetFileStat (array $params)
 
 doClearCache (array $paths=null)
 
 doDirectoryExists ($fullCont, $dirRel, array $params)
 
 doGetLocalReferenceMulti (array $params)
 
 doGetLocalCopyMulti (array $params)
 
 directoriesAreVirtual ()
 
 doExecuteOpHandlesInternal (array $fileOpHandles)
 
 chmod ($path)
 
 indexHtmlPrivate ()
 
 htaccessPrivate ()
 
 cleanPathSlashes ($path)
 
 trapWarnings ()
 
 untrapWarnings ()
 
- Protected Member Functions inherited from FileBackendStore
 doCreateInternal (array $params)
 
 doStoreInternal (array $params)
 
 doCopyInternal (array $params)
 
 doDeleteInternal (array $params)
 
 doMoveInternal (array $params)
 
 doDescribeInternal (array $params)
 
 doConcatenate (array $params)
 
 doPrepare (array $params)
 
 doPrepareInternal ($container, $dir, array $params)
 
 doSecure (array $params)
 
 doSecureInternal ($container, $dir, array $params)
 
 doPublish (array $params)
 
 doPublishInternal ($container, $dir, array $params)
 
 doClean (array $params)
 
 doCleanInternal ($container, $dir, array $params)
 
 doGetFileStat (array $params)
 
 doGetFileContentsMulti (array $params)
 
 doGetFileXAttributes (array $params)
 
 doGetFileSha1Base36 (array $params)
 
 doGetLocalReferenceMulti (array $params)
 
 doGetLocalCopyMulti (array $params)
 
 doStreamFile (array $params)
 
 doDirectoryExists ($container, $dir, array $params)
 
 doOperationsInternal (array $ops, array $opts)
 
 doQuickOperationsInternal (array $ops)
 
 doExecuteOpHandlesInternal (array $fileOpHandles)
 
 sanitizeOpHeaders (array $op)
 
 doClearCache (array $paths=null)
 
 doGetFileStatMulti (array $params)
 
 directoriesAreVirtual ()
 
 resolveStoragePath ($storagePath)
 
 resolveStoragePathReal ($storagePath)
 
 getContainerShard ($container, $relPath)
 
 getContainerHashLevels ($container)
 
 getContainerSuffixes ($container)
 
 fullContainerName ($container)
 
 resolveContainerName ($container)
 
 resolveContainerPath ($container, $relStoragePath)
 
 setContainerCache ($container, array $val)
 
 deleteContainerCache ($container)
 
 primeContainerCache (array $items)
 
 doPrimeContainerCache (array $containerInfo)
 
 setFileCache ($path, array $val)
 
 deleteFileCache ($path)
 
 primeFileCache (array $items)
 
 setConcurrencyFlags (array $opts)
 
 getContentType ($storagePath, $content, $fsPath)
 
- Protected Member Functions inherited from FileBackend
 doOperationsInternal (array $ops, array $opts)
 
 doQuickOperationsInternal (array $ops)
 
 doPrepare (array $params)
 
 doSecure (array $params)
 
 doPublish (array $params)
 
 doClean (array $params)
 
 getScopedPHPBehaviorForOps ()
 
 resolveFSFileObjects (array $ops)
 

Protected Attributes

 $basePath
 
 $containerPaths = []
 
 $fileMode
 
 $fileOwner
 
 $currentUser
 
 $hadWarningErrors = []
 
- Protected Attributes inherited from FileBackendStore
 $memCache
 
 $cheapCache
 
 $expensiveCache
 
 $shardViaHashLevels = []
 
 $mimeCallback
 
 $maxFileSize = 4294967296
 
- Protected Attributes inherited from FileBackend
 $name
 
 $wikiId
 
 $readOnly
 
 $parallelize
 
 $concurrency
 
 $lockManager
 
 $fileJournal
 

Additional Inherited Members

- Static Public Member Functions inherited from FileBackend
static isStoragePath ($path)
 
static splitStoragePath ($storagePath)
 
static normalizeStoragePath ($storagePath)
 
static parentStoragePath ($storagePath)
 
static extensionFromPath ($path, $case= 'lowercase')
 
static isPathTraversalFree ($path)
 
static makeContentDisposition ($type, $filename= '')
 
- Public Attributes inherited from FileBackendStore
const CACHE_TTL = 10
 
const CACHE_CHEAP_SIZE = 500
 
const CACHE_EXPENSIVE_SIZE = 5
 
- Public Attributes inherited from FileBackend
const ATTR_HEADERS = 1
 
const ATTR_METADATA = 2
 
const ATTR_UNICODE_PATHS = 4
 
- Static Protected Member Functions inherited from FileBackendStore
static isValidShortContainerName ($container)
 
static isValidContainerName ($container)
 
static normalizeXAttributes (array $xattr)
 
- Static Protected Member Functions inherited from FileBackend
static normalizeContainerPath ($path)
 

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

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.
Parameters
array$config

Member Function Documentation

FSFileBackend::chmod (   $path)
protected

Chmod a file, suppressing the warnings

Parameters
string$pathAbsolute file system path
Returns
bool Success
FSFileBackend::cleanPathSlashes (   $path)
protected

Clean up directory separators for the given OS

Parameters
string$pathFS path
Returns
string
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
string$shortCont
string$fullCont
Returns
string|null
FSFileBackend::doExecuteOpHandlesInternal ( array  $fileOpHandles)
protected
Parameters
FSFileOpHandle[]$fileOpHandles
Returns
Status[]
FSFileBackend::doPrepareInternal (   $fullCont,
  $dirRel,
array  $params 
)
protected
Parameters
string$fullCont
string$dirRel
array$params
Returns
Status
FSFileBackend::getDirectoryListInternal (   $fullCont,
  $dirRel,
array  $params 
)
See Also
FileBackendStore::getDirectoryListInternal()
Parameters
string$fullCont
string$dirRel
array$params
Returns
array|null
FSFileBackend::getFileListInternal (   $fullCont,
  $dirRel,
array  $params 
)
See Also
FileBackendStore::getFileListInternal()
Parameters
string$fullCont
string$dirRel
array$params
Returns
array|FSFileBackendFileList|null
FSFileBackend::handleWarning (   $errno,
  $errstr 
)
Parameters
int$errno
string$errstr
Returns
bool private
FSFileBackend::htaccessPrivate ( )
protected

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

Returns
string
FSFileBackend::indexHtmlPrivate ( )
protected

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

Returns
string
FSFileBackend::isLegalRelPath (   $path)
protected

Sanity check a relative file system path for validity

Parameters
string$pathNormalized relative path
Returns
bool
FSFileBackend::resolveToFSPath (   $storagePath)
protected

Get the absolute file system path for a storage path

Parameters
string$storagePathStorage path
Returns
string|null
FSFileBackend::trapWarnings ( )
protected

Listen for E_WARNING errors and track whether any happen

FSFileBackend::untrapWarnings ( )
protected

Stop listening for E_WARNING errors and return true if any happened

Returns
bool

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