12use InvalidArgumentException;
28use Shellbox\Command\BoxedCommand;
139 protected $fileFactory = [ UnregisteredLocalFile::class,
'newFromTitle' ];
176 || !array_key_exists(
'name', $info )
177 || !array_key_exists(
'backend', $info )
179 throw new InvalidArgumentException( __CLASS__ .
180 " requires an array of options having both 'name' and 'backend' keys.\n" );
184 $this->name = $info[
'name'];
186 $this->backend = $info[
'backend'];
193 $optionalSettings = [
194 'descBaseUrl',
'scriptDirUrl',
'articleUrl',
'fetchDescription',
195 'thumbScriptUrl',
'pathDisclosureProtection',
'descriptionCacheExpiry',
196 'favicon',
'thumbProxyUrl',
'thumbProxySecret',
'disableLocalTransform'
198 foreach ( $optionalSettings as $var ) {
199 if ( isset( $info[$var] ) ) {
200 $this->$var = $info[$var];
207 $this->initialCapital = $info[
'initialCapital'] ?? $localCapitalLinks;
208 if ( $localCapitalLinks && !$this->initialCapital ) {
216 throw new InvalidArgumentException(
217 'File repos with initial capital false are not allowed on wikis where the File ' .
218 'namespace has initial capital true' );
221 $this->url = $info[
'url'] ??
false;
222 $defaultThumbUrl = $this->url ? $this->url .
'/thumb' :
false;
223 $this->thumbUrl = $info[
'thumbUrl'] ?? $defaultThumbUrl;
224 $this->hashLevels = $info[
'hashLevels'] ?? 2;
226 $this->transformVia404 = !empty( $info[
'transformVia404'] );
227 $this->abbrvThreshold = $info[
'abbrvThreshold'] ?? 255;
228 $this->isPrivate = !empty( $info[
'isPrivate'] );
230 $this->zones = $info[
'zones'] ?? [];
231 foreach ( [
'public',
'thumb',
'transcoded',
'temp',
'deleted' ] as $zone ) {
232 if ( !isset( $this->zones[$zone][
'container'] ) ) {
233 $this->zones[$zone][
'container'] =
"{$this->name}-{$zone}";
235 if ( !isset( $this->zones[$zone][
'directory'] ) ) {
236 $this->zones[$zone][
'directory'] =
'';
238 if ( !isset( $this->zones[$zone][
'urlsByExt'] ) ) {
239 $this->zones[$zone][
'urlsByExt'] = [];
245 $this->wanCache = $info[
'wanCache'] ?? WANObjectCache::newEmpty();
264 return $this->backend->getReadOnlyReason();
273 foreach ( (array)$doZones as $zone ) {
275 if ( $root ===
null ) {
276 throw new RuntimeException(
"No '$zone' zone defined in the {$this->name} repo." );
288 return str_starts_with(
$url,
'mwrepo://' );
300 $path =
'mwrepo://' . $this->name;
301 if ( $suffix !==
false ) {
302 $path .=
'/' . rawurlencode( $suffix );
316 if ( in_array( $zone, [
'public',
'thumb',
'transcoded' ] ) ) {
318 if ( $ext !==
null && isset( $this->zones[$zone][
'urlsByExt'][$ext] ) ) {
321 return $this->zones[$zone][
'urlsByExt'][$ext];
322 } elseif ( isset( $this->zones[$zone][
'url'] ) ) {
324 return $this->zones[$zone][
'url'];
334 return $this->thumbUrl;
336 return "{$this->url}/transcoded";
358 if ( !str_starts_with(
$url,
'mwrepo://' ) ) {
359 throw new InvalidArgumentException( __METHOD__ .
': unknown protocol' );
361 $bits = explode(
'/', substr(
$url, 9 ), 3 );
362 if ( count( $bits ) != 3 ) {
363 throw new InvalidArgumentException( __METHOD__ .
": invalid mwrepo URL: $url" );
365 [ $repo, $zone, $rel ] = $bits;
366 if ( $repo !== $this->name ) {
367 throw new InvalidArgumentException( __METHOD__ .
": fetching from a foreign repo is not supported" );
369 $base = $this->getZonePath( $zone );
371 throw new InvalidArgumentException( __METHOD__ .
": invalid zone: $zone" );
374 return $base .
'/' . rawurldecode( $rel );
384 if ( !isset( $this->zones[$zone] ) ) {
385 return [
null, null ];
388 return [ $this->zones[$zone][
'container'], $this->zones[$zone][
'directory'] ];
398 [ $container, $base ] = $this->getZoneLocation( $zone );
399 if ( $container ===
null || $base ===
null ) {
402 $backendName = $this->backend->getName();
407 return "mwstore://$backendName/{$container}{$base}";
421 public function newFile( $title, $time =
false ) {
422 $title = File::normalizeTitle( $title );
427 if ( $this->oldFileFactory ) {
428 return ( $this->oldFileFactory )( $title, $this, $time );
433 return ( $this->fileFactory )( $title, $this );
456 public function findFile( $title, $options = [] ) {
457 if ( !empty( $options[
'private'] ) && !( $options[
'private'] instanceof
Authority ) ) {
458 throw new InvalidArgumentException(
459 __METHOD__ .
' called with the `private` option set to something ' .
460 'other than an Authority object'
464 $title = File::normalizeTitle( $title );
468 if ( isset( $options[
'bypassCache'] ) ) {
469 $options[
'latest'] = $options[
'bypassCache'];
471 $time = $options[
'time'] ??
false;
472 $flags = !empty( $options[
'latest'] ) ? IDBAccessObject::READ_LATEST : 0;
473 # First try the current version of the file to see if it precedes the timestamp
474 $img = $this->newFile( $title );
478 $img->load( $flags );
479 if ( $img->exists() && ( !$time || $img->getTimestamp() == $time ) ) {
482 # Now try an old version of the file
483 if ( $time !==
false ) {
484 $img = $this->newFile( $title, $time );
486 $img->load( $flags );
487 if ( $img->exists() ) {
488 if ( !$img->isDeleted( File::DELETED_FILE ) ) {
492 !empty( $options[
'private'] ) &&
493 $img->userCan( File::DELETED_FILE, $options[
'private'] )
502 if ( !empty( $options[
'ignoreRedirect'] ) ) {
505 $redir = $this->checkRedirect( $title );
506 if ( $redir && $title->getNamespace() ===
NS_FILE ) {
507 $img = $this->newFile( $redir );
511 $img->load( $flags );
512 if ( $img->exists() ) {
513 $img->redirectedFrom( $title->getDBkey() );
541 foreach ( $items as $item ) {
542 if ( is_array( $item ) ) {
543 $title = $item[
'title'];
545 unset( $options[
'title'] );
548 !empty( $options[
'private'] ) &&
549 !( $options[
'private'] instanceof
Authority )
551 $options[
'private'] = RequestContext::getMain()->getAuthority();
557 $file = $this->findFile( $title, $options );
559 $searchName = File::normalizeTitle( $title )->getDBkey();
560 if ( $flags & self::NAME_AND_TIME_ONLY ) {
561 $result[$searchName] = [
562 'title' => $file->getTitle()->getDBkey(),
563 'timestamp' => $file->getTimestamp()
566 $result[$searchName] = $file;
585 if ( !empty( $options[
'private'] ) && !( $options[
'private'] instanceof
Authority ) ) {
586 throw new InvalidArgumentException(
587 __METHOD__ .
' called with the `private` option set to something ' .
588 'other than an Authority object'
592 $time = $options[
'time'] ??
false;
593 # First try to find a matching current version of a file...
594 if ( !$this->fileFactoryKey ) {
597 $img = ( $this->fileFactoryKey )( $sha1, $this, $time );
598 if ( $img && $img->exists() ) {
601 # Now try to find a matching old version of a file...
602 if ( $time !==
false && $this->oldFileFactoryKey ) {
603 $img = ( $this->oldFileFactoryKey )( $sha1, $this, $time );
604 if ( $img && $img->exists() ) {
605 if ( !$img->isDeleted( File::DELETED_FILE ) ) {
609 !empty( $options[
'private'] ) &&
610 $img->userCan( File::DELETED_FILE, $options[
'private'] )
641 foreach ( $hashes as $hash ) {
642 $files = $this->findBySha1( $hash );
643 if ( count( $files ) ) {
644 $result[$hash] = $files;
669 return $this->thumbScriptUrl;
678 return $this->thumbProxyUrl;
687 return $this->thumbProxySecret;
696 return $this->transformVia404;
706 return !$this->disableLocalTransform;
717 $this->initialCapital !=
720 $name = $title->getDBkey();
721 if ( $this->initialCapital ) {
725 $name = $title->getDBkey();
737 return $this->getZonePath(
'public' );
748 return self::getHashPathForLevel( $name, $this->hashLevels );
759 $parts = explode(
'!', $suffix, 2 );
760 $name = $parts[1] ?? $suffix;
761 return self::getHashPathForLevel( $name, $this->hashLevels );
770 if ( $levels == 0 ) {
773 $hash = md5( $name );
775 for ( $i = 1; $i <= $levels; $i++ ) {
776 $path .= substr( $hash, 0, $i ) .
'/';
789 return $this->hashLevels;
808 public function makeUrl( $query =
'', $entry =
'index' ) {
809 if ( $this->scriptDirUrl !==
null ) {
810 return wfAppendQuery(
"{$this->scriptDirUrl}/{$entry}.php", $query );
830 if ( $this->descBaseUrl !==
null ) {
831 # "http://example.com/wiki/File:"
832 return $this->descBaseUrl . $encName;
834 if ( $this->articleUrl !==
null ) {
835 # "http://example.com/wiki/$1"
836 # We use "Image:" as the canonical namespace for
837 # compatibility across all MediaWiki versions.
838 return str_replace(
'$1',
839 "Image:$encName", $this->articleUrl );
841 if ( $this->scriptDirUrl !==
null ) {
842 # "http://example.com/w"
843 # We use "Image:" as the canonical namespace for
844 # compatibility across all MediaWiki versions,
845 # and just sort of hope index.php is right. ;)
846 return $this->makeUrl(
"title=Image:$encName" );
863 $query =
'action=render';
864 if ( $lang !==
null ) {
865 $query .=
'&uselang=' . urlencode( $lang );
867 if ( $this->scriptDirUrl !==
null ) {
868 return $this->makeUrl(
873 $descUrl = $this->getDescriptionUrl( $name );
888 if ( $this->scriptDirUrl !==
null ) {
891 return $this->makeUrl(
'title=MediaWiki:Filepage.css&action=raw&ctype=text/css' );
914 public function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
915 $this->assertWritableRepo();
917 $status = $this->storeBatch( [ [ $srcPath, $dstZone, $dstRel ] ], $flags );
918 if ( $status->successCount == 0 ) {
919 $status->setOK(
false );
939 $this->assertWritableRepo();
941 if ( $flags & self::DELETE_SOURCE ) {
942 throw new InvalidArgumentException(
"DELETE_SOURCE not supported in " . __METHOD__ );
945 $status = $this->newGood();
946 $backend = $this->backend;
950 foreach ( $triplets as [ $src, $dstZone, $dstRel ] ) {
951 $srcPath = ( $src instanceof
FSFile ) ? $src->getPath() : $src;
953 .
"( \$src='$srcPath', \$dstZone='$dstZone', \$dstRel='$dstRel' )"
956 if ( $src instanceof
FSFile ) {
959 $src = $this->resolveToStoragePathIfVirtual( $src );
963 $root = $this->getZonePath( $dstZone );
965 throw new RuntimeException(
"Invalid zone: $dstZone" );
967 if ( !$this->validateFilename( $dstRel ) ) {
968 throw new RuntimeException(
'Validation error in $dstRel' );
970 $dstPath =
"$root/$dstRel";
971 $dstDir = dirname( $dstPath );
973 if ( !$this->initDirectory( $dstDir )->isOK() ) {
974 return $this->newFatal(
'directorycreateerror', $dstDir );
982 'overwrite' => (bool)( $flags & self::OVERWRITE ),
983 'overwriteSame' => (bool)( $flags & self::OVERWRITE_SAME ),
988 $opts = [
'force' => true ];
989 if ( $flags & self::SKIP_LOCKING ) {
990 $opts[
'nonLocking'] =
true;
993 return $status->merge( $backend->doOperations( $operations, $opts ) );
1007 $this->assertWritableRepo();
1009 $status = $this->newGood();
1012 foreach ( $files as
$path ) {
1013 if ( is_array(
$path ) ) {
1015 [ $zone, $rel ] =
$path;
1016 $path = $this->getZonePath( $zone ) .
"/$rel";
1019 $path = $this->resolveToStoragePathIfVirtual(
$path );
1021 $operations[] = [
'op' =>
'delete',
'src' =>
$path ];
1024 $opts = [
'force' => true ];
1025 if ( $flags & self::SKIP_LOCKING ) {
1026 $opts[
'nonLocking'] =
true;
1029 return $status->merge( $this->backend->doOperations( $operations, $opts ) );
1050 return $this->quickImportBatch( [ [ $src, $dst, $options ] ] );
1068 $status = $this->newGood();
1070 foreach ( $triples as $triple ) {
1071 [ $src, $dst ] = $triple;
1072 if ( $src instanceof
FSFile ) {
1075 $src = $this->resolveToStoragePathIfVirtual( $src );
1078 $dst = $this->resolveToStoragePathIfVirtual( $dst );
1080 if ( !isset( $triple[2] ) ) {
1082 } elseif ( is_string( $triple[2] ) ) {
1084 $headers = [
'Content-Disposition' => $triple[2] ];
1085 } elseif ( is_array( $triple[2] ) && isset( $triple[2][
'headers'] ) ) {
1086 $headers = $triple[2][
'headers'];
1095 'headers' => $headers
1097 $status->merge( $this->initDirectory( dirname( $dst ) ) );
1100 return $status->merge( $this->backend->doQuickOperations( $operations ) );
1112 return $this->quickPurgeBatch( [
$path ] );
1123 return $this->newGood()->merge(
1124 $this->backend->clean(
1125 [
'dir' => $this->resolveToStoragePathIfVirtual( $dir ) ]
1139 $status = $this->newGood();
1141 foreach ( $paths as
$path ) {
1144 'src' => $this->resolveToStoragePathIfVirtual(
$path ),
1145 'ignoreMissingSource' => true
1148 $status->merge( $this->backend->doQuickOperations( $operations ) );
1164 $this->assertWritableRepo();
1166 $date = MWTimestamp::getInstance()->format(
'YmdHis' );
1167 $hashPath = $this->getHashPath( $originalName );
1168 $dstUrlRel = $hashPath . $date .
'!' . rawurlencode( $originalName );
1169 $virtualUrl = $this->getVirtualUrl(
'temp' ) .
'/' . $dstUrlRel;
1171 $result = $this->quickImport( $srcPath, $virtualUrl );
1172 $result->value = $virtualUrl;
1184 $this->assertWritableRepo();
1186 $temp = $this->getVirtualUrl(
'temp' );
1187 if ( !str_starts_with( $virtualUrl, $temp ) ) {
1188 wfDebug( __METHOD__ .
": Invalid temp virtual URL" );
1193 return $this->quickPurge( $virtualUrl )->isOK();
1205 public function concatenate( array $srcPaths, $dstPath, $flags = 0 ) {
1206 $this->assertWritableRepo();
1208 $status = $this->newGood();
1211 foreach ( $srcPaths as $srcPath ) {
1213 $source = $this->resolveToStoragePathIfVirtual( $srcPath );
1218 $params = [
'srcs' => $sources,
'dst' => $dstPath ];
1219 $status->merge( $this->backend->concatenate( $params ) );
1220 if ( !$status->isOK() ) {
1225 if ( $flags & self::DELETE_SOURCE ) {
1226 $status->merge( $this->quickPurgeBatch( $srcPaths ) );
1230 $status->setResult(
true );
1259 $src, $dstRel, $archiveRel, $flags = 0, array $options = []
1261 $this->assertWritableRepo();
1263 $status = $this->publishBatch(
1264 [ [ $src, $dstRel, $archiveRel, $options ] ], $flags );
1265 if ( $status->successCount == 0 ) {
1266 $status->setOK(
false );
1268 $status->value = $status->value[0] ??
false;
1285 $this->assertWritableRepo();
1287 $backend = $this->backend;
1289 $this->initZones(
'public' );
1291 $status = $this->newGood( [] );
1294 $sourceFSFilesToDelete = [];
1296 foreach ( $ntuples as $ntuple ) {
1297 [ $src, $dstRel, $archiveRel ] = $ntuple;
1298 $srcPath = ( $src instanceof
FSFile ) ? $src->getPath() : $src;
1300 $options = $ntuple[3] ?? [];
1302 $srcPath = $this->resolveToStoragePathIfVirtual( $srcPath );
1303 if ( !$this->validateFilename( $dstRel ) ) {
1304 throw new RuntimeException(
'Validation error in $dstRel' );
1306 if ( !$this->validateFilename( $archiveRel ) ) {
1307 throw new RuntimeException(
'Validation error in $archiveRel' );
1310 $publicRoot = $this->getZonePath(
'public' );
1311 $dstPath =
"$publicRoot/$dstRel";
1312 $archivePath =
"$publicRoot/$archiveRel";
1314 $dstDir = dirname( $dstPath );
1315 $archiveDir = dirname( $archivePath );
1317 if ( !$this->initDirectory( $dstDir )->isOK() ) {
1318 return $this->newFatal(
'directorycreateerror', $dstDir );
1320 if ( !$this->initDirectory( $archiveDir )->isOK() ) {
1321 return $this->newFatal(
'directorycreateerror', $archiveDir );
1325 $headers = $options[
'headers'] ?? [];
1336 'dst' => $archivePath,
1337 'ignoreMissingSource' => true
1343 'op' => ( $flags & self::DELETE_SOURCE ) ?
'move' :
'copy',
1346 'overwrite' =>
true,
1347 'headers' => $headers
1354 'overwrite' =>
true,
1355 'headers' => $headers
1357 if ( $flags & self::DELETE_SOURCE ) {
1358 $sourceFSFilesToDelete[] = $srcPath;
1364 $status->merge( $backend->doOperations( $operations ) );
1366 foreach ( $ntuples as $i => $ntuple ) {
1367 [ , , $archiveRel ] = $ntuple;
1368 $archivePath = $this->getZonePath(
'public' ) .
"/$archiveRel";
1369 if ( $this->fileExists( $archivePath ) ) {
1370 $status->value[$i] =
'archived';
1372 $status->value[$i] =
'new';
1376 foreach ( $sourceFSFilesToDelete as $file ) {
1392 $path = $this->resolveToStoragePathIfVirtual( $dir );
1395 $params = [
'dir' =>
$path ];
1396 if ( $this->isPrivate
1397 || $container === $this->zones[
'deleted'][
'container']
1398 || $container === $this->zones[
'temp'][
'container']
1400 # Take all available measures to prevent web accessibility of new deleted
1401 # directories, in case the user has not configured offline storage
1402 $params = [
'noAccess' =>
true,
'noListing' => true ] + $params;
1405 return $this->newGood()->merge( $this->backend->prepare( $params ) );
1415 $this->assertWritableRepo();
1417 return $this->newGood()->merge(
1418 $this->backend->clean(
1419 [
'dir' => $this->resolveToStoragePathIfVirtual( $dir ) ]
1431 $result = $this->fileExistsBatch( [ $file ] );
1444 $paths = array_map( $this->resolveToStoragePathIfVirtual( ... ), $files );
1445 $this->backend->preloadFileStat( [
'srcs' => $paths ] );
1448 foreach ( $paths as $key =>
$path ) {
1449 $result[$key] = $this->backend->fileExists( [
'src' =>
$path ] );
1465 public function delete( $srcRel, $archiveRel ) {
1466 $this->assertWritableRepo();
1468 return $this->deleteBatch( [ [ $srcRel, $archiveRel ] ] );
1488 $this->assertWritableRepo();
1491 $this->initZones( [
'public',
'deleted' ] );
1493 $status = $this->newGood();
1495 $backend = $this->backend;
1498 foreach ( $sourceDestPairs as [ $srcRel, $archiveRel ] ) {
1499 if ( !$this->validateFilename( $srcRel ) ) {
1500 throw new RuntimeException( __METHOD__ .
':Validation error in $srcRel' );
1501 } elseif ( !$this->validateFilename( $archiveRel ) ) {
1502 throw new RuntimeException( __METHOD__ .
':Validation error in $archiveRel' );
1505 $publicRoot = $this->getZonePath(
'public' );
1506 $srcPath =
"{$publicRoot}/$srcRel";
1508 $deletedRoot = $this->getZonePath(
'deleted' );
1509 $archivePath =
"{$deletedRoot}/{$archiveRel}";
1510 $archiveDir = dirname( $archivePath );
1513 if ( !$this->initDirectory( $archiveDir )->isGood() ) {
1514 return $this->newFatal(
'directorycreateerror', $archiveDir );
1520 'dst' => $archivePath,
1523 'overwriteSame' =>
true
1530 $opts = [
'force' => true ];
1531 return $status->merge( $backend->doOperations( $operations, $opts ) );
1541 $this->assertWritableRepo();
1552 if ( strlen( $key ) < 31 ) {
1553 throw new InvalidArgumentException(
"Invalid storage key '$key'." );
1556 for ( $i = 0; $i < $this->deletedHashLevels; $i++ ) {
1557 $path .= $key[$i] .
'/';
1571 if ( self::isVirtualUrl(
$path ) ) {
1572 return $this->resolveVirtualUrl(
$path );
1586 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1588 return $this->backend->getLocalCopy( [
'src' =>
$path ] );
1600 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1602 return $this->backend->getLocalReference( [
'src' =>
$path ] );
1617 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1619 return $this->backend->addShellboxInputFile( $command, $boxedName, [
'src' =>
$path ] );
1630 $fsFile = $this->getLocalReference( $virtualUrl );
1633 $props = $mwProps->getPropsFromPath( $fsFile->getPath(),
true );
1635 $props = $mwProps->newPlaceholderProps();
1648 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1650 return $this->backend->getFileTimestamp( [
'src' =>
$path ] );
1660 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1662 return $this->backend->getFileSize( [
'src' =>
$path ] );
1672 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1674 return $this->backend->getFileSha1Base36( [
'src' =>
$path ] );
1687 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1688 $params = [
'src' =>
$path,
'headers' => $headers,
'options' => $optHeaders ];
1691 ob_start(
null, 1_048_576 );
1692 ob_implicit_flush(
true );
1694 $status = $this->newGood()->merge( $this->backend->streamFile( $params ) );
1698 if ( ob_get_status() ) {
1714 $this->enumFilesInStorage( $callback );
1725 $publicRoot = $this->getZonePath(
'public' );
1726 $numDirs = 1 << ( $this->hashLevels * 4 );
1729 for ( $flatIndex = 0; $flatIndex < $numDirs; $flatIndex++ ) {
1730 $hexString = sprintf(
"%0{$this->hashLevels}x", $flatIndex );
1731 $path = $publicRoot;
1732 for ( $hexPos = 0; $hexPos < $this->hashLevels; $hexPos++ ) {
1733 $path .=
'/' . substr( $hexString, 0, $hexPos + 1 );
1735 $iterator = $this->backend->getFileList( [
'dir' =>
$path ] );
1736 if ( $iterator ===
null ) {
1737 throw new RuntimeException( __METHOD__ .
': could not get file listing for ' .
$path );
1739 foreach ( $iterator as $name ) {
1741 $callback(
"{$path}/{$name}" );
1753 if ( strval( $filename ) ==
'' ) {
1765 private function getErrorCleanupFunction() {
1766 switch ( $this->pathDisclosureProtection ) {
1769 $callback = $this->passThrough( ... );
1772 $callback = $this->paranoidClean( ... );
1805 $status = Status::newFatal( $message, ...$parameters );
1806 $status->cleanCallback = $this->getErrorCleanupFunction();
1818 $status = Status::newGood( $value );
1819 $status->cleanCallback = $this->getErrorCleanupFunction();
1854 if ( $this->isLocal() ) {
1859 return wfMessageFallback(
'shared-repo-name-' . $this->name,
'shared-repo' )->text();
1870 if ( strlen( $name ) > $this->abbrvThreshold ) {
1872 $name = ( $ext ==
'' ) ?
'thumbnail' :
"thumbnail.$ext";
1884 return $this->getName() ==
'local';
1914 return $this->wanCache->makeKey(
1915 'filerepo-' . $kClassSuffix,
1931 'name' =>
"{$this->name}-temp",
1932 'backend' => $this->backend,
1937 'container' => $this->zones[
'temp'][
'container'],
1938 'directory' => $this->zones[
'temp'][
'directory']
1941 'container' => $this->zones[
'temp'][
'container'],
1942 'directory' => $this->zones[
'temp'][
'directory'] ==
''
1944 : $this->zones[
'temp'][
'directory'] .
'/thumb'
1947 'container' => $this->zones[
'temp'][
'container'],
1948 'directory' => $this->zones[
'temp'][
'directory'] ==
''
1950 : $this->zones[
'temp'][
'directory'] .
'/transcoded'
1953 'hashLevels' => $this->hashLevels,
1975 'name' => $this->getName(),
1976 'displayname' => $this->getDisplayName(),
1977 'rootUrl' => $this->getZoneUrl(
'public' ),
1978 'local' => $this->isLocal(),
1981 $optionalSettings = [
1989 'descriptionCacheExpiry',
1991 foreach ( $optionalSettings as $k ) {
1992 if ( $this->$k !==
null ) {
1993 $ret[$k] = $this->$k;
1996 if ( $this->favicon !==
null ) {
1999 ->expand( $this->favicon );
2010 return $this->hasSha1Storage;
2018 return $this->supportsSha1URLs;
2023class_alias( FileRepo::class,
'FileRepo' );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
wfMessageFallback(... $keys)
This function accepts multiple message keys and returns a message instance for the first message whic...
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
Group all the pieces relevant to the context of a request into one instance.
A class containing constants representing the names of configuration variables.
const Sitename
Name constant for the Sitename setting, for use with Config::get()
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Interface for objects (potentially) representing an editable wiki page.