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' );
1133 $async = ( $this->parallelize ===
'implicit' && count( $ops ) > 1 );
1136 $statuses =
array();
1137 $fileOpHandles =
array();
1138 $curFileOpHandles =
array();
1141 if ( !in_array(
$params[
'op'], $supportedOps ) ) {
1142 throw new FileBackendError(
"Operation '{$params['op']}' is not supported." );
1144 $method =
$params[
'op'] .
'Internal';
1145 $subStatus = $this->$method(
array(
'async' => $async ) +
$params );
1147 if ( count( $curFileOpHandles ) >= $maxConcurrency ) {
1148 $fileOpHandles[] = $curFileOpHandles;
1149 $curFileOpHandles =
array();
1151 $curFileOpHandles[$index] = $subStatus->value;
1153 $statuses[$index] = $subStatus;
1156 if ( count( $curFileOpHandles ) ) {
1157 $fileOpHandles[] = $curFileOpHandles;
1160 foreach ( $fileOpHandles
as $fileHandleBatch ) {
1164 foreach ( $statuses
as $index => $subStatus ) {
1165 $status->
merge( $subStatus );
1166 if ( $subStatus->isOK() ) {
1167 $status->success[$index] =
true;
1168 ++$status->successCount;
1170 $status->success[$index] =
false;
1171 ++$status->failCount;
1191 foreach ( $fileOpHandles
as $fileOpHandle ) {
1193 throw new FileBackendError(
"Given a non-FileBackendStoreOpHandle object." );
1194 } elseif ( $fileOpHandle->backend->getName() !== $this->
getName() ) {
1195 throw new FileBackendError(
"Given a FileBackendStoreOpHandle for the wrong backend." );
1199 foreach ( $fileOpHandles
as $fileOpHandle ) {
1200 $fileOpHandle->closeResources();
1213 if ( count( $fileOpHandles ) ) {
1214 throw new FileBackendError(
"This backend supports no asynchronous operations." );
1230 static $longs =
array(
'Content-Disposition' );
1231 if ( isset( $op[
'headers'] ) ) {
1233 $maxHVLen = in_array(
$name, $longs ) ? INF : 255;
1234 if ( strlen(
$name ) > 255 || strlen(
$value ) > $maxHVLen ) {
1235 trigger_error(
"Header '$name: $value' is too long." );
1236 unset( $op[
'headers'][
$name] );
1237 } elseif ( !strlen(
$value ) ) {
1238 $op[
'headers'][
$name] =
'';
1247 $fullConts =
array();
1250 $fullConts[] = $fullCont;
1258 if ( is_array( $paths ) ) {
1259 $paths = array_map(
'FileBackend::normalizeStoragePath', $paths );
1260 $paths = array_filter( $paths,
'strlen' );
1262 if ( $paths ===
null ) {
1263 $this->cheapCache->clear();
1264 $this->expensiveCache->clear();
1267 $this->cheapCache->clear(
$path );
1268 $this->expensiveCache->clear(
$path );
1287 $params[
'concurrency'] = ( $this->parallelize !==
'off' ) ? $this->concurrency : 1;
1289 if ( $stats ===
null ) {
1293 $latest = !empty(
$params[
'latest'] );
1294 foreach ( $stats
as $path => $stat ) {
1296 if (
$path ===
null ) {
1299 if ( is_array( $stat ) ) {
1301 $stat[
'latest'] = isset( $stat[
'latest'] ) ? $stat[
'latest'] : $latest;
1302 $this->cheapCache->set(
$path,
'stat', $stat );
1304 if ( isset( $stat[
'sha1'] ) ) {
1305 $this->cheapCache->set(
$path,
'sha1',
1306 array(
'hash' => $stat[
'sha1'],
'latest' => $latest ) );
1308 if ( isset( $stat[
'xattr'] ) ) {
1310 $this->cheapCache->set(
$path,
'xattr',
1311 array(
'map' => $stat[
'xattr'],
'latest' => $latest ) );
1313 } elseif ( $stat ===
false ) {
1314 $this->cheapCache->set(
$path,
'stat',
1315 $latest ?
'NOT_EXIST_LATEST' :
'NOT_EXIST' );
1316 $this->cheapCache->set(
$path,
'xattr',
1317 array(
'map' =>
false,
'latest' => $latest ) );
1318 $this->cheapCache->set(
$path,
'sha1',
1319 array(
'hash' =>
false,
'latest' => $latest ) );
1320 wfDebug( __METHOD__ .
": File $path does not exist.\n" );
1322 wfDebug( __METHOD__ .
": Could not stat file $path.\n" );
1364 return preg_match(
'/^[a-z0-9][a-z0-9-_]{0,199}$/i', $container );
1382 if ( $backend === $this->
name ) {
1384 if ( $relPath !==
null ) {
1389 if ( $relPath !==
null ) {
1392 if ( self::isValidContainerName( $container ) ) {
1395 if ( $container !==
null ) {
1396 return array( $container, $relPath, $cShard );
1403 return array(
null,
null,
null );
1423 if ( $cShard !==
null && substr( $relPath, -1 ) !==
'/' ) {
1424 return array( $container, $relPath );
1427 return array(
null,
null );
1440 if ( $levels == 1 || $levels == 2 ) {
1442 $char = ( $base == 36 ) ?
'[0-9a-z]' :
'[0-9a-f]';
1445 if ( $levels === 1 ) {
1446 $hashDirRegex =
'(' . $char .
')';
1449 $hashDirRegex = $char .
'/(' . $char .
'{2})';
1451 $hashDirRegex =
'(' . $char .
')/(' . $char .
')';
1458 if ( preg_match(
"!^(?:[^/]{2,}/)*$hashDirRegex(?:/|$)!", $relPath, $m ) ) {
1459 return '.' . implode(
'', array_slice( $m, 1 ) );
1479 return ( $shard !==
null );
1491 if ( isset( $this->shardViaHashLevels[$container] ) ) {
1492 $config = $this->shardViaHashLevels[$container];
1493 $hashLevels = (int)$config[
'levels'];
1494 if ( $hashLevels == 1 || $hashLevels == 2 ) {
1495 $hashBase = (int)$config[
'base'];
1496 if ( $hashBase == 16 || $hashBase == 36 ) {
1497 return array( $hashLevels, $hashBase, $config[
'repeat'] );
1502 return array( 0, 0,
false );
1514 if ( $digits > 0 ) {
1515 $numShards = pow( $base, $digits );
1516 for ( $index = 0; $index < $numShards; $index++ ) {
1517 $shards[] =
'.' .
wfBaseConvert( $index, 10, $base, $digits );
1531 if ( $this->wikiId !=
'' ) {
1532 return "{$this->wikiId}-$container";
1561 return $relStoragePath;
1571 return "filebackend:{$this->name}:{$this->wikiId}:container:{$container}";
1581 $this->memCache->add( $this->
containerCacheKey( $container ), $val, 14 * 86400 );
1591 if ( !$this->memCache->set( $this->containerCacheKey( $container ),
'PURGED', 300 ) ) {
1592 trigger_error(
"Unable to delete stat cache for container $container." );
1607 $contNames =
array();
1609 foreach ( $items
as $item ) {
1610 if ( self::isStoragePath( $item ) ) {
1612 } elseif ( is_string( $item ) ) {
1619 if ( $fullCont !==
null ) {
1624 $contInfo =
array();
1626 $values = $this->memCache->getMulti( array_keys( $contNames ) );
1627 foreach ( $values
as $cacheKey => $val ) {
1628 $contInfo[$contNames[$cacheKey]] = $val;
1652 return "filebackend:{$this->name}:{$this->wikiId}:file:" . sha1(
$path );
1665 if (
$path ===
null ) {
1669 $ttl = min( 7 * 86400, max( 300, floor( .1 * $age ) ) );
1674 if ( !$this->memCache->add( $key, $val, $ttl ) && !empty( $val[
'latest'] ) ) {
1675 $this->memCache->merge(
1678 return ( is_array( $cValue ) && empty( $cValue[
'latest'] ) )
1698 if (
$path ===
null ) {
1701 if ( !$this->memCache->set( $this->fileCacheKey(
$path ),
'PURGED', 300 ) ) {
1702 trigger_error(
"Unable to delete stat cache for file $path." );
1717 $pathNames =
array();
1719 foreach ( $items
as $item ) {
1720 if ( self::isStoragePath( $item ) ) {
1725 $paths = array_filter( $paths,
'strlen' );
1729 if ( $rel !==
null ) {
1734 $values = $this->memCache->getMulti( array_keys( $pathNames ) );
1735 foreach ( $values
as $cacheKey => $val ) {
1736 if ( is_array( $val ) ) {
1737 $path = $pathNames[$cacheKey];
1738 $this->cheapCache->set(
$path,
'stat', $val );
1739 if ( isset( $val[
'sha1'] ) ) {
1740 $this->cheapCache->set(
$path,
'sha1',
1741 array(
'hash' => $val[
'sha1'],
'latest' => $val[
'latest'] ) );
1743 if ( isset( $val[
'xattr'] ) ) {
1745 $this->cheapCache->set(
$path,
'xattr',
1746 array(
'map' => $val[
'xattr'],
'latest' => $val[
'latest'] ) );
1763 $newXAttr[
'headers'][strtolower(
$name )] =
$value;
1767 $newXAttr[
'metadata'][strtolower(
$name )] =
$value;
1780 $opts[
'concurrency'] = 1;
1781 if ( $this->parallelize ===
'implicit' ) {
1782 if ( !isset( $opts[
'parallelize'] ) || $opts[
'parallelize'] ) {
1785 } elseif ( $this->parallelize ===
'explicit' ) {
1786 if ( !empty( $opts[
'parallelize'] ) ) {
1802 protected function getContentType( $storagePath, $content, $fsPath ) {
1803 return call_user_func_array( $this->mimeCallback, func_get_args() );
1829 array_map(
'fclose', $this->resourcesToClose );
1870 $iter =
new AppendIterator();
1871 foreach ( $suffixes
as $suffix ) {
1872 $iter->append( $this->
listFromShard( $this->container . $suffix ) );
1875 parent::__construct( $iter );
1878 public function accept() {
1879 $rel = $this->getInnerIterator()->current();
1880 $path = $this->params[
'dir'] .
"/{$rel}";
1881 if ( $this->backend->isSingleShardPathInternal(
$path ) ) {
1883 } elseif ( isset( $this->multiShardPaths[$rel] ) ) {
1887 $this->multiShardPaths[$rel] = 1;
1893 public function rewind() {
1895 $this->multiShardPaths =
array();
1912 $list = $this->backend->getDirectoryListInternal(
1914 if ( $list ===
null ) {
1917 return is_array( $list ) ?
new ArrayIterator( $list ) : $list;
1927 $list = $this->backend->getFileListInternal(
1929 if ( $list ===
null ) {
1930 return new ArrayIterator(
array() );
1932 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.