Go to the documentation of this file.
136 $this->
name = $config[
'name'];
137 if ( !preg_match(
'!^[a-zA-Z0-9-_]{1,255}$!', $this->
name ) ) {
140 if ( !isset( $config[
'wikiId'] ) ) {
142 wfDeprecated( __METHOD__ .
' called without "wikiID".',
'1.23' );
144 if ( isset( $config[
'lockManager'] ) && !is_object( $config[
'lockManager'] ) ) {
145 $config[
'lockManager'] =
147 wfDeprecated( __METHOD__ .
' called with non-object "lockManager".',
'1.23' );
149 $this->wikiId = $config[
'wikiId'];
150 $this->lockManager = isset( $config[
'lockManager'] )
151 ? $config[
'lockManager']
153 $this->fileJournal = isset( $config[
'fileJournal'] )
154 ? $config[
'fileJournal']
156 $this->readOnly = isset( $config[
'readOnly'] )
157 ? (string)$config[
'readOnly']
159 $this->parallelize = isset( $config[
'parallelize'] )
160 ? (string)$config[
'parallelize']
162 $this->concurrency = isset( $config[
'concurrency'] )
163 ? (int)$config[
'concurrency']
174 final public function getName() {
195 return ( $this->readOnly !=
'' );
204 return ( $this->readOnly !=
'' ) ? $this->readOnly :
false;
225 return ( $this->
getFeatures() & $bitfield ) === $bitfield;
375 if ( empty( $opts[
'bypassReadOnly'] ) && $this->
isReadOnly() ) {
378 if ( !count( $ops ) ) {
381 if ( empty( $opts[
'force'] ) ) {
382 unset( $opts[
'nonLocking'] );
384 foreach ( $ops
as &$op ) {
385 if ( isset( $op[
'disposition'] ) ) {
386 $op[
'headers'][
'Content-Disposition'] = $op[
'disposition'];
609 if ( empty( $opts[
'bypassReadOnly'] ) && $this->
isReadOnly() ) {
612 if ( !count( $ops ) ) {
615 foreach ( $ops
as &$op ) {
616 $op[
'overwrite'] =
true;
617 if ( isset( $op[
'disposition'] ) ) {
618 $op[
'headers'][
'Content-Disposition'] = $op[
'disposition'];
850 return $this->
doClean( $params );
866 if ( PHP_SAPI !=
'cli' ) {
867 $old = ignore_user_abort(
true );
869 ignore_user_abort( $old );
910 return $contents[
$params[
'src']];
1032 return $fsFiles[
$params[
'src']];
1065 return $tmpFiles[
$params[
'src']];
1236 $paths = array_map(
'FileBackend::normalizeStoragePath', $paths );
1238 return $this->lockManager->lock( $paths,
$type );
1249 $paths = array_map(
'FileBackend::normalizeStoragePath', $paths );
1251 return $this->lockManager->unlock( $paths,
$type );
1270 if (
$type ===
'mixed' ) {
1271 foreach ( $paths
as &$typePaths ) {
1272 $typePaths = array_map(
'FileBackend::normalizeStoragePath', $typePaths );
1275 $paths = array_map(
'FileBackend::normalizeStoragePath', $paths );
1307 return "mwstore://{$this->name}";
1338 return ( strpos(
$path,
'mwstore://' ) === 0 );
1350 if ( self::isStoragePath( $storagePath ) ) {
1352 $parts = explode(
'/', substr( $storagePath, 10 ), 3 );
1353 if ( count( $parts ) >= 2 && $parts[0] !=
'' && $parts[1] !=
'' ) {
1354 if ( count( $parts ) == 3 ) {
1357 return array( $parts[0], $parts[1],
'' );
1362 return array(
null,
null,
null );
1374 if ( $relPath !==
null ) {
1376 if ( $relPath !==
null ) {
1377 return ( $relPath !=
'' )
1378 ?
"mwstore://{$backend}/{$container}/{$relPath}"
1379 :
"mwstore://{$backend}/{$container}";
1395 $storagePath = dirname( $storagePath );
1398 return ( $rel ===
null ) ? null : $storagePath;
1408 $i = strrpos(
$path,
'.' );
1410 return strtolower( $i ? substr(
$path, $i + 1 ) :
'' );
1421 return ( self::normalizeContainerPath(
$path ) !==
null );
1437 if ( !in_array(
$type,
array(
'inline',
'attachment' ) ) ) {
1442 if ( strlen( $filename ) ) {
1443 $parts[] =
"filename*=UTF-8''" . rawurlencode( basename( $filename ) );
1446 return implode(
';', $parts );
1463 $path = preg_replace(
'![/]{2,}!',
'/',
$path );
1467 if ( strpos(
$path,
'.' ) !==
false ) {
1471 strpos(
$path,
'./' ) === 0 ||
1472 strpos(
$path,
'../' ) === 0 ||
1473 strpos(
$path,
'/./' ) !==
false ||
1474 strpos(
$path,
'/../' ) !==
false
streamFile(array $params)
Stream the file at a storage path in the backend.
static splitStoragePath( $storagePath)
Split a storage path into a backend name, a container name, and a relative file path.
Class for handling resource locking.
store(array $params, array $opts=array())
Performs a single store operation.
static normalizeContainerPath( $path)
Validate and normalize a relative storage path.
doQuickOperationsInternal(array $ops)
getScopedPHPBehaviorForOps()
Enter file operation scope.
string $wikiId
Unique wiki name *.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
preloadFileStat(array $params)
Preload file stat information (concurrently if possible) into in-process cache.
Base class for all file backend classes (including multi-write backends).
unlockFiles(array $paths, $type)
Unlock the files at the given storage paths in the backend.
const ATTR_HEADERS
Flags for supported features.
directoryExists(array $params)
Check if a directory exists at a given storage path.
getLocalReferenceMulti(array $params)
Like getLocalReference() except it takes an array of storage paths and returns a map of storage paths...
getFileStat(array $params)
Get quick information about a file at a storage path in the backend.
getFileXAttributes(array $params)
Get metadata about a file at a storage path in the backend.
publish(array $params)
Remove measures to block web access to a storage directory and the container it belongs to.
getName()
Get the unique backend name.
getDirectoryList(array $params)
Get an iterator to list all directories under a storage directory.
File backend exception for checked exceptions (e.g.
doOperation(array $op, array $opts=array())
Same as doOperations() except it takes a single operation.
string $readOnly
Read-only explanation message *.
static singleton( $domain=false)
static newGood( $value=null)
Factory function for good results.
copy(array $params, array $opts=array())
Performs a single copy operation.
static normalizeStoragePath( $storagePath)
Normalize a storage path by cleaning up directory separators.
quickMove(array $params)
Performs a single quick move operation.
getReadOnlyReason()
Get an explanatory message if this backend is read-only.
getFileHttpUrl(array $params)
Return an HTTP URL to a given file that requires no authentication to use.
Generic file backend exception for checked and unexpected (e.g.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
getScopedFileLocks(array $paths, $type, Status $status)
Lock the files at the given storage paths in the backend.
quickDelete(array $params)
Performs a single quick delete operation.
getFileContentsMulti(array $params)
Like getFileContents() except it takes an array of storage paths and returns a map of storage paths t...
Simple version of LockManager that does nothing.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
getFileTimestamp(array $params)
Get the last-modified timestamp of the file at a storage path.
getFileSize(array $params)
Get the size (bytes) of a file at a storage path in the backend.
static isStoragePath( $path)
Check if a given path is a "mwstore://" path.
int $concurrency
How many operations can be done in parallel *.
Class for handling file operation journaling.
getFileSha1Base36(array $params)
Get a SHA-1 hash of the file at a storage path in the backend.
getTopFileList(array $params)
Same as FileBackend::getFileList() except only lists files that are immediately under the given direc...
__construct(array $config)
Create a new backend instance from configuration.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
hasFeatures( $bitfield)
Check if the backend medium supports a field of extra features.
quickStore(array $params)
Performs a single quick store operation.
doOperations(array $ops, array $opts=array())
This is the main entry point into the backend for write operations.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Class for asserting that a callback happens when an dummy object leaves scope.
quickCreate(array $params)
Performs a single quick create operation.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
quickCopy(array $params)
Performs a single quick copy operation.
quickDescribe(array $params)
Performs a single quick describe operation.
getLocalCopyMulti(array $params)
Like getLocalCopy() except it takes an array of storage paths and returns a map of storage paths to T...
fileExists(array $params)
Check if a file exists at a storage path in the backend.
doQuickOperations(array $ops, array $opts=array())
Perform a set of independent file operations on some files.
preloadCache(array $paths)
Preload persistent file stat cache and property cache into in-process cache.
string $parallelize
When to do operations in parallel *.
prepare(array $params)
Prepare a storage directory for usage.
getScopedLocksForOps(array $ops, Status $status)
Get an array of scoped locks needed for a batch of file operations.
doOperationsInternal(array $ops, array $opts)
clearCache(array $paths=null)
Invalidate any in-process file stat and property cache.
describe(array $params, array $opts=array())
Performs a single describe operation.
getFileList(array $params)
Get an iterator to list all stored files under a storage directory.
lockFiles(array $paths, $type)
Lock the files at the given storage paths in the backend.
getRootStoragePath()
Get the root storage path of this backend.
static extensionFromPath( $path)
Get the final extension from a storage or FS path.
string $name
Unique backend name *.
clean(array $params)
Delete a storage directory if it is empty.
getLocalCopy(array $params)
Get a local copy on disk of the file at a storage path in the backend.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getFileProps(array $params)
Get the properties of the file at a storage path in the backend.
static isPathTraversalFree( $path)
Check if a relative path has no directory traversals.
getJournal()
Get the file journal object for this backend.
concatenate(array $params)
Concatenate a list of storage files into a single file system file.
getTopDirectoryList(array $params)
Same as FileBackend::getDirectoryList() except only lists directories that are immediately under the ...
getLocalReference(array $params)
Returns a file system file, identical to the file at a storage path.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
getFeatures()
Get the a bitfield of extra features supported by the backend medium.
static factory(array $config, $backend)
Create an appropriate FileJournal object from config.
getContainerStoragePath( $container)
Get the storage path for the given container for this backend.
create(array $params, array $opts=array())
Performs a single create operation.
getFileContents(array $params)
Get the contents of a file at a storage path in the backend.
doQuickOperation(array $op)
Same as doQuickOperations() except it takes a single operation.
getWikiId()
Get the wiki identifier used for this backend (possibly empty).
static factory(LockManager $manager, array $paths, $type, Status $status, $timeout=0)
Get a ScopedLock object representing a lock on resource paths.
move(array $params, array $opts=array())
Performs a single move operation.
secure(array $params)
Take measures to block web access to a storage directory and the container it belongs to.
static parentStoragePath( $storagePath)
Get the parent storage directory of a storage path.
static newFatal( $message)
Factory function for fatal errors.
isReadOnly()
Check if this backend is read-only.
static makeContentDisposition( $type, $filename='')
Build a Content-Disposition header value per RFC 6266.