12use InvalidArgumentException;
29use Shellbox\Command\BoxedCommand;
32use Wikimedia\AtEase\AtEase;
142 protected $fileFactory = [ UnregisteredLocalFile::class,
'newFromTitle' ];
179 || !array_key_exists(
'name', $info )
180 || !array_key_exists(
'backend', $info )
182 throw new InvalidArgumentException( __CLASS__ .
183 " requires an array of options having both 'name' and 'backend' keys.\n" );
187 $this->name = $info[
'name'];
189 $this->backend = $info[
'backend'];
196 $optionalSettings = [
197 'descBaseUrl',
'scriptDirUrl',
'articleUrl',
'fetchDescription',
198 'thumbScriptUrl',
'pathDisclosureProtection',
'descriptionCacheExpiry',
199 'favicon',
'thumbProxyUrl',
'thumbProxySecret',
'disableLocalTransform'
201 foreach ( $optionalSettings as $var ) {
202 if ( isset( $info[$var] ) ) {
203 $this->$var = $info[$var];
210 $this->initialCapital = $info[
'initialCapital'] ?? $localCapitalLinks;
211 if ( $localCapitalLinks && !$this->initialCapital ) {
219 throw new InvalidArgumentException(
220 'File repos with initial capital false are not allowed on wikis where the File ' .
221 'namespace has initial capital true' );
224 $this->url = $info[
'url'] ??
false;
225 $defaultThumbUrl = $this->url ? $this->url .
'/thumb' :
false;
226 $this->thumbUrl = $info[
'thumbUrl'] ?? $defaultThumbUrl;
227 $this->hashLevels = $info[
'hashLevels'] ?? 2;
229 $this->transformVia404 = !empty( $info[
'transformVia404'] );
230 $this->abbrvThreshold = $info[
'abbrvThreshold'] ?? 255;
231 $this->isPrivate = !empty( $info[
'isPrivate'] );
233 $this->zones = $info[
'zones'] ?? [];
234 foreach ( [
'public',
'thumb',
'transcoded',
'temp',
'deleted' ] as $zone ) {
235 if ( !isset( $this->zones[$zone][
'container'] ) ) {
236 $this->zones[$zone][
'container'] =
"{$this->name}-{$zone}";
238 if ( !isset( $this->zones[$zone][
'directory'] ) ) {
239 $this->zones[$zone][
'directory'] =
'';
241 if ( !isset( $this->zones[$zone][
'urlsByExt'] ) ) {
242 $this->zones[$zone][
'urlsByExt'] = [];
248 $this->wanCache = $info[
'wanCache'] ?? WANObjectCache::newEmpty();
267 return $this->backend->getReadOnlyReason();
276 foreach ( (array)$doZones as $zone ) {
278 if ( $root ===
null ) {
279 throw new RuntimeException(
"No '$zone' zone defined in the {$this->name} repo." );
291 return str_starts_with(
$url,
'mwrepo://' );
303 $path =
'mwrepo://' . $this->name;
304 if ( $suffix !==
false ) {
305 $path .=
'/' . rawurlencode( $suffix );
319 if ( in_array( $zone, [
'public',
'thumb',
'transcoded' ] ) ) {
321 if ( $ext !==
null && isset( $this->zones[$zone][
'urlsByExt'][$ext] ) ) {
324 return $this->zones[$zone][
'urlsByExt'][$ext];
325 } elseif ( isset( $this->zones[$zone][
'url'] ) ) {
327 return $this->zones[$zone][
'url'];
337 return $this->thumbUrl;
339 return "{$this->url}/transcoded";
361 if ( !str_starts_with(
$url,
'mwrepo://' ) ) {
362 throw new InvalidArgumentException( __METHOD__ .
': unknown protocol' );
364 $bits = explode(
'/', substr(
$url, 9 ), 3 );
365 if ( count( $bits ) != 3 ) {
366 throw new InvalidArgumentException( __METHOD__ .
": invalid mwrepo URL: $url" );
368 [ $repo, $zone, $rel ] = $bits;
369 if ( $repo !== $this->name ) {
370 throw new InvalidArgumentException( __METHOD__ .
": fetching from a foreign repo is not supported" );
372 $base = $this->getZonePath( $zone );
374 throw new InvalidArgumentException( __METHOD__ .
": invalid zone: $zone" );
377 return $base .
'/' . rawurldecode( $rel );
387 if ( !isset( $this->zones[$zone] ) ) {
388 return [
null, null ];
391 return [ $this->zones[$zone][
'container'], $this->zones[$zone][
'directory'] ];
401 [ $container, $base ] = $this->getZoneLocation( $zone );
402 if ( $container ===
null || $base ===
null ) {
405 $backendName = $this->backend->getName();
410 return "mwstore://$backendName/{$container}{$base}";
424 public function newFile( $title, $time =
false ) {
425 $title = File::normalizeTitle( $title );
430 if ( $this->oldFileFactory ) {
431 return ( $this->oldFileFactory )( $title, $this, $time );
436 return ( $this->fileFactory )( $title, $this );
459 public function findFile( $title, $options = [] ) {
460 if ( !empty( $options[
'private'] ) && !( $options[
'private'] instanceof
Authority ) ) {
461 throw new InvalidArgumentException(
462 __METHOD__ .
' called with the `private` option set to something ' .
463 'other than an Authority object'
467 $title = File::normalizeTitle( $title );
471 if ( isset( $options[
'bypassCache'] ) ) {
472 $options[
'latest'] = $options[
'bypassCache'];
474 $time = $options[
'time'] ??
false;
475 $flags = !empty( $options[
'latest'] ) ? IDBAccessObject::READ_LATEST : 0;
476 # First try the current version of the file to see if it precedes the timestamp
477 $img = $this->newFile( $title );
481 $img->load( $flags );
482 if ( $img->exists() && ( !$time || $img->getTimestamp() == $time ) ) {
485 # Now try an old version of the file
486 if ( $time !==
false ) {
487 $img = $this->newFile( $title, $time );
489 $img->load( $flags );
490 if ( $img->exists() ) {
491 if ( !$img->isDeleted( File::DELETED_FILE ) ) {
495 !empty( $options[
'private'] ) &&
496 $img->userCan( File::DELETED_FILE, $options[
'private'] )
505 if ( !empty( $options[
'ignoreRedirect'] ) ) {
508 $redir = $this->checkRedirect( $title );
509 if ( $redir && $title->getNamespace() ===
NS_FILE ) {
510 $img = $this->newFile( $redir );
514 $img->load( $flags );
515 if ( $img->exists() ) {
516 $img->redirectedFrom( $title->getDBkey() );
544 foreach ( $items as $item ) {
545 if ( is_array( $item ) ) {
546 $title = $item[
'title'];
548 unset( $options[
'title'] );
551 !empty( $options[
'private'] ) &&
552 !( $options[
'private'] instanceof
Authority )
554 $options[
'private'] = RequestContext::getMain()->getAuthority();
560 $file = $this->findFile( $title, $options );
562 $searchName = File::normalizeTitle( $title )->getDBkey();
563 if ( $flags & self::NAME_AND_TIME_ONLY ) {
564 $result[$searchName] = [
565 'title' => $file->getTitle()->getDBkey(),
566 'timestamp' => $file->getTimestamp()
569 $result[$searchName] = $file;
588 if ( !empty( $options[
'private'] ) && !( $options[
'private'] instanceof
Authority ) ) {
589 throw new InvalidArgumentException(
590 __METHOD__ .
' called with the `private` option set to something ' .
591 'other than an Authority object'
595 $time = $options[
'time'] ??
false;
596 # First try to find a matching current version of a file...
597 if ( !$this->fileFactoryKey ) {
600 $img = ( $this->fileFactoryKey )( $sha1, $this, $time );
601 if ( $img && $img->exists() ) {
604 # Now try to find a matching old version of a file...
605 if ( $time !==
false && $this->oldFileFactoryKey ) {
606 $img = ( $this->oldFileFactoryKey )( $sha1, $this, $time );
607 if ( $img && $img->exists() ) {
608 if ( !$img->isDeleted( File::DELETED_FILE ) ) {
612 !empty( $options[
'private'] ) &&
613 $img->userCan( File::DELETED_FILE, $options[
'private'] )
644 foreach ( $hashes as $hash ) {
645 $files = $this->findBySha1( $hash );
646 if ( count( $files ) ) {
647 $result[$hash] = $files;
672 return $this->thumbScriptUrl;
681 return $this->thumbProxyUrl;
690 return $this->thumbProxySecret;
699 return $this->transformVia404;
709 return !$this->disableLocalTransform;
720 $this->initialCapital !=
723 $name = $title->getDBkey();
724 if ( $this->initialCapital ) {
728 $name = $title->getDBkey();
740 return $this->getZonePath(
'public' );
751 return self::getHashPathForLevel( $name, $this->hashLevels );
762 $parts = explode(
'!', $suffix, 2 );
763 $name = $parts[1] ?? $suffix;
764 return self::getHashPathForLevel( $name, $this->hashLevels );
773 if ( $levels == 0 ) {
776 $hash = md5( $name );
778 for ( $i = 1; $i <= $levels; $i++ ) {
779 $path .= substr( $hash, 0, $i ) .
'/';
792 return $this->hashLevels;
811 public function makeUrl( $query =
'', $entry =
'index' ) {
812 if ( $this->scriptDirUrl !==
null ) {
813 return wfAppendQuery(
"{$this->scriptDirUrl}/{$entry}.php", $query );
833 if ( $this->descBaseUrl !==
null ) {
834 # "http://example.com/wiki/File:"
835 return $this->descBaseUrl . $encName;
837 if ( $this->articleUrl !==
null ) {
838 # "http://example.com/wiki/$1"
839 # We use "Image:" as the canonical namespace for
840 # compatibility across all MediaWiki versions.
841 return str_replace(
'$1',
842 "Image:$encName", $this->articleUrl );
844 if ( $this->scriptDirUrl !==
null ) {
845 # "http://example.com/w"
846 # We use "Image:" as the canonical namespace for
847 # compatibility across all MediaWiki versions,
848 # and just sort of hope index.php is right. ;)
849 return $this->makeUrl(
"title=Image:$encName" );
866 $query =
'action=render';
867 if ( $lang !==
null ) {
868 $query .=
'&uselang=' . urlencode( $lang );
870 if ( $this->scriptDirUrl !==
null ) {
871 return $this->makeUrl(
876 $descUrl = $this->getDescriptionUrl( $name );
891 if ( $this->scriptDirUrl !==
null ) {
894 return $this->makeUrl(
'title=MediaWiki:Filepage.css&action=raw&ctype=text/css' );
917 public function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
918 $this->assertWritableRepo();
920 $status = $this->storeBatch( [ [ $srcPath, $dstZone, $dstRel ] ], $flags );
921 if ( $status->successCount == 0 ) {
922 $status->setOK(
false );
942 $this->assertWritableRepo();
944 if ( $flags & self::DELETE_SOURCE ) {
945 throw new InvalidArgumentException(
"DELETE_SOURCE not supported in " . __METHOD__ );
948 $status = $this->newGood();
949 $backend = $this->backend;
953 foreach ( $triplets as [ $src, $dstZone, $dstRel ] ) {
954 $srcPath = ( $src instanceof
FSFile ) ? $src->getPath() : $src;
956 .
"( \$src='$srcPath', \$dstZone='$dstZone', \$dstRel='$dstRel' )"
959 if ( $src instanceof
FSFile ) {
962 $src = $this->resolveToStoragePathIfVirtual( $src );
966 $root = $this->getZonePath( $dstZone );
968 throw new RuntimeException(
"Invalid zone: $dstZone" );
970 if ( !$this->validateFilename( $dstRel ) ) {
971 throw new RuntimeException(
'Validation error in $dstRel' );
973 $dstPath =
"$root/$dstRel";
974 $dstDir = dirname( $dstPath );
976 if ( !$this->initDirectory( $dstDir )->isOK() ) {
977 return $this->newFatal(
'directorycreateerror', $dstDir );
985 'overwrite' => (bool)( $flags & self::OVERWRITE ),
986 'overwriteSame' => (bool)( $flags & self::OVERWRITE_SAME ),
991 $opts = [
'force' => true ];
992 if ( $flags & self::SKIP_LOCKING ) {
993 $opts[
'nonLocking'] =
true;
996 return $status->merge( $backend->doOperations( $operations, $opts ) );
1010 $this->assertWritableRepo();
1012 $status = $this->newGood();
1015 foreach ( $files as
$path ) {
1016 if ( is_array(
$path ) ) {
1018 [ $zone, $rel ] =
$path;
1019 $path = $this->getZonePath( $zone ) .
"/$rel";
1022 $path = $this->resolveToStoragePathIfVirtual(
$path );
1024 $operations[] = [
'op' =>
'delete',
'src' =>
$path ];
1027 $opts = [
'force' => true ];
1028 if ( $flags & self::SKIP_LOCKING ) {
1029 $opts[
'nonLocking'] =
true;
1032 return $status->merge( $this->backend->doOperations( $operations, $opts ) );
1053 return $this->quickImportBatch( [ [ $src, $dst, $options ] ] );
1071 $status = $this->newGood();
1073 foreach ( $triples as $triple ) {
1074 [ $src, $dst ] = $triple;
1075 if ( $src instanceof
FSFile ) {
1078 $src = $this->resolveToStoragePathIfVirtual( $src );
1081 $dst = $this->resolveToStoragePathIfVirtual( $dst );
1083 if ( !isset( $triple[2] ) ) {
1085 } elseif ( is_string( $triple[2] ) ) {
1087 $headers = [
'Content-Disposition' => $triple[2] ];
1088 } elseif ( is_array( $triple[2] ) && isset( $triple[2][
'headers'] ) ) {
1089 $headers = $triple[2][
'headers'];
1098 'headers' => $headers
1100 $status->merge( $this->initDirectory( dirname( $dst ) ) );
1103 return $status->merge( $this->backend->doQuickOperations( $operations ) );
1115 return $this->quickPurgeBatch( [
$path ] );
1126 return $this->newGood()->merge(
1127 $this->backend->clean(
1128 [
'dir' => $this->resolveToStoragePathIfVirtual( $dir ) ]
1142 $status = $this->newGood();
1144 foreach ( $paths as
$path ) {
1147 'src' => $this->resolveToStoragePathIfVirtual(
$path ),
1148 'ignoreMissingSource' => true
1151 $status->merge( $this->backend->doQuickOperations( $operations ) );
1167 $this->assertWritableRepo();
1169 $date = MWTimestamp::getInstance()->format(
'YmdHis' );
1170 $hashPath = $this->getHashPath( $originalName );
1171 $dstUrlRel = $hashPath . $date .
'!' . rawurlencode( $originalName );
1172 $virtualUrl = $this->getVirtualUrl(
'temp' ) .
'/' . $dstUrlRel;
1174 $result = $this->quickImport( $srcPath, $virtualUrl );
1175 $result->value = $virtualUrl;
1187 $this->assertWritableRepo();
1189 $temp = $this->getVirtualUrl(
'temp' );
1190 if ( !str_starts_with( $virtualUrl, $temp ) ) {
1191 wfDebug( __METHOD__ .
": Invalid temp virtual URL" );
1196 return $this->quickPurge( $virtualUrl )->isOK();
1208 public function concatenate( array $srcPaths, $dstPath, $flags = 0 ) {
1209 $this->assertWritableRepo();
1211 $status = $this->newGood();
1214 foreach ( $srcPaths as $srcPath ) {
1216 $source = $this->resolveToStoragePathIfVirtual( $srcPath );
1221 $params = [
'srcs' => $sources,
'dst' => $dstPath ];
1222 $status->merge( $this->backend->concatenate( $params ) );
1223 if ( !$status->isOK() ) {
1228 if ( $flags & self::DELETE_SOURCE ) {
1229 $status->merge( $this->quickPurgeBatch( $srcPaths ) );
1233 $status->setResult(
true );
1262 $src, $dstRel, $archiveRel, $flags = 0, array $options = []
1264 $this->assertWritableRepo();
1266 $status = $this->publishBatch(
1267 [ [ $src, $dstRel, $archiveRel, $options ] ], $flags );
1268 if ( $status->successCount == 0 ) {
1269 $status->setOK(
false );
1271 $status->value = $status->value[0] ??
false;
1288 $this->assertWritableRepo();
1290 $backend = $this->backend;
1292 $this->initZones(
'public' );
1294 $status = $this->newGood( [] );
1297 $sourceFSFilesToDelete = [];
1299 foreach ( $ntuples as $ntuple ) {
1300 [ $src, $dstRel, $archiveRel ] = $ntuple;
1301 $srcPath = ( $src instanceof
FSFile ) ? $src->getPath() : $src;
1303 $options = $ntuple[3] ?? [];
1305 $srcPath = $this->resolveToStoragePathIfVirtual( $srcPath );
1306 if ( !$this->validateFilename( $dstRel ) ) {
1307 throw new RuntimeException(
'Validation error in $dstRel' );
1309 if ( !$this->validateFilename( $archiveRel ) ) {
1310 throw new RuntimeException(
'Validation error in $archiveRel' );
1313 $publicRoot = $this->getZonePath(
'public' );
1314 $dstPath =
"$publicRoot/$dstRel";
1315 $archivePath =
"$publicRoot/$archiveRel";
1317 $dstDir = dirname( $dstPath );
1318 $archiveDir = dirname( $archivePath );
1320 if ( !$this->initDirectory( $dstDir )->isOK() ) {
1321 return $this->newFatal(
'directorycreateerror', $dstDir );
1323 if ( !$this->initDirectory( $archiveDir )->isOK() ) {
1324 return $this->newFatal(
'directorycreateerror', $archiveDir );
1328 $headers = $options[
'headers'] ?? [];
1339 'dst' => $archivePath,
1340 'ignoreMissingSource' => true
1346 'op' => ( $flags & self::DELETE_SOURCE ) ?
'move' :
'copy',
1349 'overwrite' =>
true,
1350 'headers' => $headers
1357 'overwrite' =>
true,
1358 'headers' => $headers
1360 if ( $flags & self::DELETE_SOURCE ) {
1361 $sourceFSFilesToDelete[] = $srcPath;
1367 $status->merge( $backend->doOperations( $operations ) );
1369 foreach ( $ntuples as $i => $ntuple ) {
1370 [ , , $archiveRel ] = $ntuple;
1371 $archivePath = $this->getZonePath(
'public' ) .
"/$archiveRel";
1372 if ( $this->fileExists( $archivePath ) ) {
1373 $status->value[$i] =
'archived';
1375 $status->value[$i] =
'new';
1379 foreach ( $sourceFSFilesToDelete as $file ) {
1380 AtEase::suppressWarnings();
1382 AtEase::restoreWarnings();
1396 $path = $this->resolveToStoragePathIfVirtual( $dir );
1399 $params = [
'dir' =>
$path ];
1400 if ( $this->isPrivate
1401 || $container === $this->zones[
'deleted'][
'container']
1402 || $container === $this->zones[
'temp'][
'container']
1404 # Take all available measures to prevent web accessibility of new deleted
1405 # directories, in case the user has not configured offline storage
1406 $params = [
'noAccess' =>
true,
'noListing' => true ] + $params;
1409 return $this->newGood()->merge( $this->backend->prepare( $params ) );
1419 $this->assertWritableRepo();
1421 return $this->newGood()->merge(
1422 $this->backend->clean(
1423 [
'dir' => $this->resolveToStoragePathIfVirtual( $dir ) ]
1435 $result = $this->fileExistsBatch( [ $file ] );
1448 $paths = array_map( $this->resolveToStoragePathIfVirtual( ... ), $files );
1449 $this->backend->preloadFileStat( [
'srcs' => $paths ] );
1452 foreach ( $paths as $key =>
$path ) {
1453 $result[$key] = $this->backend->fileExists( [
'src' =>
$path ] );
1469 public function delete( $srcRel, $archiveRel ) {
1470 $this->assertWritableRepo();
1472 return $this->deleteBatch( [ [ $srcRel, $archiveRel ] ] );
1492 $this->assertWritableRepo();
1495 $this->initZones( [
'public',
'deleted' ] );
1497 $status = $this->newGood();
1499 $backend = $this->backend;
1502 foreach ( $sourceDestPairs as [ $srcRel, $archiveRel ] ) {
1503 if ( !$this->validateFilename( $srcRel ) ) {
1504 throw new RuntimeException( __METHOD__ .
':Validation error in $srcRel' );
1505 } elseif ( !$this->validateFilename( $archiveRel ) ) {
1506 throw new RuntimeException( __METHOD__ .
':Validation error in $archiveRel' );
1509 $publicRoot = $this->getZonePath(
'public' );
1510 $srcPath =
"{$publicRoot}/$srcRel";
1512 $deletedRoot = $this->getZonePath(
'deleted' );
1513 $archivePath =
"{$deletedRoot}/{$archiveRel}";
1514 $archiveDir = dirname( $archivePath );
1517 if ( !$this->initDirectory( $archiveDir )->isGood() ) {
1518 return $this->newFatal(
'directorycreateerror', $archiveDir );
1524 'dst' => $archivePath,
1527 'overwriteSame' =>
true
1534 $opts = [
'force' => true ];
1535 return $status->merge( $backend->doOperations( $operations, $opts ) );
1545 $this->assertWritableRepo();
1556 if ( strlen( $key ) < 31 ) {
1557 throw new InvalidArgumentException(
"Invalid storage key '$key'." );
1560 for ( $i = 0; $i < $this->deletedHashLevels; $i++ ) {
1561 $path .= $key[$i] .
'/';
1575 if ( self::isVirtualUrl(
$path ) ) {
1576 return $this->resolveVirtualUrl(
$path );
1590 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1592 return $this->backend->getLocalCopy( [
'src' =>
$path ] );
1604 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1606 return $this->backend->getLocalReference( [
'src' =>
$path ] );
1621 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1623 return $this->backend->addShellboxInputFile( $command, $boxedName, [
'src' =>
$path ] );
1634 $fsFile = $this->getLocalReference( $virtualUrl );
1637 $props = $mwProps->getPropsFromPath( $fsFile->getPath(),
true );
1639 $props = $mwProps->newPlaceholderProps();
1652 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1654 return $this->backend->getFileTimestamp( [
'src' =>
$path ] );
1664 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1666 return $this->backend->getFileSize( [
'src' =>
$path ] );
1676 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1678 return $this->backend->getFileSha1Base36( [
'src' =>
$path ] );
1691 $path = $this->resolveToStoragePathIfVirtual( $virtualUrl );
1692 $params = [
'src' =>
$path,
'headers' => $headers,
'options' => $optHeaders ];
1695 ob_start(
null, 1_048_576 );
1696 ob_implicit_flush(
true );
1698 $status = $this->newGood()->merge( $this->backend->streamFile( $params ) );
1702 if ( ob_get_status() ) {
1718 $this->enumFilesInStorage( $callback );
1729 $publicRoot = $this->getZonePath(
'public' );
1730 $numDirs = 1 << ( $this->hashLevels * 4 );
1733 for ( $flatIndex = 0; $flatIndex < $numDirs; $flatIndex++ ) {
1734 $hexString = sprintf(
"%0{$this->hashLevels}x", $flatIndex );
1735 $path = $publicRoot;
1736 for ( $hexPos = 0; $hexPos < $this->hashLevels; $hexPos++ ) {
1737 $path .=
'/' . substr( $hexString, 0, $hexPos + 1 );
1739 $iterator = $this->backend->getFileList( [
'dir' =>
$path ] );
1740 if ( $iterator ===
null ) {
1741 throw new RuntimeException( __METHOD__ .
': could not get file listing for ' .
$path );
1743 foreach ( $iterator as $name ) {
1745 $callback(
"{$path}/{$name}" );
1757 if ( strval( $filename ) ==
'' ) {
1769 private function getErrorCleanupFunction() {
1770 switch ( $this->pathDisclosureProtection ) {
1773 $callback = $this->passThrough( ... );
1776 $callback = $this->paranoidClean( ... );
1809 $status = Status::newFatal( $message, ...$parameters );
1810 $status->cleanCallback = $this->getErrorCleanupFunction();
1822 $status = Status::newGood( $value );
1823 $status->cleanCallback = $this->getErrorCleanupFunction();
1858 if ( $this->isLocal() ) {
1863 return wfMessageFallback(
'shared-repo-name-' . $this->name,
'shared-repo' )->text();
1874 if ( strlen( $name ) > $this->abbrvThreshold ) {
1876 $name = ( $ext ==
'' ) ?
'thumbnail' :
"thumbnail.$ext";
1888 return $this->getName() ==
'local';
1918 return $this->wanCache->makeKey(
1919 'filerepo-' . $kClassSuffix,
1935 'name' =>
"{$this->name}-temp",
1936 'backend' => $this->backend,
1941 'container' => $this->zones[
'temp'][
'container'],
1942 'directory' => $this->zones[
'temp'][
'directory']
1945 'container' => $this->zones[
'temp'][
'container'],
1946 'directory' => $this->zones[
'temp'][
'directory'] ==
''
1948 : $this->zones[
'temp'][
'directory'] .
'/thumb'
1951 'container' => $this->zones[
'temp'][
'container'],
1952 'directory' => $this->zones[
'temp'][
'directory'] ==
''
1954 : $this->zones[
'temp'][
'directory'] .
'/transcoded'
1957 'hashLevels' => $this->hashLevels,
1989 'name' => $this->getName(),
1990 'displayname' => $this->getDisplayName(),
1991 'rootUrl' => $this->getZoneUrl(
'public' ),
1992 'local' => $this->isLocal(),
1995 $optionalSettings = [
2003 'descriptionCacheExpiry',
2005 foreach ( $optionalSettings as $k ) {
2006 if ( $this->$k !==
null ) {
2007 $ret[$k] = $this->$k;
2010 if ( $this->favicon !==
null ) {
2013 ->expand( $this->favicon );
2024 return $this->hasSha1Storage;
2032 return $this->supportsSha1URLs;
2037class_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...
MimeMagic helper wrapper.
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.
UploadStash is intended to accomplish a few things:
Interface for objects (potentially) representing an editable wiki page.