Go to the documentation of this file.
68 parent::__construct( $config );
69 $this->mimeCallback = isset( $config[
'mimeCallback'] )
70 ? $config[
'mimeCallback']
71 :
function ( $storagePath, $content, $fsPath ) {
77 $this->expensiveCache =
new ProcessCacheLRU( self::CACHE_EXPENSIVE_SIZE );
292 if ( $nsrc !== $ndst && $status->isOK() ) {
295 $status->setResult(
true, $status->value );
317 if ( count(
$params[
'headers'] ) ) {
354 if ( $status->isOK() ) {
356 $start_time = microtime(
true );
358 $sec = microtime(
true ) - $start_time;
359 if ( !$status->isOK() ) {
360 wfDebugLog(
'FileOperation', get_class( $this ) .
" failed to concatenate " .
361 count(
$params[
'srcs'] ) .
" file(s) [$sec sec]" );
380 $ok = ( is_file( $tmpPath ) && filesize( $tmpPath ) == 0 );
383 $status->fatal(
'backend-fail-opentemp', $tmpPath );
390 foreach ( $fsFiles
as $path => &$fsFile ) {
394 $status->fatal(
'backend-fail-read',
$path );
403 $tmpHandle = fopen( $tmpPath,
'ab' );
404 if ( $tmpHandle ===
false ) {
405 $status->fatal(
'backend-fail-opentemp', $tmpPath );
411 foreach ( $fsFiles
as $virtualSource => $fsFile ) {
413 $sourceHandle = fopen( $fsFile->getPath(),
'rb' );
414 if ( $sourceHandle ===
false ) {
415 fclose( $tmpHandle );
416 $status->fatal(
'backend-fail-read', $virtualSource );
421 if ( !stream_copy_to_stream( $sourceHandle, $tmpHandle ) ) {
422 fclose( $sourceHandle );
423 fclose( $tmpHandle );
424 $status->fatal(
'backend-fail-writetemp', $tmpPath );
428 fclose( $sourceHandle );
430 if ( !fclose( $tmpHandle ) ) {
431 $status->fatal(
'backend-fail-closetemp', $tmpPath );
446 if (
$dir ===
null ) {
447 $status->fatal(
'backend-fail-invalidpath',
$params[
'dir'] );
452 if ( $shard !==
null ) {
455 wfDebug( __METHOD__ .
": iterating over all container shards.\n" );
481 if (
$dir ===
null ) {
482 $status->fatal(
'backend-fail-invalidpath',
$params[
'dir'] );
487 if ( $shard !==
null ) {
490 wfDebug( __METHOD__ .
": iterating over all container shards.\n" );
516 if (
$dir ===
null ) {
517 $status->fatal(
'backend-fail-invalidpath',
$params[
'dir'] );
522 if ( $shard !==
null ) {
525 wfDebug( __METHOD__ .
": iterating over all container shards.\n" );
553 if ( $subDirsRel !==
null ) {
554 foreach ( $subDirsRel
as $subDirRel ) {
555 $subDir =
$params[
'dir'] .
"/{$subDirRel}";
558 unset( $subDirsRel );
563 if (
$dir ===
null ) {
564 $status->fatal(
'backend-fail-invalidpath',
$params[
'dir'] );
572 if ( !$status->isOK() ) {
576 if ( $shard !==
null ) {
580 wfDebug( __METHOD__ .
": iterating over all container shards.\n" );
606 return ( $stat ===
null ) ? null : (bool)$stat;
613 return $stat ? $stat[
'mtime'] :
false;
620 return $stat ? $stat[
'size'] :
false;
625 if (
$path ===
null ) {
629 $latest = !empty(
$params[
'latest'] );
630 if ( !$this->cheapCache->has(
$path,
'stat', self::CACHE_TTL ) ) {
633 if ( $this->cheapCache->has(
$path,
'stat', self::CACHE_TTL ) ) {
634 $stat = $this->cheapCache->get(
$path,
'stat' );
637 if ( is_array( $stat ) ) {
638 if ( !$latest || $stat[
'latest'] ) {
641 } elseif ( in_array( $stat,
array(
'NOT_EXIST',
'NOT_EXIST_LATEST' ) ) ) {
642 if ( !$latest || $stat ===
'NOT_EXIST_LATEST' ) {
650 if ( is_array( $stat ) ) {
652 $stat[
'latest'] = isset( $stat[
'latest'] ) ? $stat[
'latest'] : $latest;
653 $this->cheapCache->set(
$path,
'stat', $stat );
655 if ( isset( $stat[
'sha1'] ) ) {
656 $this->cheapCache->set(
$path,
'sha1',
657 array(
'hash' => $stat[
'sha1'],
'latest' => $latest ) );
659 if ( isset( $stat[
'xattr'] ) ) {
661 $this->cheapCache->set(
$path,
'xattr',
662 array(
'map' => $stat[
'xattr'],
'latest' => $latest ) );
664 } elseif ( $stat ===
false ) {
665 $this->cheapCache->set(
$path,
'stat', $latest ?
'NOT_EXIST_LATEST' :
'NOT_EXIST' );
666 $this->cheapCache->set(
$path,
'xattr',
array(
'map' =>
false,
'latest' => $latest ) );
667 $this->cheapCache->set(
$path,
'sha1',
array(
'hash' =>
false,
'latest' => $latest ) );
668 wfDebug( __METHOD__ .
": File $path does not exist.\n" );
670 wfDebug( __METHOD__ .
": Could not stat file $path.\n" );
699 $contents[
$path] = $fsFile ? file_get_contents( $fsFile->getPath() ) :
false;
708 if (
$path ===
null ) {
712 $latest = !empty(
$params[
'latest'] );
713 if ( $this->cheapCache->has(
$path,
'xattr', self::CACHE_TTL ) ) {
714 $stat = $this->cheapCache->get(
$path,
'xattr' );
717 if ( !$latest || $stat[
'latest'] ) {
727 $this->cheapCache->set(
$path,
'xattr',
array(
'map' => $fields,
'latest' => $latest ) );
742 if (
$path ===
null ) {
746 $latest = !empty(
$params[
'latest'] );
747 if ( $this->cheapCache->has(
$path,
'sha1', self::CACHE_TTL ) ) {
748 $stat = $this->cheapCache->get(
$path,
'sha1' );
751 if ( !$latest || $stat[
'latest'] ) {
752 return $stat[
'hash'];
758 $this->cheapCache->set(
$path,
'sha1',
array(
'hash' =>
$hash,
'latest' => $latest ) );
773 return $fsFile->getSha1Base36();
791 $latest = !empty(
$params[
'latest'] );
795 if (
$path ===
null ) {
796 $fsFiles[$src] =
null;
797 } elseif ( $this->expensiveCache->has(
$path,
'localRef' ) ) {
798 $val = $this->expensiveCache->get(
$path,
'localRef' );
801 if ( !$latest || $val[
'latest'] ) {
802 $fsFiles[$src] = $val[
'object'];
807 $params[
'srcs'] = array_diff(
$params[
'srcs'], array_keys( $fsFiles ) );
809 $fsFiles[
$path] = $fsFile;
811 $this->expensiveCache->set(
$path,
'localRef',
812 array(
'object' => $fsFile,
'latest' => $latest ) );
859 $status->fatal(
'backend-fail-notexists',
$params[
'src'] );
871 if ( !$status->isOK() ) {
877 trigger_error(
"Bad stat cache or race condition for file {$params['src']}." );
880 $status->fatal(
'backend-fail-stream',
$params[
'src'] );
896 $status->fatal(
'backend-fail-stream',
$params[
'src'] );
897 } elseif ( !readfile( $fsFile->getPath() ) ) {
898 $status->fatal(
'backend-fail-stream',
$params[
'src'] );
906 if (
$dir ===
null ) {
909 if ( $shard !==
null ) {
912 wfDebug( __METHOD__ .
": iterating over all container shards.\n" );
920 } elseif ( $exists ===
null ) {
941 if (
$dir ===
null ) {
944 if ( $shard !==
null ) {
948 wfDebug( __METHOD__ .
": iterating over all container shards.\n" );
971 if (
$dir ===
null ) {
974 if ( $shard !==
null ) {
978 wfDebug( __METHOD__ .
": iterating over all container shards.\n" );
1011 $supportedOps =
array(
1012 'store' =>
'StoreFileOp',
1013 'copy' =>
'CopyFileOp',
1014 'move' =>
'MoveFileOp',
1015 'delete' =>
'DeleteFileOp',
1016 'create' =>
'CreateFileOp',
1017 'describe' =>
'DescribeFileOp',
1018 'null' =>
'NullFileOp'
1021 $performOps =
array();
1023 foreach ( $ops
as $operation ) {
1024 $opName = $operation[
'op'];
1025 if ( isset( $supportedOps[$opName] ) ) {
1026 $class = $supportedOps[$opName];
1030 $performOps[] =
new $class( $this,
$params );
1052 foreach ( $performOps
as $fileOp ) {
1053 $paths[
'sh'] = array_merge( $paths[
'sh'], $fileOp->storagePathsRead() );
1054 $paths[
'ex'] = array_merge( $paths[
'ex'], $fileOp->storagePathsChanged() );
1057 $paths[
'sh'] = array_diff( $paths[
'sh'], $paths[
'ex'] );
1059 $paths[
'sh'] = array_merge( $paths[
'sh'], array_map(
'dirname', $paths[
'ex'] ) );
1078 $ops = array_map(
array( $this,
'stripInvalidHeadersFromOp' ), $ops );
1084 if ( empty( $opts[
'nonLocking'] ) ) {
1089 if ( !$status->
isOK() ) {
1095 if ( empty( $opts[
'preserveCache'] ) ) {
1101 foreach ( $performOps
as $op ) {
1102 $paths = array_merge( $paths, $op->storagePathsRead() );
1103 $paths = array_merge( $paths, $op->storagePathsChanged() );
1115 $status->
merge( $subStatus );
1116 $status->success = $subStatus->success;
1126 $ops = array_map(
array( $this,
'stripInvalidHeadersFromOp' ), $ops );
1131 $supportedOps =
array(
'create',
'store',
'copy',
'move',
'delete',
'describe',
'null' );
1132 $async = ( $this->parallelize ===
'implicit' && count( $ops ) > 1 );
1135 $statuses =
array();
1136 $fileOpHandles =
array();
1137 $curFileOpHandles =
array();
1140 if ( !in_array(
$params[
'op'], $supportedOps ) ) {
1141 throw new FileBackendError(
"Operation '{$params['op']}' is not supported." );
1143 $method =
$params[
'op'] .
'Internal';
1144 $subStatus = $this->$method(
array(
'async' => $async ) +
$params );
1146 if ( count( $curFileOpHandles ) >= $maxConcurrency ) {
1147 $fileOpHandles[] = $curFileOpHandles;
1148 $curFileOpHandles =
array();
1150 $curFileOpHandles[$index] = $subStatus->value;
1152 $statuses[$index] = $subStatus;
1155 if ( count( $curFileOpHandles ) ) {
1156 $fileOpHandles[] = $curFileOpHandles;
1159 foreach ( $fileOpHandles
as $fileHandleBatch ) {
1163 foreach ( $statuses
as $index => $subStatus ) {
1164 $status->
merge( $subStatus );
1165 if ( $subStatus->isOK() ) {
1166 $status->success[$index] =
true;
1167 ++$status->successCount;
1169 $status->success[$index] =
false;
1170 ++$status->failCount;
1190 foreach ( $fileOpHandles
as $fileOpHandle ) {
1192 throw new FileBackendError(
"Given a non-FileBackendStoreOpHandle object." );
1193 } elseif ( $fileOpHandle->backend->getName() !== $this->
getName() ) {
1194 throw new FileBackendError(
"Given a FileBackendStoreOpHandle for the wrong backend." );
1198 foreach ( $fileOpHandles
as $fileOpHandle ) {
1199 $fileOpHandle->closeResources();
1212 if ( count( $fileOpHandles ) ) {
1213 throw new FileBackendError(
"This backend supports no asynchronous operations." );
1229 static $longs =
array(
'Content-Disposition' );
1230 if ( isset( $op[
'headers'] ) ) {
1232 $maxHVLen = in_array(
$name, $longs ) ? INF : 255;
1233 if ( strlen(
$name ) > 255 || strlen(
$value ) > $maxHVLen ) {
1234 trigger_error(
"Header '$name: $value' is too long." );
1235 unset( $op[
'headers'][
$name] );
1236 } elseif ( !strlen(
$value ) ) {
1237 $op[
'headers'][
$name] =
'';
1246 $fullConts =
array();
1249 $fullConts[] = $fullCont;
1257 if ( is_array( $paths ) ) {
1258 $paths = array_map(
'FileBackend::normalizeStoragePath', $paths );
1259 $paths = array_filter( $paths,
'strlen' );
1261 if ( $paths ===
null ) {
1262 $this->cheapCache->clear();
1263 $this->expensiveCache->clear();
1266 $this->cheapCache->clear(
$path );
1267 $this->expensiveCache->clear(
$path );
1286 $params[
'concurrency'] = ( $this->parallelize !==
'off' ) ? $this->concurrency : 1;
1288 if ( $stats ===
null ) {
1292 $latest = !empty(
$params[
'latest'] );
1293 foreach ( $stats
as $path => $stat ) {
1295 if (
$path ===
null ) {
1298 if ( is_array( $stat ) ) {
1300 $stat[
'latest'] = isset( $stat[
'latest'] ) ? $stat[
'latest'] : $latest;
1301 $this->cheapCache->set(
$path,
'stat', $stat );
1303 if ( isset( $stat[
'sha1'] ) ) {
1304 $this->cheapCache->set(
$path,
'sha1',
1305 array(
'hash' => $stat[
'sha1'],
'latest' => $latest ) );
1307 if ( isset( $stat[
'xattr'] ) ) {
1309 $this->cheapCache->set(
$path,
'xattr',
1310 array(
'map' => $stat[
'xattr'],
'latest' => $latest ) );
1312 } elseif ( $stat ===
false ) {
1313 $this->cheapCache->set(
$path,
'stat',
1314 $latest ?
'NOT_EXIST_LATEST' :
'NOT_EXIST' );
1315 $this->cheapCache->set(
$path,
'xattr',
1316 array(
'map' =>
false,
'latest' => $latest ) );
1317 $this->cheapCache->set(
$path,
'sha1',
1318 array(
'hash' =>
false,
'latest' => $latest ) );
1319 wfDebug( __METHOD__ .
": File $path does not exist.\n" );
1321 wfDebug( __METHOD__ .
": Could not stat file $path.\n" );
1363 return preg_match(
'/^[a-z0-9][a-z0-9-_]{0,199}$/i', $container );
1381 if ( $backend === $this->
name ) {
1383 if ( $relPath !==
null ) {
1388 if ( $relPath !==
null ) {
1391 if ( self::isValidContainerName( $container ) ) {
1394 if ( $container !==
null ) {
1395 return array( $container, $relPath, $cShard );
1402 return array(
null,
null,
null );
1422 if ( $cShard !==
null && substr( $relPath, -1 ) !==
'/' ) {
1423 return array( $container, $relPath );
1426 return array(
null,
null );
1439 if ( $levels == 1 || $levels == 2 ) {
1441 $char = ( $base == 36 ) ?
'[0-9a-z]' :
'[0-9a-f]';
1444 if ( $levels === 1 ) {
1445 $hashDirRegex =
'(' . $char .
')';
1448 $hashDirRegex = $char .
'/(' . $char .
'{2})';
1450 $hashDirRegex =
'(' . $char .
')/(' . $char .
')';
1457 if ( preg_match(
"!^(?:[^/]{2,}/)*$hashDirRegex(?:/|$)!", $relPath, $m ) ) {
1458 return '.' . implode(
'', array_slice( $m, 1 ) );
1478 return ( $shard !==
null );
1490 if ( isset( $this->shardViaHashLevels[$container] ) ) {
1491 $config = $this->shardViaHashLevels[$container];
1492 $hashLevels = (int)$config[
'levels'];
1493 if ( $hashLevels == 1 || $hashLevels == 2 ) {
1494 $hashBase = (int)$config[
'base'];
1495 if ( $hashBase == 16 || $hashBase == 36 ) {
1496 return array( $hashLevels, $hashBase, $config[
'repeat'] );
1501 return array( 0, 0,
false );
1513 if ( $digits > 0 ) {
1514 $numShards = pow( $base, $digits );
1515 for ( $index = 0; $index < $numShards; $index++ ) {
1516 $shards[] =
'.' .
wfBaseConvert( $index, 10, $base, $digits );
1530 if ( $this->wikiId !=
'' ) {
1531 return "{$this->wikiId}-$container";
1560 return $relStoragePath;
1570 return "filebackend:{$this->name}:{$this->wikiId}:container:{$container}";
1580 $this->memCache->add( $this->
containerCacheKey( $container ), $val, 14 * 86400 );
1590 if ( !$this->memCache->set( $this->containerCacheKey( $container ),
'PURGED', 300 ) ) {
1591 trigger_error(
"Unable to delete stat cache for container $container." );
1606 $contNames =
array();
1608 foreach ( $items
as $item ) {
1609 if ( self::isStoragePath( $item ) ) {
1611 } elseif ( is_string( $item ) ) {
1618 if ( $fullCont !==
null ) {
1623 $contInfo =
array();
1625 $values = $this->memCache->getMulti( array_keys( $contNames ) );
1626 foreach ( $values
as $cacheKey => $val ) {
1627 $contInfo[$contNames[$cacheKey]] = $val;
1651 return "filebackend:{$this->name}:{$this->wikiId}:file:" . sha1(
$path );
1664 if (
$path ===
null ) {
1668 $ttl = min( 7 * 86400, max( 300, floor( .1 * $age ) ) );
1673 if ( !$this->memCache->add( $key, $val, $ttl ) && !empty( $val[
'latest'] ) ) {
1674 $this->memCache->merge(
1677 return ( is_array( $cValue ) && empty( $cValue[
'latest'] ) )
1697 if (
$path ===
null ) {
1700 if ( !$this->memCache->set( $this->fileCacheKey(
$path ),
'PURGED', 300 ) ) {
1701 trigger_error(
"Unable to delete stat cache for file $path." );
1716 $pathNames =
array();
1718 foreach ( $items
as $item ) {
1719 if ( self::isStoragePath( $item ) ) {
1724 $paths = array_filter( $paths,
'strlen' );
1728 if ( $rel !==
null ) {
1733 $values = $this->memCache->getMulti( array_keys( $pathNames ) );
1734 foreach ( $values
as $cacheKey => $val ) {
1735 if ( is_array( $val ) ) {
1736 $path = $pathNames[$cacheKey];
1737 $this->cheapCache->set(
$path,
'stat', $val );
1738 if ( isset( $val[
'sha1'] ) ) {
1739 $this->cheapCache->set(
$path,
'sha1',
1740 array(
'hash' => $val[
'sha1'],
'latest' => $val[
'latest'] ) );
1742 if ( isset( $val[
'xattr'] ) ) {
1744 $this->cheapCache->set(
$path,
'xattr',
1745 array(
'map' => $val[
'xattr'],
'latest' => $val[
'latest'] ) );
1762 $newXAttr[
'headers'][strtolower(
$name )] =
$value;
1766 $newXAttr[
'metadata'][strtolower(
$name )] =
$value;
1779 $opts[
'concurrency'] = 1;
1780 if ( $this->parallelize ===
'implicit' ) {
1781 if ( !isset( $opts[
'parallelize'] ) || $opts[
'parallelize'] ) {
1784 } elseif ( $this->parallelize ===
'explicit' ) {
1785 if ( !empty( $opts[
'parallelize'] ) ) {
1801 protected function getContentType( $storagePath, $content, $fsPath ) {
1802 return call_user_func_array( $this->mimeCallback, func_get_args() );
1828 array_map(
'fclose', $this->resourcesToClose );
1869 $iter =
new AppendIterator();
1870 foreach ( $suffixes
as $suffix ) {
1871 $iter->append( $this->
listFromShard( $this->container . $suffix ) );
1874 parent::__construct( $iter );
1877 public function accept() {
1878 $rel = $this->getInnerIterator()->current();
1879 $path = $this->params[
'dir'] .
"/{$rel}";
1880 if ( $this->backend->isSingleShardPathInternal(
$path ) ) {
1882 } elseif ( isset( $this->multiShardPaths[$rel] ) ) {
1886 $this->multiShardPaths[$rel] = 1;
1892 public function rewind() {
1894 $this->multiShardPaths =
array();
1911 $list = $this->backend->getDirectoryListInternal(
1913 if ( $list ===
null ) {
1916 return is_array( $list ) ?
new ArrayIterator( $list ) : $list;
1926 $list = $this->backend->getFileListInternal(
1928 if ( $list ===
null ) {
1929 return new ArrayIterator(
array() );
1931 return is_array( $list ) ?
new ArrayIterator( $list ) : $list;
doGetFileXAttributes(array $params)
isPathUsableInternal( $storagePath)
Check if a file can be created or changed at a given storage path.
static splitStoragePath( $storagePath)
Split a storage path into a backend name, a container name, and a relative file path.
directoryExists(array $params)
Check if a directory exists at a given storage path.
getOperationsInternal(array $ops)
Return a list of FileOp objects from a list of operations.
FileBackendStore $backend
listFromShard( $container)
Get the list for a given container shard.
Iterator for listing regular files.
getFileSha1Base36(array $params)
Get a SHA-1 hash of the file at a storage path in the backend.
static normalizeContainerPath( $path)
Validate and normalize a relative storage path.
The most up to date schema for the tables in the database will always be tables sql in the maintenance directory
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
directoriesAreVirtual()
Is this a key/value store where directories are just virtual? Virtual directories exists in so much a...
Base class for all file backend classes (including multi-write backends).
static contentTypeFromPath( $filename, $safe=true)
Determine the file type of a file based on the path.
A BagOStuff object with no objects in it.
isOK()
Returns whether the operation completed.
merge( $other, $overwriteValue=false)
Merge another status object into this one.
resolveStoragePath( $storagePath)
Splits a storage path into an internal container name, an internal relative file name,...
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getName()
Get the unique backend name.
copyInternal(array $params)
Copy a file from one storage path to another in the backend.
File backend exception for checked exceptions (e.g.
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
FileBackendStore helper function to handle listings that span container shards.
wfProfileIn( $functionname)
Begin profiling of a function.
doGetFileSha1Base36(array $params)
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
fileExists(array $params)
Check if a file exists at a storage path in the backend.
static newGood( $value=null)
Factory function for good results.
deleteFileCache( $path)
Delete the cached stat info for a file path.
static normalizeStoragePath( $storagePath)
Normalize a storage path by cleaning up directory separators.
executeOpHandlesInternal(array $fileOpHandles)
Execute a list of FileBackendStoreOpHandle handles in parallel.
interface is intended to be more or less compatible with the PHP memcached client.
isSingleShardPathInternal( $storagePath)
Check if a storage path maps to a single shard.
doDeleteInternal(array $params)
getFileSize(array $params)
Get the size (bytes) of a file at a storage path in the backend.
concatenate(array $params)
Concatenate a list of storage files into a single file system file.
getContainerHashLevels( $container)
Get the sharding config for a container.
doGetFileStat(array $params)
deleteContainerCache( $container)
Delete the cached info for a container.
getFileContentsMulti(array $params)
Like getFileContents() except it takes an array of storage paths and returns a map of storage paths t...
clearCache(array $paths=null)
Invalidate any in-process file stat and property cache.
doPublishInternal( $container, $dir, array $params)
getFileListInternal( $container, $dir, array $params)
Do not call this function from places outside FileBackend.
doOperationsInternal(array $ops, array $opts)
Iterator for listing directories.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
static isValidContainerName( $container)
Check if a container name is valid.
static placeholderProps()
Placeholder file properties to use for files that don't exist.
deleteInternal(array $params)
Delete a file at the storage path.
getScopedFileLocks(array $paths, $type, Status $status)
Lock the files at the given storage paths in the backend.
resolveContainerName( $container)
Resolve a container name, checking if it's allowed by the backend.
Class for handling function-scope profiling.
doPrimeContainerCache(array $containerInfo)
Fill the backend-specific process cache given an array of resolved container names and their correspo...
getDirectoryListInternal( $container, $dir, array $params)
Do not call this function from places outside FileBackend.
wfRestoreWarnings()
Restore error level to previous value.
static normalizeXAttributes(array $xattr)
Normalize file headers/metadata to the FileBackend::getFileXAttributes() format.
setConcurrencyFlags(array $opts)
Set the 'concurrency' option from a list of operation options.
getLocalCopyMulti(array $params)
Like getLocalCopy() except it takes an array of storage paths and returns a map of storage paths to T...
int $concurrency
How many operations can be done in parallel *.
getFileProps(array $params)
Get the properties of the file at a storage path in the backend.
FileBackendStore $backend
doConcatenate(array $params)
doDirectoryExists( $container, $dir, array $params)
getLocalReferenceMulti(array $params)
Like getLocalReference() except it takes an array of storage paths and returns a map of storage paths...
wfProfileOut( $functionname='missing')
Stop profiling of a function.
preloadFileStat(array $params)
Preload file stat information (concurrently if possible) into in-process cache.
doGetLocalReferenceMulti(array $params)
const CACHE_EXPENSIVE_SIZE
getPathsToLockForOpsInternal(array $performOps)
Get a list of storage paths to lock for a list of operations Returns an array with LockManager::LOCK_...
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
doCreateInternal(array $params)
getContainerShard( $container, $relPath)
Get the container name shard suffix for a given path.
listFromShard( $container)
Get the list for a given container shard.
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
processing should stop and the error should be shown to the user * false
getContentType( $storagePath, $content, $fsPath)
Get the content type to use in HEAD/GET requests for a file.
doCleanInternal( $container, $dir, array $params)
doCopyInternal(array $params)
doClearCache(array $paths=null)
Clears any additional stat caches for storage paths.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
doStoreInternal(array $params)
callback $mimeCallback
Method to get the MIME type of files *.
doMoveInternal(array $params)
getFileStat(array $params)
Get quick information about a file at a storage path in the backend.
static attempt(array $performOps, array $opts, FileJournal $journal)
Attempt to perform a series of file operations.
containerCacheKey( $container)
Get the cache key for a container.
resolveStoragePathReal( $storagePath)
Like resolveStoragePath() except null values are returned if the container is sharded and the shard c...
moveInternal(array $params)
Move a file from one storage path to another in the backend.
preloadCache(array $paths)
Preload persistent file stat cache and property cache into in-process cache.
__construct(FileBackendStore $backend, $container, $dir, array $suffixes, array $params)
getContainerSuffixes( $container)
Get a list of full container shard suffixes for a container.
Base class for all backends using particular storage medium.
getDirectoryList(array $params)
Get an iterator to list all directories under a storage directory.
stripInvalidHeadersFromOp(array $op)
Strip long HTTP headers from a file operation.
FileBackendStore helper class for performing asynchronous file operations.
static prepareForStream( $path, $info, $headers=array(), $sendErrors=true)
Call this function used in preparation before streaming a file.
fullContainerName( $container)
Get the full container name, including the wiki ID prefix.
doDescribeInternal(array $params)
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks & $hash
doExecuteOpHandlesInternal(array $fileOpHandles)
primeContainerCache(array $items)
Do a batch lookup from cache for container stats for all containers used in a list of container names...
setFileCache( $path, array $val)
Set the cached stat info for a file path.
primeFileCache(array $items)
Do a batch lookup from cache for file stats for all paths used in a list of storage paths or FileOp o...
fileCacheKey( $path)
Get the cache key for a file path.
doPrepareInternal( $container, $dir, array $params)
if(count( $args)==0) $dir
doGetLocalCopyMulti(array $params)
doGetFileContentsMulti(array $params)
string $name
Unique backend name *.
wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true, $engine='auto')
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to...
createInternal(array $params)
Create a file in the backend with the given contents.
resolveContainerPath( $container, $relStoragePath)
Resolve a relative storage path, checking if it's allowed by the backend.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
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
string $container
Full container name *.
storeInternal(array $params)
Store a file into the backend from a file on disk.
doStreamFile(array $params)
streamFile(array $params)
Stream the file at a storage path in the backend.
array $shardViaHashLevels
Map of container names to sharding config *.
getTopDirectoryList(array $params)
Same as FileBackend::getDirectoryList() except only lists directories that are immediately under the ...
getFileXAttributes(array $params)
Get metadata about a file at a storage path in the backend.
getFileHttpUrl(array $params)
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
nullInternal(array $params)
No-op file operation that does nothing.
Handles per process caching of items.
getFileList(array $params)
Get an iterator to list all stored files under a storage directory.
getScopedLocksForOps(array $ops, Status $status)
Get an array of scoped locks needed for a batch of file operations.
maxFileSizeInternal()
Get the maximum allowable file size given backend medium restrictions and basic performance constrain...
getFileTimestamp(array $params)
Get the last-modified timestamp of the file at a storage path.
describeInternal(array $params)
Alter metadata for a file at the storage path.
doGetFileStatMulti(array $params)
Get file stat information (concurrently if possible) for several files.
__construct(array $config)
doSecureInternal( $container, $dir, array $params)
setContainerCache( $container, array $val)
Set the cached info for a container.
string $directory
Resolved relative path *.
doQuickOperationsInternal(array $ops)
closeResources()
Close all open file handles.
static newFatal( $message)
Factory function for fatal errors.
listFromShard( $container)
Get the list for a given container shard.