10namespace Wikimedia\FileBackend;
12use InvalidArgumentException;
13use Shellbox\Command\BoxedCommand;
16use Wikimedia\FileBackend\FileIteration\FileBackendStoreShardDirIterator;
17use Wikimedia\FileBackend\FileIteration\FileBackendStoreShardFileIterator;
18use Wikimedia\FileBackend\FileOpHandle\FileBackendStoreOpHandle;
19use Wikimedia\FileBackend\FileOps\CopyFileOp;
20use Wikimedia\FileBackend\FileOps\CreateFileOp;
21use Wikimedia\FileBackend\FileOps\DeleteFileOp;
22use Wikimedia\FileBackend\FileOps\DescribeFileOp;
23use Wikimedia\FileBackend\FileOps\FileOp;
24use Wikimedia\FileBackend\FileOps\MoveFileOp;
25use Wikimedia\FileBackend\FileOps\NullFileOp;
26use Wikimedia\FileBackend\FileOps\StoreFileOp;
27use Wikimedia\FileBackend\FSFile\FSFile;
28use Wikimedia\Http\HttpHeader;
29use Wikimedia\LockManager\LockManager;
30use Wikimedia\ObjectCache\BagOStuff;
31use Wikimedia\ObjectCache\EmptyBagOStuff;
32use Wikimedia\ObjectCache\MapCacheLRU;
33use Wikimedia\ObjectCache\WANObjectCache;
82 protected const RES_ABSENT =
false;
84 protected const RES_ERROR =
null;
87 protected const ABSENT_NORMAL =
'FNE-N';
89 protected const ABSENT_LATEST =
'FNE-L';
105 parent::__construct( $config );
106 $this->mimeCallback = $config[
'mimeCallback'] ??
null;
108 $this->wanCache = $config[
'wanCache'] ?? WANObjectCache::newEmpty();
109 $this->wanStatCache = WANObjectCache::newEmpty();
111 $this->procFileStatCache =
new MapCacheLRU( self::CACHE_CHEAP_SIZE );
113 $this->procFileDataCache =
new MapCacheLRU( self::CACHE_EXPENSIVE_SIZE );
125 return min( $this->maxFileSize, PHP_INT_MAX );
161 $status = $this->
newStatus(
'backend-fail-maxsize',
166 if ( $params[
'dstExists'] ??
true ) {
201 $status = $this->
newStatus(
'backend-fail-maxsize',
206 if ( $params[
'dstExists'] ??
true ) {
243 if ( $params[
'dstExists'] ??
true ) {
306 $this->
clearCache( [ $params[
'src'], $params[
'dst'] ] );
308 if ( $params[
'dstExists'] ??
true ) {
337 if ( count( $params[
'headers'] ) ) {
374 $scopeLockS = $this->
getScopedFileLocks( $params[
'srcs'], LockManager::LOCK_UW, $status );
375 if ( $status->isOK() ) {
377 $hrStart = hrtime(
true );
379 $sec = ( hrtime(
true ) - $hrStart ) / 1e9;
380 if ( !$status->isOK() ) {
381 $this->logger->error( static::class .
"-{$this->name}" .
382 " failed to concatenate " . count( $params[
'srcs'] ) .
" file(s) [$sec sec]" );
397 $tmpPath = $params[
'dst'];
398 unset( $params[
'latest'] );
402 $ok = ( @is_file( $tmpPath ) && @filesize( $tmpPath ) == 0 );
404 $status->fatal(
'backend-fail-opentemp', $tmpPath );
411 foreach ( $fsFiles as
$path => &$fsFile ) {
416 $fsFile === self::RES_ERROR ?
'backend-fail-read' :
'backend-fail-notexists',
427 $tmpHandle = fopen( $tmpPath,
'ab' );
428 if ( $tmpHandle ===
false ) {
429 $status->fatal(
'backend-fail-opentemp', $tmpPath );
435 foreach ( $fsFiles as $virtualSource => $fsFile ) {
437 $sourceHandle = fopen( $fsFile->getPath(),
'rb' );
438 if ( $sourceHandle ===
false ) {
439 fclose( $tmpHandle );
440 $status->fatal(
'backend-fail-read', $virtualSource );
445 if ( !stream_copy_to_stream( $sourceHandle, $tmpHandle ) ) {
446 fclose( $sourceHandle );
447 fclose( $tmpHandle );
448 $status->fatal(
'backend-fail-writetemp', $tmpPath );
452 fclose( $sourceHandle );
454 if ( !fclose( $tmpHandle ) ) {
455 $status->fatal(
'backend-fail-closetemp', $tmpPath );
472 if ( $dir ===
null ) {
473 $status->fatal(
'backend-fail-invalidpath', $params[
'dir'] );
478 if ( $shard !==
null ) {
481 $this->logger->debug( __METHOD__ .
": iterating over all container shards." );
484 $status->merge( $this->
doPrepareInternal(
"{$fullCont}{$suffix}", $dir, $params ) );
504 final protected function doSecure( array $params ) {
508 if ( $dir ===
null ) {
509 $status->fatal(
'backend-fail-invalidpath', $params[
'dir'] );
514 if ( $shard !==
null ) {
517 $this->logger->debug( __METHOD__ .
": iterating over all container shards." );
520 $status->merge( $this->
doSecureInternal(
"{$fullCont}{$suffix}", $dir, $params ) );
544 if ( $dir ===
null ) {
545 $status->fatal(
'backend-fail-invalidpath', $params[
'dir'] );
550 if ( $shard !==
null ) {
553 $this->logger->debug( __METHOD__ .
": iterating over all container shards." );
556 $status->merge( $this->
doPublishInternal(
"{$fullCont}{$suffix}", $dir, $params ) );
576 final protected function doClean( array $params ) {
582 if ( $subDirsRel !==
null ) {
583 foreach ( $subDirsRel as $subDirRel ) {
584 $subDir = $params[
'dir'] .
"/{$subDirRel}";
585 $status->merge( $this->
doClean( [
'dir' => $subDir ] + $params ) );
587 unset( $subDirsRel );
592 if ( $dir ===
null ) {
593 $status->fatal(
'backend-fail-invalidpath', $params[
'dir'] );
599 $filesLockEx = [ $params[
'dir'] ];
601 $scopedLockE = $this->
getScopedFileLocks( $filesLockEx, LockManager::LOCK_EX, $status );
602 if ( !$status->isOK() ) {
606 if ( $shard !==
null ) {
610 $this->logger->debug( __METHOD__ .
": iterating over all container shards." );
613 $status->merge( $this->
doCleanInternal(
"{$fullCont}{$suffix}", $dir, $params ) );
636 if ( is_array( $stat ) ) {
640 return $stat === self::RES_ABSENT ? false : self::EXISTENCE_ERROR;
646 if ( is_array( $stat ) ) {
647 return $stat[
'mtime'];
650 return self::TIMESTAMP_FAIL;
656 if ( is_array( $stat ) ) {
657 return $stat[
'size'];
660 return self::SIZE_FAIL;
666 if (
$path ===
null ) {
667 return self::STAT_ERROR;
672 $latest = !empty( $params[
'latest'] );
674 $requireSHA1 = !empty( $params[
'requireSHA1'] );
676 $stat = $this->procFileStatCache->getField(
$path,
'stat', self::CACHE_TTL );
685 ( $requireSHA1 && is_array( $stat ) && !isset( $stat[
'sha1'] ) )
689 $stat = $this->procFileStatCache->getField(
$path,
'stat', self::CACHE_TTL );
693 if ( is_array( $stat ) ) {
695 ( !$latest || !empty( $stat[
'latest'] ) ) &&
696 ( !$requireSHA1 || isset( $stat[
'sha1'] ) )
700 } elseif ( $stat === self::ABSENT_LATEST ) {
701 return self::STAT_ABSENT;
702 } elseif ( $stat === self::ABSENT_NORMAL ) {
704 return self::STAT_ABSENT;
712 if ( is_array( $stat ) ) {
716 return $stat === self::RES_ERROR ? self::STAT_ERROR : self::STAT_ABSENT;
729 foreach ( $stats as
$path => $stat ) {
730 if ( is_array( $stat ) ) {
732 $stat[
'latest'] ??= $latest;
734 $this->procFileStatCache->setField(
$path,
'stat', $stat );
735 if ( isset( $stat[
'sha1'] ) ) {
737 $this->procFileStatCache->setField(
740 [
'hash' => $stat[
'sha1'],
'latest' => $latest ]
743 if ( isset( $stat[
'xattr'] ) ) {
746 $this->procFileStatCache->setField(
749 [
'map' => $stat[
'xattr'],
'latest' => $latest ]
754 } elseif ( $stat === self::RES_ABSENT ) {
755 $this->procFileStatCache->setField(
758 $latest ? self::ABSENT_LATEST : self::ABSENT_NORMAL
760 $this->procFileStatCache->setField(
763 [
'map' => self::XATTRS_FAIL,
'latest' => $latest ]
765 $this->procFileStatCache->setField(
768 [
'hash' => self::SHA1_FAIL,
'latest' => $latest ]
770 $this->logger->debug(
771 __METHOD__ .
': File {path} does not exist',
776 $this->logger->error(
777 __METHOD__ .
': Could not stat file {path}',
797 foreach ( $contents as
$path => $content ) {
798 if ( !is_string( $content ) ) {
799 $contents[
$path] = self::CONTENT_FAIL;
815 if ( $fsFile instanceof
FSFile ) {
817 $content = @file_get_contents( $fsFile->getPath() );
818 $contents[
$path] = is_string( $content ) ? $content : self::RES_ERROR;
821 $contents[
$path] = $fsFile;
831 if (
$path ===
null ) {
832 return self::XATTRS_FAIL;
834 $latest = !empty( $params[
'latest'] );
835 if ( $this->procFileStatCache->hasField(
$path,
'xattr', self::CACHE_TTL ) ) {
836 $stat = $this->procFileStatCache->getField(
$path,
'xattr' );
839 if ( !$latest || $stat[
'latest'] ) {
844 if ( is_array( $fields ) ) {
846 $this->procFileStatCache->setField(
849 [
'map' => $fields,
'latest' => $latest ]
851 } elseif ( $fields === self::RES_ABSENT ) {
852 $this->procFileStatCache->setField(
855 [
'map' => self::XATTRS_FAIL,
'latest' => $latest ]
858 $fields = self::XATTRS_FAIL;
871 return [
'headers' => [],
'metadata' => [] ];
877 if (
$path ===
null ) {
878 return self::SHA1_FAIL;
880 $latest = !empty( $params[
'latest'] );
881 if ( $this->procFileStatCache->hasField(
$path,
'sha1', self::CACHE_TTL ) ) {
882 $stat = $this->procFileStatCache->getField(
$path,
'sha1' );
885 if ( !$latest || $stat[
'latest'] ) {
886 return $stat[
'hash'];
890 if ( is_string( $sha1 ) ) {
891 $this->procFileStatCache->setField(
894 [
'hash' => $sha1,
'latest' => $latest ]
896 } elseif ( $sha1 === self::RES_ABSENT ) {
897 $this->procFileStatCache->setField(
900 [
'hash' => self::SHA1_FAIL,
'latest' => $latest ]
903 $sha1 = self::SHA1_FAIL;
917 if ( $fsFile instanceof
FSFile ) {
918 $sha1 = $fsFile->getSha1Base36();
920 return is_string( $sha1 ) ? $sha1 : self::RES_ERROR;
923 return $fsFile === self::RES_ERROR ? self::RES_ERROR : self::RES_ABSENT;
930 return $fsFile ? $fsFile->getProps() : FSFile::placeholderProps();
938 $latest = !empty( $params[
'latest'] );
940 foreach ( $params[
'srcs'] as $src ) {
942 if (
$path ===
null ) {
943 $fsFiles[$src] = self::RES_ERROR;
944 } elseif ( $this->procFileDataCache->hasField(
$path,
'localRef' ) ) {
945 $val = $this->procFileDataCache->getField(
$path,
'localRef' );
948 if ( !$latest || $val[
'latest'] ) {
949 $fsFiles[$src] = $val[
'object'];
954 $params[
'srcs'] = array_diff( $params[
'srcs'], array_keys( $fsFiles ) );
956 $fsFiles[
$path] = $fsFile;
957 if ( $fsFile instanceof
FSFile ) {
958 $this->procFileDataCache->setField(
961 [
'object' => $fsFile,
'latest' => $latest ]
1000 return self::TEMPURL_ERROR;
1008 if ( $ref ===
false ) {
1009 return $this->
newStatus(
'backend-fail-notexists', $params[
'src'] );
1010 } elseif ( $ref ===
null ) {
1011 return $this->
newStatus(
'backend-fail-read', $params[
'src'] );
1013 $file = $command->newInputFileFromFile( $ref->getPath() )
1014 ->userData( __CLASS__, $ref );
1015 $command->inputFile( $boxedName, $file );
1025 $params[
'options'] ??= [];
1026 $params[
'headers'] ??= [];
1029 if ( ( empty( $params[
'headless'] ) || $params[
'headers'] ) && HttpHeader::headersSent() ) {
1030 print
"Headers already sent, terminating.\n";
1031 $status->fatal(
'backend-fail-stream', $params[
'src'] );
1057 $this->getStreamerOptions()
1059 $res = $streamer->stream( $params[
'headers'],
true, $params[
'options'], $flags );
1066 $status->fatal(
'backend-fail-stream', $params[
'src'] );
1075 if ( $dir ===
null ) {
1076 return self::EXISTENCE_ERROR;
1078 if ( $shard !==
null ) {
1081 $this->logger->debug( __METHOD__ .
": iterating over all container shards." );
1086 if ( $exists ===
true ) {
1089 } elseif ( $exists === self::RES_ERROR ) {
1090 $res = self::EXISTENCE_ERROR;
1111 if ( $dir ===
null ) {
1112 return self::EXISTENCE_ERROR;
1114 if ( $shard !==
null ) {
1118 $this->logger->debug( __METHOD__ .
": iterating over all container shards." );
1142 if ( $dir ===
null ) {
1143 return self::LIST_ERROR;
1145 if ( $shard !==
null ) {
1149 $this->logger->debug( __METHOD__ .
": iterating over all container shards." );
1183 'store' => StoreFileOp::class,
1184 'copy' => CopyFileOp::class,
1185 'move' => MoveFileOp::class,
1186 'delete' => DeleteFileOp::class,
1187 'create' => CreateFileOp::class,
1188 'describe' => DescribeFileOp::class,
1189 'null' => NullFileOp::class
1194 foreach ( $ops as $operation ) {
1195 $opName = $operation[
'op'];
1196 if ( isset( $supportedOps[$opName] ) ) {
1197 $class = $supportedOps[$opName];
1199 $params = $operation;
1201 $performOps[] =
new $class( $this, $params, $this->logger );
1222 $paths = [
'sh' => [],
'ex' => [] ];
1223 foreach ( $performOps as $fileOp ) {
1224 $paths[
'sh'] = array_merge( $paths[
'sh'], $fileOp->storagePathsRead() );
1225 $paths[
'ex'] = array_merge( $paths[
'ex'], $fileOp->storagePathsChanged() );
1228 $paths[
'sh'] = array_diff( $paths[
'sh'], $paths[
'ex'] );
1230 $paths[
'sh'] = array_merge( $paths[
'sh'], array_map(
'dirname', $paths[
'ex'] ) );
1233 LockManager::LOCK_UW => $paths[
'sh'],
1234 LockManager::LOCK_EX => $paths[
'ex']
1254 foreach ( $fileOps as $fileOp ) {
1255 $pathsUsed = array_merge( $pathsUsed, $fileOp->storagePathsReadOrChanged() );
1259 if ( empty( $opts[
'nonLocking'] ) ) {
1263 if ( !$status->isOK() ) {
1269 if ( empty( $opts[
'preserveCache'] ) ) {
1274 $this->procFileStatCache->setMaxSize(
1275 max( 2 * count( $pathsUsed ), self::CACHE_CHEAP_SIZE )
1281 $ok = $this->
preloadFileStat( [
'srcs' => $pathsUsed,
'latest' =>
true ] );
1289 $subStatus = $this->
newStatus(
'backend-fail-internal', $this->name );
1290 foreach ( $ops as $i => $op ) {
1291 $subStatus->success[$i] =
false;
1292 ++$subStatus->failCount;
1294 $this->logger->error( static::class .
"-{$this->name} stat failure",
1295 [
'aborted_operations' => $ops ]
1300 $status->merge( $subStatus );
1301 $status->success = $subStatus->success;
1304 $this->procFileStatCache->setMaxSize( self::CACHE_CHEAP_SIZE );
1318 foreach ( $fileOps as $fileOp ) {
1319 $pathsUsed = array_merge( $pathsUsed, $fileOp->storagePathsReadOrChanged() );
1326 $async = ( $this->parallelize ===
'implicit' && count( $ops ) > 1 );
1332 foreach ( $fileOps as $index => $fileOp ) {
1334 ? $fileOp->attemptAsyncQuick()
1335 : $fileOp->attemptQuick();
1337 if ( count( $batch ) >= $maxConcurrency ) {
1343 $batch[$index] = $subStatus->value;
1345 $statuses[$index] = $subStatus;
1348 if ( count( $batch ) ) {
1352 foreach ( $statuses as $index => $subStatus ) {
1353 $status->merge( $subStatus );
1354 if ( $subStatus->isOK() ) {
1355 $status->success[$index] =
true;
1356 ++$status->successCount;
1358 $status->success[$index] =
false;
1359 ++$status->failCount;
1378 foreach ( $fileOpHandles as $fileOpHandle ) {
1380 throw new InvalidArgumentException(
"Expected FileBackendStoreOpHandle object." );
1381 } elseif ( $fileOpHandle->backend->getName() !== $this->getName() ) {
1382 throw new InvalidArgumentException(
"Expected handle for this file backend." );
1387 foreach ( $fileOpHandles as $fileOpHandle ) {
1388 $fileOpHandle->closeResources();
1404 if ( count( $fileOpHandles ) ) {
1405 throw new FileBackendError(
"Backend does not support asynchronous operations." );
1423 static $longs = [
'content-disposition' ];
1425 if ( isset( $op[
'headers'] ) ) {
1427 foreach ( $op[
'headers'] as
$name => $value ) {
1429 $maxHVLen = in_array(
$name, $longs ) ? INF : 255;
1430 if ( strlen(
$name ) > 255 || strlen( $value ) > $maxHVLen ) {
1431 $this->logger->error(
"Header '{header}' is too long.", [
1432 'filebackend' => $this->name,
1433 'header' =>
"$name: $value",
1436 $newHeaders[
$name] = strlen( $value ) ? $value :
'';
1439 $op[
'headers'] = $newHeaders;
1447 foreach ( $paths as
$path ) {
1449 $fullConts[] = $fullCont;
1457 if ( is_array( $paths ) ) {
1459 $paths = array_filter( $paths,
'strlen' );
1461 if ( $paths ===
null ) {
1462 $this->procFileStatCache->clear();
1463 $this->procFileDataCache->clear();
1465 foreach ( $paths as
$path ) {
1466 $this->procFileStatCache->clear(
$path );
1467 $this->procFileDataCache->clear(
$path );
1486 $params[
'concurrency'] = ( $this->parallelize !==
'off' ) ? $this->concurrency : 1;
1488 if ( $stats ===
null ) {
1493 $latest = !empty( $params[
'latest'] );
1557 return (
bool)preg_match(
'/^[a-z0-9][a-z0-9-_.]{0,199}$/i', $container );
1575 if ( $backend === $this->name && $relPath !==
null ) {
1577 if ( $relPath !==
null && self::isValidShortContainerName( $shortCont ) ) {
1582 if ( $relPath !==
null ) {
1585 if ( self::isValidContainerName( $container ) ) {
1588 if ( $container !==
null ) {
1589 return [ $container, $relPath, $cShard ];
1596 return [
null,
null, null ];
1616 if ( $cShard !==
null && !str_ends_with( $relPath,
'/' ) ) {
1617 return [ $container, $relPath ];
1620 return [
null, null ];
1633 if ( $levels == 1 || $levels == 2 ) {
1635 $char = ( $base == 36 ) ?
'[0-9a-z]' :
'[0-9a-f]';
1638 if ( $levels === 1 ) {
1639 $hashDirRegex =
'(' . $char .
')';
1642 $hashDirRegex = $char .
'/(' . $char .
'{2})';
1644 $hashDirRegex =
'(' . $char .
')/(' . $char .
')';
1651 if ( preg_match(
"!^(?:[^/]{2,}/)*$hashDirRegex(?:/|$)!", $relPath, $m ) ) {
1652 return '.' . implode(
'', array_slice( $m, 1 ) );
1672 return ( $shard !==
null );
1684 if ( isset( $this->shardViaHashLevels[$container] ) ) {
1685 $config = $this->shardViaHashLevels[$container];
1686 $hashLevels = (int)$config[
'levels'];
1687 if ( $hashLevels == 1 || $hashLevels == 2 ) {
1688 $hashBase = (int)$config[
'base'];
1689 if ( $hashBase == 16 || $hashBase == 36 ) {
1690 return [ $hashLevels, $hashBase, $config[
'repeat'] ];
1695 return [ 0, 0, false ];
1707 if ( $digits > 0 ) {
1708 $numShards = $base ** $digits;
1709 for ( $index = 0; $index < $numShards; $index++ ) {
1710 $shards[] =
'.' . \Wikimedia\base_convert( (
string)$index, 10, $base, $digits );
1724 if ( $this->domainId !=
'' ) {
1725 return "{$this->domainId}-$container";
1756 return $relStoragePath;
1765 private function containerCacheKey( $container ) {
1766 return "filebackend:{$this->name}:{$this->domainId}:container:{$container}";
1776 if ( !$this->wanStatCache->set(
1777 $this->containerCacheKey( $container ),
1781 $this->logger->warning(
"Unable to set stat cache for container {container}.",
1782 [
'filebackend' => $this->name,
'container' => $container ]
1794 if ( !$this->wanStatCache->delete( $this->containerCacheKey( $container ), 300 ) ) {
1795 $this->logger->warning(
"Unable to delete stat cache for container {container}.",
1796 [
'filebackend' => $this->name,
'container' => $container ]
1810 foreach ( $items as $item ) {
1811 if ( self::isStoragePath( $item ) ) {
1813 } elseif ( is_string( $item ) ) {
1814 $contNames[$this->containerCacheKey( $item )] = $item;
1818 foreach ( $paths as
$path ) {
1820 if ( $fullCont !==
null ) {
1821 $contNames[$this->containerCacheKey( $fullCont )] = $fullCont;
1827 $values = $this->wanStatCache->getMulti( array_keys( $contNames ) );
1828 foreach ( $values as $cacheKey => $val ) {
1829 $contInfo[$contNames[$cacheKey]] = $val;
1853 private function fileCacheKey(
$path ) {
1854 return "filebackend:{$this->name}:{$this->domainId}:file:" . sha1(
$path );
1867 if (
$path ===
null ) {
1871 if ( !$this->wanStatCache->set( $this->fileCacheKey(
$path ), $val, 7 * 86400 ) ) {
1872 $this->logger->warning(
"Unable to set stat cache for file {path}.",
1873 [
'filebackend' => $this->name,
'path' =>
$path ]
1888 if (
$path ===
null ) {
1891 if ( !$this->wanStatCache->delete( $this->fileCacheKey(
$path ), 300 ) ) {
1892 $this->logger->warning(
"Unable to delete stat cache for file {path}.",
1893 [
'filebackend' => $this->name,
'path' =>
$path ]
1909 foreach ( $items as $item ) {
1910 if ( self::isStoragePath( $item ) ) {
1912 if (
$path !==
null ) {
1918 foreach ( $paths as
$path ) {
1920 if ( $rel !==
null ) {
1921 $pathNames[$this->fileCacheKey(
$path )] =
$path;
1926 $values = $this->wanStatCache->getMulti( array_keys( $pathNames ) );
1928 foreach ( array_filter( $values,
'is_array' ) as $cacheKey => $stat ) {
1929 $path = $pathNames[$cacheKey];
1932 unset( $stat[
'latest'] );
1934 $this->procFileStatCache->setField(
$path,
'stat', $stat );
1935 if ( isset( $stat[
'sha1'] ) && strlen( $stat[
'sha1'] ) == 31 ) {
1937 $this->procFileStatCache->setField(
1940 [
'hash' => $stat[
'sha1'],
'latest' =>
false ]
1943 if ( isset( $stat[
'xattr'] ) && is_array( $stat[
'xattr'] ) ) {
1946 $this->procFileStatCache->setField(
1949 [
'map' => $stat[
'xattr'],
'latest' =>
false ]
1963 $newXAttr = [
'headers' => [],
'metadata' => [] ];
1965 foreach ( $xattr[
'headers'] as
$name => $value ) {
1966 $newXAttr[
'headers'][strtolower(
$name )] = $value;
1969 foreach ( $xattr[
'metadata'] as
$name => $value ) {
1970 $newXAttr[
'metadata'][strtolower(
$name )] = $value;
1983 $opts[
'concurrency'] = 1;
1984 if ( $this->parallelize ===
'implicit' ) {
1985 if ( $opts[
'parallelize'] ??
true ) {
1988 } elseif ( $this->parallelize ===
'explicit' ) {
1989 if ( !empty( $opts[
'parallelize'] ) ) {
2007 if ( $this->mimeCallback ) {
2008 return ( $this->mimeCallback )( $storagePath, $content, $fsPath );
2011 $mime = ( $fsPath !== null ) ? mime_content_type( $fsPath ) :
false;
2012 return $mime ?:
'unknown/unknown';
2017class_alias( FileBackendStore::class,
'FileBackendStore' );