MediaWiki master
MediaWiki\FileRepo\FileRepo Class Reference

Base class for file repositories. More...

Inherited by MediaWiki\FileRepo\ForeignAPIRepo, MediaWiki\FileRepo\LocalRepo, MediaWiki\FileRepo\NullRepo, and MediaWiki\FileRepo\TempFileRepo.

Collaboration diagram for MediaWiki\FileRepo\FileRepo:

Public Member Functions

 __construct (?array $info=null)
 
 addShellboxInputFile (BoxedCommand $command, string $boxedName, string $virtualUrl)
 Add a file to a Shellbox command as an input file.
 
 backendSupportsUnicodePaths ()
 
 canTransformLocally ()
 Returns true if the repository can transform files locally.
 
 canTransformVia404 ()
 Returns true if the repository can transform files via a 404 handler.
 
 checkRedirect ( $title)
 Checks if there is a redirect named as $title.
 
 cleanDir ( $dir)
 Deletes a directory if empty.
 
 cleanupBatch (array $files, $flags=0)
 Deletes a batch of files.
 
 cleanupDeletedBatch (array $storageKeys)
 Delete files in the deleted directory if they are not referenced in the filearchive table.
 
 concatenate (array $srcPaths, $dstPath, $flags=0)
 Concatenate a list of temporary files into a target file location.
 
 delete ( $srcRel, $archiveRel)
 Move a file to the deletion archive.
 
 deleteBatch (array $sourceDestPairs)
 Move a group of files to the deletion archive.
 
 enumFiles ( $callback)
 Call a callback function for every public regular file in the repository.
 
 fileExists ( $file)
 Checks existence of a file.
 
 fileExistsBatch (array $files)
 Checks existence of an array of files.
 
 findBySha1 ( $hash)
 Get an array or iterator of file objects for files that have a given SHA-1 content hash.
 
 findBySha1s (array $hashes)
 Get an array of arrays or iterators of file objects for files that have the given SHA-1 content hashes.
 
 findFile ( $title, $options=[])
 Find an instance of the named file created at the specified time Returns false if the file does not exist.
 
 findFileFromKey ( $sha1, $options=[])
 Find an instance of the file with this key, created at the specified time Returns false if the file does not exist.
 
 findFiles (array $items, $flags=0)
 Find many files at once.
 
 findFilesByPrefix ( $prefix, $limit)
 Return an array of files where the name starts with $prefix.
 
 freeTemp ( $virtualUrl)
 Remove a temporary file or mark it for garbage collection.
 
 getBackend ()
 Get the file backend instance.
 
 getDeletedHashPath ( $key)
 Get a relative path for a deletion archive key, e.g.
 
 getDescriptionRenderUrl ( $name, $lang=null)
 Get the URL of the content-only fragment of the description page.
 
 getDescriptionStylesheetUrl ()
 Get the URL of the stylesheet to apply to description pages.
 
 getDescriptionUrl ( $name)
 Get the URL of an image description page.
 
 getDisplayName ()
 Get the human-readable name of the repo.
 
 getFileProps ( $virtualUrl)
 Get properties of a file with a given virtual URL/storage path.
 
 getFileSha1 ( $virtualUrl)
 Get the sha1 (base 36) of a file with a given virtual URL/storage path.
 
 getFileSize ( $virtualUrl)
 Get the size of a file with a given virtual URL/storage path.
 
 getFileTimestamp ( $virtualUrl)
 Get the timestamp of a file with a given virtual URL/storage path.
 
 getHashLevels ()
 Get the number of hash directory levels.
 
 getHashPath ( $name)
 Get a relative path including trailing slash, e.g.
 
 getInfo ()
 Return information about the repository.
 
 getLocalCacheKey ( $kClassSuffix,... $components)
 Get a site-local, repository-qualified, WAN cache key.
 
 getLocalCopy ( $virtualUrl)
 Get a local FS copy of a file with a given virtual URL/storage path.
 
 getLocalReference ( $virtualUrl)
 Get a local FS file with a given virtual URL/storage path.
 
 getName ()
 Get the name of this repository, as specified by $info['name]' to the constructor.
 
 getNameFromTitle ( $title)
 Get the name of a file from its title.
 
 getReadOnlyReason ()
 Get an explanatory message if this repo is read-only.
 
 getRootDirectory ()
 Get the public zone root storage directory of the repository.
 
 getSharedCacheKey ( $kClassSuffix,... $components)
 Get a global, repository-qualified, WAN cache key.
 
 getTempHashPath ( $suffix)
 Get a relative path including trailing slash, e.g.
 
 getTempRepo ()
 Get a temporary private FileRepo associated with this repo.
 
 getThumbProxySecret ()
 Get the secret key for the proxied thumb service.
 
 getThumbProxyUrl ()
 Get the URL thumb.php requests are being proxied to.
 
 getThumbScriptUrl ()
 Get the URL of thumb.php.
 
 getUploadStash (?UserIdentity $user=null)
 Get an UploadStash associated with this repo.
 
 getVirtualUrl ( $suffix=false)
 Get a URL referring to this repository, with the private mwrepo protocol.
 
 getZonePath ( $zone)
 Get the storage path corresponding to one of the zones.
 
 getZoneUrl ( $zone, $ext=null)
 Get the URL corresponding to one of the four basic zones.
 
 hasSha1Storage ()
 Returns whether or not storage is SHA-1 based.
 
 invalidateImageRedirect ( $title)
 Invalidates image redirect cache related to that image Doesn't do anything for repositories that don't support image redirects.
 
 isLocal ()
 Returns true if this the local file repository.
 
 makeUrl ( $query='', $entry='index')
 Make an url to this repo.
 
 nameForThumb ( $name)
 Get the portion of the file that contains the origin file name.
 
 newFatal ( $message,... $parameters)
 Create a new fatal error.
 
 newFile ( $title, $time=false)
 Create a new File object from the local repository.
 
 newGood ( $value=null)
 Create a new good result.
 
 paranoidClean ( $param)
 Path disclosure protection function.
 
 passThrough ( $param)
 Path disclosure protection function.
 
 publish ( $src, $dstRel, $archiveRel, $flags=0, array $options=[])
 Copy or move a file either from a storage path, virtual URL, or file system path, into this repository at the specified destination location.
 
 publishBatch (array $ntuples, $flags=0)
 Publish a batch of files.
 
 quickCleanDir ( $dir)
 Deletes a directory if empty.
 
 quickImport ( $src, $dst, $options=null)
 Import a file from the local file system into the repo.
 
 quickImportBatch (array $triples)
 Import a batch of files from the local file system into the repo.
 
 quickPurge ( $path)
 Purge a file from the repo.
 
 quickPurgeBatch (array $paths)
 Purge a batch of files from the repo.
 
 resolveVirtualUrl ( $url)
 Get the backend storage path corresponding to a virtual URL.
 
 store ( $srcPath, $dstZone, $dstRel, $flags=0)
 Store a file to a given destination.
 
 storeBatch (array $triplets, $flags=0)
 Store a batch of files.
 
 storeTemp ( $originalName, $srcPath)
 Pick a random name in the temp zone and store a file to it.
 
 streamFileWithStatus ( $virtualUrl, $headers=[], $optHeaders=[])
 Attempt to stream a file with the given virtual URL/storage path.
 
 supportsSha1URLs ()
 Returns whether or not repo supports having originals SHA-1s in the thumb URLs.
 
 validateFilename ( $filename)
 Determine if a relative path is valid, i.e.
 

Static Public Member Functions

static isVirtualUrl ( $url)
 Determine if a string is an mwrepo:// URL.
 

Public Attributes

int $descriptionCacheExpiry
 
bool $fetchDescription
 Whether to fetch commons image description pages and display them on the local wiki.
 
string $name
 
const DELETE_SOURCE = 1
 
const NAME_AND_TIME_ONLY = 1
 
const OVERWRITE = 2
 
const OVERWRITE_SAME = 4
 
const SKIP_LOCKING = 8
 

Protected Member Functions

 assertWritableRepo ()
 Throw an exception if this repo is read-only by design.
 
 enumFilesInStorage ( $callback)
 Call a callback function for every public file in the repository.
 
 getZoneLocation ( $zone)
 The storage container and base path of a zone.
 
 initDirectory ( $dir)
 Creates a directory with the appropriate zone permissions.
 
 initZones ( $doZones=[])
 Ensure that a single zone or list of zones is defined for usage.
 
 resolveToStoragePathIfVirtual ( $path)
 If a path is a virtual URL, resolve it to a storage path.
 

Static Protected Member Functions

static getHashPathForLevel ( $name, $levels)
 

Protected Attributes

int $abbrvThreshold
 File names over this size will use the short form of thumbnail names.
 
string null $articleUrl
 Equivalent to $wgArticlePath, e.g.
 
FileBackend $backend
 
int $deletedHashLevels
 The number of directory levels for hash-based division of deleted files.
 
string null $descBaseUrl
 URL of image description pages, e.g.
 
bool $disableLocalTransform = false
 Disable local image scaling.
 
null string $favicon = null
 The URL to a favicon (optional, may be a server-local path URL).
 
callable $fileFactory = [ UnregisteredLocalFile::class, 'newFromTitle' ]
 Override these in the base class.
 
callable false $fileFactoryKey = false
 Override these in the base class.
 
int $hashLevels
 The number of directory levels for hash-based division of files.
 
bool $hasSha1Storage = false
 
bool $initialCapital
 Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE], determines whether filenames implicitly start with a capital letter.
 
bool $isPrivate
 Whether all zones should be private (e.g.
 
callable false $oldFileFactory = false
 Override these in the base class.
 
callable false $oldFileFactoryKey = false
 Override these in the base class.
 
string $pathDisclosureProtection = 'simple'
 May be 'paranoid' to remove all parameters from error messages, 'none' to leave the paths in unchanged, or 'simple' to replace paths with placeholders.
 
string null $scriptDirUrl
 URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g.
 
bool $supportsSha1URLs = false
 
string $thumbProxySecret
 Secret key to pass as an X-Swift-Secret header to the proxied thumb service.
 
string $thumbProxyUrl
 URL of where to proxy thumb.php requests to.
 
string $thumbScriptUrl
 URL of thumb.php.
 
string false $thumbUrl
 The base thumbnail URL.
 
bool $transformVia404
 Whether to skip media file transformation on parse and rely on a 404 handler instead.
 
string false $url
 Public zone URL.
 
WANObjectCache $wanCache
 
array $zones = []
 Map of zones to config.
 

Detailed Description

Base class for file repositories.

See the architecture doc for more information.

Definition at line 68 of file FileRepo.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\FileRepo\FileRepo::__construct ( ?array $info = null)
See also
Documentation of info options at $wgLocalFileRepo
Parameters
array | null$info

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 189 of file FileRepo.php.

References MediaWiki\FileRepo\FileRepo\$hashLevels, MediaWiki\MediaWikiServices\getInstance(), NS_FILE, and MediaWiki\FileRepo\FileRepo\supportsSha1URLs().

Member Function Documentation

◆ addShellboxInputFile()

MediaWiki\FileRepo\FileRepo::addShellboxInputFile ( BoxedCommand $command,
string $boxedName,
string $virtualUrl )

Add a file to a Shellbox command as an input file.

Parameters
BoxedCommand$command
string$boxedName
string$virtualUrl
Returns
StatusValue
Since
1.43

Definition at line 1632 of file FileRepo.php.

References $path.

◆ assertWritableRepo()

MediaWiki\FileRepo\FileRepo::assertWritableRepo ( )
protected

Throw an exception if this repo is read-only by design.

This does not and should not check getReadOnlyReason().

Exceptions
LogicException

Reimplemented in MediaWiki\FileRepo\ForeignAPIRepo, MediaWiki\FileRepo\ForeignDBRepo, MediaWiki\FileRepo\ForeignDBViaLBRepo, and MediaWiki\FileRepo\NullRepo.

Definition at line 1992 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\LocalRepo\skipWriteOperationIfSha1().

◆ backendSupportsUnicodePaths()

MediaWiki\FileRepo\FileRepo::backendSupportsUnicodePaths ( )
Returns
bool Whether non-ASCII path characters are allowed

Definition at line 362 of file FileRepo.php.

References Wikimedia\FileBackend\FileBackend\ATTR_UNICODE_PATHS.

◆ canTransformLocally()

MediaWiki\FileRepo\FileRepo::canTransformLocally ( )

Returns true if the repository can transform files locally.

Since
1.36
Returns
bool

Definition at line 722 of file FileRepo.php.

◆ canTransformVia404()

MediaWiki\FileRepo\FileRepo::canTransformVia404 ( )

Returns true if the repository can transform files via a 404 handler.

Returns
bool

Definition at line 712 of file FileRepo.php.

◆ checkRedirect()

MediaWiki\FileRepo\FileRepo::checkRedirect ( $title)

Checks if there is a redirect named as $title.

If there is, return the title object. If not, return false. STUB

Parameters
PageIdentity | LinkTarget$titleTitle of image
Returns
Title|false

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1850 of file FileRepo.php.

◆ cleanDir()

MediaWiki\FileRepo\FileRepo::cleanDir ( $dir)

Deletes a directory if empty.

Parameters
string$dirVirtual URL (or storage path) of directory to clean
Returns
Status

Definition at line 1432 of file FileRepo.php.

◆ cleanupBatch()

MediaWiki\FileRepo\FileRepo::cleanupBatch ( array $files,
$flags = 0 )

Deletes a batch of files.

Each file can be a (zone, rel) pair, virtual url, storage path. It will try to delete each file, but ignores any errors that may occur.

Parameters
string[]$filesList of files to delete
int$flagsBitwise combination of the following flags: self::SKIP_LOCKING Skip any file locking when doing the deletions
Returns
Status

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1023 of file FileRepo.php.

References $path.

◆ cleanupDeletedBatch()

MediaWiki\FileRepo\FileRepo::cleanupDeletedBatch ( array $storageKeys)

Delete files in the deleted directory if they are not referenced in the filearchive table.

STUB

Parameters
string[]$storageKeys

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1558 of file FileRepo.php.

◆ concatenate()

MediaWiki\FileRepo\FileRepo::concatenate ( array $srcPaths,
$dstPath,
$flags = 0 )

Concatenate a list of temporary files into a target file location.

Parameters
string[]$srcPathsOrdered list of source virtual URLs/storage paths
string$dstPathTarget file system path
int$flagsBitwise combination of the following flags: self::DELETE_SOURCE Delete the source files on success
Returns
Status

Definition at line 1222 of file FileRepo.php.

References $source.

◆ delete()

MediaWiki\FileRepo\FileRepo::delete ( $srcRel,
$archiveRel )

Move a file to the deletion archive.

If no valid deletion archive exists, this may either delete the file or throw an exception, depending on the preference of the repository

Parameters
mixed$srcRelRelative path for the file to be deleted
mixed$archiveRelRelative path for the archive location. Relative to a private archive directory.
Returns
Status

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1483 of file FileRepo.php.

◆ deleteBatch()

MediaWiki\FileRepo\FileRepo::deleteBatch ( array $sourceDestPairs)

Move a group of files to the deletion archive.

If no valid deletion archive is configured, this may either delete the file or throw an exception, depending on the preference of the repository.

The overwrite policy is determined by the repository – currently LocalRepo assumes a naming scheme in the deleted zone based on content hash, as opposed to the public zone which is assumed to be unique.

Parameters
array$sourceDestPairsArray of source/destination pairs. Each element is a two-element array containing the source file path relative to the public root in the first element, and the archive file path relative to the deleted zone root in the second element.
Returns
Status

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1505 of file FileRepo.php.

◆ enumFiles()

MediaWiki\FileRepo\FileRepo::enumFiles ( $callback)

Call a callback function for every public regular file in the repository.

This only acts on the current version of files, not any old versions. May use either the database or the filesystem.

Parameters
callable$callback
Returns
void

Reimplemented in MediaWiki\FileRepo\ForeignAPIRepo.

Definition at line 1731 of file FileRepo.php.

◆ enumFilesInStorage()

MediaWiki\FileRepo\FileRepo::enumFilesInStorage ( $callback)
protected

Call a callback function for every public file in the repository.

May use either the database or the filesystem.

Parameters
callable$callback
Returns
void

Definition at line 1742 of file FileRepo.php.

References $path.

◆ fileExists()

MediaWiki\FileRepo\FileRepo::fileExists ( $file)

Checks existence of a file.

Parameters
string$fileVirtual URL (or storage path) of file to check
Returns
bool|null Whether the file exists, or null in case of I/O errors

Definition at line 1448 of file FileRepo.php.

Referenced by UploadStashFile\__construct(), and PurgeChangedFiles\purgeFromArchiveTable().

◆ fileExistsBatch()

MediaWiki\FileRepo\FileRepo::fileExistsBatch ( array $files)

Checks existence of an array of files.

Parameters
string[]$filesVirtual URLs (or storage paths) of files to check
Returns
array<string|int,bool|null> Map of files and either bool indicating whether the files exist, or null in case of I/O errors

Reimplemented in MediaWiki\FileRepo\ForeignAPIRepo.

Definition at line 1461 of file FileRepo.php.

References $path.

◆ findBySha1()

MediaWiki\FileRepo\FileRepo::findBySha1 ( $hash)

Get an array or iterator of file objects for files that have a given SHA-1 content hash.

STUB

Parameters
string$hashSHA-1 hash
Returns
File[]

Reimplemented in MediaWiki\FileRepo\ForeignAPIRepo, and MediaWiki\FileRepo\LocalRepo.

Definition at line 645 of file FileRepo.php.

◆ findBySha1s()

MediaWiki\FileRepo\FileRepo::findBySha1s ( array $hashes)

Get an array of arrays or iterators of file objects for files that have the given SHA-1 content hashes.

Parameters
string[]$hashesAn array of hashes
Returns
File[][] An Array of arrays or iterators of file objects and the hash as key

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 656 of file FileRepo.php.

◆ findFile()

MediaWiki\FileRepo\FileRepo::findFile ( $title,
$options = [] )

Find an instance of the named file created at the specified time Returns false if the file does not exist.

Repositories not supporting version control should return false if the time is specified.

Parameters
PageIdentity | LinkTarget | string$title
array$optionsAssociative array of options: time: requested time for a specific file version, or false for the current version. An image object will be returned which was created at the specified time (which may be archived or current). ignoreRedirect: If true, do not follow file redirects private: If an Authority object, return restricted (deleted) files if the performer is allowed to view them. Otherwise, such files will not be found. If set and not an Authority object, throws an exception. Authority is only accepted since 1.37, User was required before. latest: If true, load from the latest available data into File objects
Returns
File|false False on failure
Exceptions
InvalidArgumentException

Definition at line 473 of file FileRepo.php.

References NS_FILE.

◆ findFileFromKey()

MediaWiki\FileRepo\FileRepo::findFileFromKey ( $sha1,
$options = [] )

Find an instance of the file with this key, created at the specified time Returns false if the file does not exist.

Repositories not supporting version control should return false if the time is specified.

Parameters
string$sha1Base 36 SHA-1 hash
array$optionsOption array, same as findFile().
Returns
File|false False on failure
Exceptions
InvalidArgumentExceptionif the private option is set and not an Authority object

Definition at line 601 of file FileRepo.php.

◆ findFiles()

MediaWiki\FileRepo\FileRepo::findFiles ( array $items,
$flags = 0 )

Find many files at once.

Parameters
array$itemsAn array of titles, or an array of findFile() options with the "title" option giving the title. Example:

$findItem = [ 'title' => $title, 'private' => true ]; $findBatch = [ $findItem ]; $repo->findFiles( $findBatch );

No title should appear in $items twice, as the result use titles as keys

Parameters
int$flagsSupports:
  • FileRepo::NAME_AND_TIME_ONLY : return a (search title => (title,timestamp)) map. The search title uses the input titles; the other is the final post-redirect title. All titles are returned as string DB keys and the inner array is associative.
Returns
array Map of (file name => File objects) for matches or (search title => (title,timestamp))

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 556 of file FileRepo.php.

◆ findFilesByPrefix()

MediaWiki\FileRepo\FileRepo::findFilesByPrefix ( $prefix,
$limit )

Return an array of files where the name starts with $prefix.

STUB

Parameters
string$prefixThe prefix to search for
int$limitThe maximum amount of files to return
Returns
LocalFile[]

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 676 of file FileRepo.php.

◆ freeTemp()

MediaWiki\FileRepo\FileRepo::freeTemp ( $virtualUrl)

Remove a temporary file or mark it for garbage collection.

Parameters
string$virtualUrlThe virtual URL returned by FileRepo::storeTemp()
Returns
bool True on success, false on failure

Definition at line 1200 of file FileRepo.php.

References wfDebug().

◆ getBackend()

MediaWiki\FileRepo\FileRepo::getBackend ( )

Get the file backend instance.

Use this function wisely.

Returns
FileBackend

Definition at line 270 of file FileRepo.php.

References MediaWiki\FileRepo\FileRepo\$backend.

Referenced by CleanupUploadStash\doOperations(), MediaWiki\FileRepo\ForeignAPIRepo\getThumbUrlFromCache(), and PurgeChangedFiles\purgeFromArchiveTable().

◆ getDeletedHashPath()

MediaWiki\FileRepo\FileRepo::getDeletedHashPath ( $key)

Get a relative path for a deletion archive key, e.g.

s/z/a/ for sza251lrxrc1jad41h5mgilp8nysje52.jpg

Parameters
string$key
Returns
string

Definition at line 1569 of file FileRepo.php.

References $path.

Referenced by MediaWiki\FileRepo\LocalRepo\cleanupDeletedBatch(), and PurgeChangedFiles\getDeletedPath().

◆ getDescriptionRenderUrl()

MediaWiki\FileRepo\FileRepo::getDescriptionRenderUrl ( $name,
$lang = null )

Get the URL of the content-only fragment of the description page.

For MediaWiki this means action=render. This should only be called by the repository's file class, since it may return invalid results. User code should use File::getDescriptionText().

Parameters
string$nameName of image to fetch
string | null$langLanguage to fetch it in, if any.
Returns
string|false

Definition at line 879 of file FileRepo.php.

References wfAppendQuery(), and wfUrlencode().

◆ getDescriptionStylesheetUrl()

MediaWiki\FileRepo\FileRepo::getDescriptionStylesheetUrl ( )

Get the URL of the stylesheet to apply to description pages.

Returns
string|false False on failure

Definition at line 904 of file FileRepo.php.

◆ getDescriptionUrl()

MediaWiki\FileRepo\FileRepo::getDescriptionUrl ( $name)

Get the URL of an image description page.

May return false if it is unknown or not applicable. In general this should only be called by the File class, since it may return invalid results for certain kinds of repositories. Use File::getDescriptionUrl() in user code.

In particular, it uses the article paths as specified to the repository constructor, whereas local repositories use the local Title functions.

Parameters
string$name
Returns
string|false

Definition at line 845 of file FileRepo.php.

References wfUrlencode().

◆ getDisplayName()

MediaWiki\FileRepo\FileRepo::getDisplayName ( )

◆ getFileProps()

MediaWiki\FileRepo\FileRepo::getFileProps ( $virtualUrl)

Get properties of a file with a given virtual URL/storage path.

Properties should ultimately be obtained via FSFile::getProps().

Parameters
string$virtualUrl
Returns
array

Reimplemented in MediaWiki\FileRepo\ForeignAPIRepo.

Definition at line 1647 of file FileRepo.php.

References MediaWiki\MediaWikiServices\getInstance().

◆ getFileSha1()

MediaWiki\FileRepo\FileRepo::getFileSha1 ( $virtualUrl)

Get the sha1 (base 36) of a file with a given virtual URL/storage path.

Parameters
string$virtualUrl
Returns
string|false

Definition at line 1689 of file FileRepo.php.

References $path.

Referenced by PurgeChangedFiles\getDeletedPath().

◆ getFileSize()

MediaWiki\FileRepo\FileRepo::getFileSize ( $virtualUrl)

Get the size of a file with a given virtual URL/storage path.

Parameters
string$virtualUrl
Returns
int|false

Definition at line 1677 of file FileRepo.php.

References $path.

◆ getFileTimestamp()

MediaWiki\FileRepo\FileRepo::getFileTimestamp ( $virtualUrl)

Get the timestamp of a file with a given virtual URL/storage path.

Parameters
string$virtualUrl
Returns
string|false False on failure

Definition at line 1665 of file FileRepo.php.

References $path.

◆ getHashLevels()

MediaWiki\FileRepo\FileRepo::getHashLevels ( )

Get the number of hash directory levels.

Returns
int

Definition at line 805 of file FileRepo.php.

◆ getHashPath()

MediaWiki\FileRepo\FileRepo::getHashPath ( $name)

Get a relative path including trailing slash, e.g.

f/fa/ If the repo is not hashed, returns an empty string

Parameters
string$nameName of file
Returns
string

Definition at line 764 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\File\UnregisteredLocalFile\__construct(), and MediaWiki\FileRepo\ForeignAPIRepo\getThumbUrlFromCache().

◆ getHashPathForLevel()

static MediaWiki\FileRepo\FileRepo::getHashPathForLevel ( $name,
$levels )
staticprotected
Parameters
string$name
int$levels
Returns
string

Definition at line 786 of file FileRepo.php.

References $path.

◆ getInfo()

◆ getLocalCacheKey()

MediaWiki\FileRepo\FileRepo::getLocalCacheKey ( $kClassSuffix,
$components )

Get a site-local, repository-qualified, WAN cache key.

These cache keys are not shared among different site context and thus cannot be directly invalidated when repo objects are modified. These are useful when there is no accessible global cache or the values depend on the current site context.

Parameters
string$kClassSuffixKey collection name suffix (added to this repo class)
mixed...$components Additional key components
Returns
string

Definition at line 1931 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\LocalRepo\checkRedirect(), and MediaWiki\FileRepo\ForeignAPIRepo\getThumbUrlFromCache().

◆ getLocalCopy()

MediaWiki\FileRepo\FileRepo::getLocalCopy ( $virtualUrl)

Get a local FS copy of a file with a given virtual URL/storage path.

Temporary files may be purged when the file object falls out of scope.

Parameters
string$virtualUrl
Returns
TempFSFile|null|false Returns false for missing file, null on failure

Definition at line 1603 of file FileRepo.php.

References $path.

◆ getLocalReference()

MediaWiki\FileRepo\FileRepo::getLocalReference ( $virtualUrl)

Get a local FS file with a given virtual URL/storage path.

The file is either an original or a copy. It should not be changed. Temporary files may be purged when the file object falls out of scope.

Parameters
string$virtualUrl
Returns
FSFile|null|false Returns false for missing file, null on failure.

Definition at line 1617 of file FileRepo.php.

References $path.

◆ getName()

MediaWiki\FileRepo\FileRepo::getName ( )

Get the name of this repository, as specified by $info['name]' to the constructor.

Returns
string

Definition at line 814 of file FileRepo.php.

◆ getNameFromTitle()

MediaWiki\FileRepo\FileRepo::getNameFromTitle ( $title)

Get the name of a file from its title.

Parameters
PageIdentity | LinkTarget$title
Returns
string

Definition at line 732 of file FileRepo.php.

References MediaWiki\MediaWikiServices\getInstance(), and NS_FILE.

Referenced by MediaWiki\FileRepo\File\UnregisteredLocalFile\__construct(), and MediaWiki\FileRepo\LocalRepo\findFiles().

◆ getReadOnlyReason()

MediaWiki\FileRepo\FileRepo::getReadOnlyReason ( )

Get an explanatory message if this repo is read-only.

This checks if an administrator disabled writes to the backend.

Returns
string|false Returns false if the repo is not read-only

Definition at line 280 of file FileRepo.php.

◆ getRootDirectory()

MediaWiki\FileRepo\FileRepo::getRootDirectory ( )

Get the public zone root storage directory of the repository.

Returns
string

Definition at line 753 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\File\UnregisteredLocalFile\__construct().

◆ getSharedCacheKey()

MediaWiki\FileRepo\FileRepo::getSharedCacheKey ( $kClassSuffix,
$components )

Get a global, repository-qualified, WAN cache key.

This might be called from either the site context of the wiki that owns the repo or the site context of another wiki that simply has access to the repo. This returns false if the repository's cache is not accessible from the current site context.

Parameters
string$kClassSuffixKey collection name suffix (added to this repo class)
mixed...$components Additional key components
Returns
string|false

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1916 of file FileRepo.php.

◆ getTempHashPath()

MediaWiki\FileRepo\FileRepo::getTempHashPath ( $suffix)

Get a relative path including trailing slash, e.g.

f/fa/ If the repo is not hashed, returns an empty string

Parameters
string$suffixBasename of file from FileRepo::storeTemp()
Returns
string

Definition at line 775 of file FileRepo.php.

◆ getTempRepo()

MediaWiki\FileRepo\FileRepo::getTempRepo ( )

Get a temporary private FileRepo associated with this repo.

Files will be created in the temp zone of this repo. It will have the same backend as this repo.

Returns
TempFileRepo

Reimplemented in MediaWiki\FileRepo\TempFileRepo.

Definition at line 1947 of file FileRepo.php.

◆ getThumbProxySecret()

MediaWiki\FileRepo\FileRepo::getThumbProxySecret ( )

Get the secret key for the proxied thumb service.

Returns
string|null

Definition at line 703 of file FileRepo.php.

◆ getThumbProxyUrl()

MediaWiki\FileRepo\FileRepo::getThumbProxyUrl ( )

Get the URL thumb.php requests are being proxied to.

Returns
string|null

Definition at line 694 of file FileRepo.php.

◆ getThumbScriptUrl()

MediaWiki\FileRepo\FileRepo::getThumbScriptUrl ( )

Get the URL of thumb.php.

Returns
string

Definition at line 685 of file FileRepo.php.

◆ getUploadStash()

MediaWiki\FileRepo\FileRepo::getUploadStash ( ?UserIdentity $user = null)

Get an UploadStash associated with this repo.

Parameters
UserIdentity | null$user
Returns
UploadStash

Definition at line 1982 of file FileRepo.php.

◆ getVirtualUrl()

MediaWiki\FileRepo\FileRepo::getVirtualUrl ( $suffix = false)

Get a URL referring to this repository, with the private mwrepo protocol.

The suffix, if supplied, is considered to be unencoded, and will be URL-encoded before being returned.

Parameters
string | false$suffix
Returns
string

Definition at line 316 of file FileRepo.php.

References $path.

◆ getZoneLocation()

MediaWiki\FileRepo\FileRepo::getZoneLocation ( $zone)
protected

The storage container and base path of a zone.

Parameters
string$zone
Returns
array (container, base path) or (null, null)

Definition at line 400 of file FileRepo.php.

◆ getZonePath()

MediaWiki\FileRepo\FileRepo::getZonePath ( $zone)

Get the storage path corresponding to one of the zones.

Parameters
string$zone
Returns
string|null Returns null if the zone is not defined

Reimplemented in MediaWiki\FileRepo\ForeignAPIRepo.

Definition at line 414 of file FileRepo.php.

Referenced by UploadStashFile\__construct(), MediaWiki\FileRepo\LocalRepo\cleanupDeletedBatch(), and MediaWiki\FileRepo\FileRepo\initZones().

◆ getZoneUrl()

MediaWiki\FileRepo\FileRepo::getZoneUrl ( $zone,
$ext = null )

Get the URL corresponding to one of the four basic zones.

Parameters
string$zoneOne of: public, deleted, temp, thumb
string | null$extOptional file extension
Returns
string|false

Reimplemented in MediaWiki\FileRepo\ForeignAPIRepo.

Definition at line 332 of file FileRepo.php.

References $url.

◆ hasSha1Storage()

MediaWiki\FileRepo\FileRepo::hasSha1Storage ( )

Returns whether or not storage is SHA-1 based.

Returns
bool

Definition at line 2037 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\LocalRepo\__construct(), MediaWiki\FileRepo\LocalRepo\cleanupDeletedBatch(), and MediaWiki\FileRepo\LocalRepo\skipWriteOperationIfSha1().

◆ initDirectory()

MediaWiki\FileRepo\FileRepo::initDirectory ( $dir)
protected

Creates a directory with the appropriate zone permissions.

Callers are responsible for doing read-only and "writable repo" checks.

Parameters
string$dirVirtual URL (or storage path) of directory to clean
Returns
Status Good status without value for success, fatal otherwise.

Definition at line 1409 of file FileRepo.php.

References $path, and Wikimedia\FileBackend\FileBackend\splitStoragePath().

◆ initZones()

MediaWiki\FileRepo\FileRepo::initZones ( $doZones = [])
protected

Ensure that a single zone or list of zones is defined for usage.

Parameters
string[] | string$doZonesOnly do a particular zones

Definition at line 289 of file FileRepo.php.

References MediaWiki\FileRepo\FileRepo\getZonePath().

◆ invalidateImageRedirect()

MediaWiki\FileRepo\FileRepo::invalidateImageRedirect ( $title)

Invalidates image redirect cache related to that image Doesn't do anything for repositories that don't support image redirects.

STUB

Parameters
PageIdentity | LinkTarget$titleTitle of image

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1861 of file FileRepo.php.

◆ isLocal()

MediaWiki\FileRepo\FileRepo::isLocal ( )

Returns true if this the local file repository.

Returns
bool

Definition at line 1901 of file FileRepo.php.

◆ isVirtualUrl()

static MediaWiki\FileRepo\FileRepo::isVirtualUrl ( $url)
static

Determine if a string is an mwrepo:// URL.

Parameters
string$url
Returns
bool

Definition at line 304 of file FileRepo.php.

References $url.

Referenced by MediaWiki\FileRepo\RepoGroup\getFileProps().

◆ makeUrl()

MediaWiki\FileRepo\FileRepo::makeUrl ( $query = '',
$entry = 'index' )

Make an url to this repo.

Parameters
string | array$queryQuery string to append
string$entryEntry point; defaults to index
Returns
string|false False on failure

Definition at line 825 of file FileRepo.php.

References wfAppendQuery().

Referenced by MediaWiki\FileRepo\ForeignAPIRepo\httpGetCached().

◆ nameForThumb()

MediaWiki\FileRepo\FileRepo::nameForThumb ( $name)

Get the portion of the file that contains the origin file name.

If that name is too long, then the name "thumbnail.<ext>" will be given.

Parameters
string$name
Returns
string

Definition at line 1887 of file FileRepo.php.

References Wikimedia\FileBackend\FileBackend\extensionFromPath().

◆ newFatal()

MediaWiki\FileRepo\FileRepo::newFatal ( $message,
$parameters )

Create a new fatal error.

Parameters
string$message
mixed...$parameters
Returns
Status

Definition at line 1822 of file FileRepo.php.

◆ newFile()

MediaWiki\FileRepo\FileRepo::newFile ( $title,
$time = false )

Create a new File object from the local repository.

Parameters
PageIdentity | LinkTarget | string$title
string | false$timeTime at which the image was uploaded. If this is specified, the returned object will be an instance of the repository's old file class instead of a current file. Repositories not supporting version control should return false if this parameter is set.
Returns
File|null A File, or null if passed an invalid Title

Reimplemented in MediaWiki\FileRepo\ForeignAPIRepo.

Definition at line 438 of file FileRepo.php.

Referenced by FindOrphanedFiles\checkFiles(), and MediaWiki\FileRepo\LocalRepo\findFiles().

◆ newGood()

MediaWiki\FileRepo\FileRepo::newGood ( $value = null)

Create a new good result.

Parameters
null | mixed$value
Returns
Status

Definition at line 1835 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\LocalRepo\cleanupDeletedBatch().

◆ paranoidClean()

MediaWiki\FileRepo\FileRepo::paranoidClean ( $param)

Path disclosure protection function.

Parameters
string$param
Returns
string

Definition at line 1801 of file FileRepo.php.

◆ passThrough()

MediaWiki\FileRepo\FileRepo::passThrough ( $param)

Path disclosure protection function.

Parameters
string$param
Returns
string

Definition at line 1811 of file FileRepo.php.

◆ publish()

MediaWiki\FileRepo\FileRepo::publish ( $src,
$dstRel,
$archiveRel,
$flags = 0,
array $options = [] )

Copy or move a file either from a storage path, virtual URL, or file system path, into this repository at the specified destination location.

Returns a Status object. On success, the value contains "new" or "archived", to indicate whether the file was new with that name.

Using FSFile/TempFSFile can improve performance via caching. Using TempFSFile can further improve performance by signalling that it is safe to touch the source file or write extended attribute metadata to it directly.

Options to $options include:

  • headers : name/value map of HTTP headers to use in response to GET/HEAD requests
Parameters
string | FSFile$srcThe source file system path, storage path, or URL
string$dstRelThe destination relative path
string$archiveRelThe relative path where the existing file is to be archived, if there is one. Relative to the public zone root.
int$flagsBitfield, may be FileRepo::DELETE_SOURCE to indicate that the source file should be deleted if possible
array$optionsOptional additional parameters
Returns
Status

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1275 of file FileRepo.php.

◆ publishBatch()

MediaWiki\FileRepo\FileRepo::publishBatch ( array $ntuples,
$flags = 0 )

Publish a batch of files.

See also
FileRepo::publish()
Parameters
array$ntuples(source, dest, archive) triplets or (source, dest, archive, options) 4-tuples as per publish().
int$flagsBitfield, may be FileRepo::DELETE_SOURCE to indicate that the source files should be deleted if possible
Returns
Status

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 1301 of file FileRepo.php.

References Wikimedia\FileBackend\FileBackend\isStoragePath().

◆ quickCleanDir()

MediaWiki\FileRepo\FileRepo::quickCleanDir ( $dir)

Deletes a directory if empty.

This function can be used to write to otherwise read-only foreign repos.

Parameters
string$dirVirtual URL (or storage path) of directory to clean
Returns
Status

Definition at line 1139 of file FileRepo.php.

◆ quickImport()

MediaWiki\FileRepo\FileRepo::quickImport ( $src,
$dst,
$options = null )
final

Import a file from the local file system into the repo.

This does no locking and overrides existing files. This function can be used to write to otherwise read-only foreign repos. This is intended for copying generated thumbnails into the repo.

Using FSFile/TempFSFile can improve performance via caching. Using TempFSFile can further improve performance by signalling that it is safe to touch the source file or write extended attribute metadata to it directly.

Parameters
string | FSFile$srcSource file system path, storage path, or virtual URL
string$dstVirtual URL or storage path
array | string | null$optionsAn array consisting of a key named headers listing extra headers. If a string, taken as content-disposition header. (Support for array of options new in 1.23)
Returns
Status

Definition at line 1066 of file FileRepo.php.

◆ quickImportBatch()

MediaWiki\FileRepo\FileRepo::quickImportBatch ( array $triples)

Import a batch of files from the local file system into the repo.

This does no locking and overrides existing files. This function can be used to write to otherwise read-only foreign repos. This is intended for copying generated thumbnails into the repo.

See also
FileRepo::quickImport()

All path parameters may be a file system path, storage path, or virtual URL. When "headers" are given they are used as HTTP headers if supported.

Parameters
array$triplesList of (source path or FSFile, destination path, disposition)
Returns
Status

Definition at line 1084 of file FileRepo.php.

References Wikimedia\FileBackend\FileBackend\isStoragePath().

◆ quickPurge()

MediaWiki\FileRepo\FileRepo::quickPurge ( $path)
final

Purge a file from the repo.

This does no locking. This function can be used to write to otherwise read-only foreign repos. This is intended for purging thumbnails.

Parameters
string$pathVirtual URL or storage path
Returns
Status

Definition at line 1128 of file FileRepo.php.

References $path.

◆ quickPurgeBatch()

MediaWiki\FileRepo\FileRepo::quickPurgeBatch ( array $paths)

Purge a batch of files from the repo.

This function can be used to write to otherwise read-only foreign repos. This does no locking and is intended for purging thumbnails.

Parameters
string[]$pathsList of virtual URLs or storage paths
Returns
Status

Definition at line 1155 of file FileRepo.php.

References $path.

◆ resolveToStoragePathIfVirtual()

MediaWiki\FileRepo\FileRepo::resolveToStoragePathIfVirtual ( $path)
protected

If a path is a virtual URL, resolve it to a storage path.

Otherwise, just return the path as it is.

Parameters
string$path
Returns
string

Definition at line 1588 of file FileRepo.php.

References $path.

◆ resolveVirtualUrl()

MediaWiki\FileRepo\FileRepo::resolveVirtualUrl ( $url)

Get the backend storage path corresponding to a virtual URL.

Callers are responsible of verifying that $url is a valid virtual URL. Use this function wisely.

Parameters
string$url
Returns
string

Definition at line 374 of file FileRepo.php.

References $url.

Referenced by UploadStashFile\__construct().

◆ store()

MediaWiki\FileRepo\FileRepo::store ( $srcPath,
$dstZone,
$dstRel,
$flags = 0 )

Store a file to a given destination.

Using FSFile/TempFSFile can improve performance via caching. Using TempFSFile can further improve performance by signalling that it is safe to touch the source file or write extended attribute metadata to it directly.

Parameters
string | FSFile$srcPathSource file system path, storage path, or virtual URL
string$dstZoneDestination zone
string$dstRelDestination relative path
int$flagsBitwise combination of the following flags: self::OVERWRITE Overwrite an existing destination file instead of failing self::OVERWRITE_SAME Overwrite the file if the destination exists and has the same contents as the source self::SKIP_LOCKING Skip any file locking when doing the store
Returns
Status

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 931 of file FileRepo.php.

◆ storeBatch()

MediaWiki\FileRepo\FileRepo::storeBatch ( array $triplets,
$flags = 0 )

Store a batch of files.

See also
FileRepo::store()
Parameters
array$triplets(src, dest zone, dest rel) triplets as per store()
int$flagsBitwise combination of the following flags: self::OVERWRITE Overwrite an existing destination file instead of failing self::OVERWRITE_SAME Overwrite the file if the destination exists and has the same contents as the source self::SKIP_LOCKING Skip any file locking when doing the store
Returns
Status

Reimplemented in MediaWiki\FileRepo\LocalRepo.

Definition at line 955 of file FileRepo.php.

References Wikimedia\FileBackend\FileBackend\isStoragePath(), and wfDebug().

◆ storeTemp()

MediaWiki\FileRepo\FileRepo::storeTemp ( $originalName,
$srcPath )

Pick a random name in the temp zone and store a file to it.

Returns a Status object with the file Virtual URL in the value, file can later be disposed using FileRepo::freeTemp().

Parameters
string$originalNameThe base name of the file as specified by the user. The file extension will be maintained.
string$srcPathThe current location of the file.
Returns
Status Object with the URL in the value.

Definition at line 1180 of file FileRepo.php.

◆ streamFileWithStatus()

MediaWiki\FileRepo\FileRepo::streamFileWithStatus ( $virtualUrl,
$headers = [],
$optHeaders = [] )

Attempt to stream a file with the given virtual URL/storage path.

Parameters
string$virtualUrl
array$headersAdditional HTTP headers to send on success
array$optHeadersHTTP request headers (if-modified-since, range, ...)
Returns
Status
Since
1.27

Definition at line 1704 of file FileRepo.php.

References $path.

◆ supportsSha1URLs()

MediaWiki\FileRepo\FileRepo::supportsSha1URLs ( )

Returns whether or not repo supports having originals SHA-1s in the thumb URLs.

Returns
bool

Definition at line 2045 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\FileRepo\__construct().

◆ validateFilename()

MediaWiki\FileRepo\FileRepo::validateFilename ( $filename)

Determine if a relative path is valid, i.e.

not blank or involving directory traversal

Parameters
string$filename
Returns
bool

Definition at line 1770 of file FileRepo.php.

References Wikimedia\FileBackend\FileBackend\isPathTraversalFree().

Referenced by UploadStashFile\__construct(), and MediaWiki\FileRepo\ForeignAPIRepo\getThumbUrlFromCache().

Member Data Documentation

◆ $abbrvThreshold

int MediaWiki\FileRepo\FileRepo::$abbrvThreshold
protected

File names over this size will use the short form of thumbnail names.

Short thumbnail names only have the width, parameters, and the extension.

Definition at line 147 of file FileRepo.php.

◆ $articleUrl

string null MediaWiki\FileRepo\FileRepo::$articleUrl
protected

Equivalent to $wgArticlePath, e.g.

https://en.wikipedia.org/wiki/$1

Definition at line 115 of file FileRepo.php.

◆ $backend

◆ $deletedHashLevels

int MediaWiki\FileRepo\FileRepo::$deletedHashLevels
protected

The number of directory levels for hash-based division of deleted files.

Definition at line 141 of file FileRepo.php.

◆ $descBaseUrl

string null MediaWiki\FileRepo\FileRepo::$descBaseUrl
protected

URL of image description pages, e.g.

https://en.wikipedia.org/wiki/File:

Definition at line 107 of file FileRepo.php.

◆ $descriptionCacheExpiry

int MediaWiki\FileRepo\FileRepo::$descriptionCacheExpiry

Definition at line 82 of file FileRepo.php.

◆ $disableLocalTransform

bool MediaWiki\FileRepo\FileRepo::$disableLocalTransform = false
protected

Disable local image scaling.

Definition at line 172 of file FileRepo.php.

◆ $favicon

null string MediaWiki\FileRepo\FileRepo::$favicon = null
protected

The URL to a favicon (optional, may be a server-local path URL).

Definition at line 150 of file FileRepo.php.

◆ $fetchDescription

bool MediaWiki\FileRepo\FileRepo::$fetchDescription

Whether to fetch commons image description pages and display them on the local wiki.

Definition at line 79 of file FileRepo.php.

◆ $fileFactory

callable MediaWiki\FileRepo\FileRepo::$fileFactory = [ UnregisteredLocalFile::class, 'newFromTitle' ]
protected

Override these in the base class.

Definition at line 156 of file FileRepo.php.

◆ $fileFactoryKey

callable false MediaWiki\FileRepo\FileRepo::$fileFactoryKey = false
protected

Override these in the base class.

Definition at line 160 of file FileRepo.php.

◆ $hashLevels

int MediaWiki\FileRepo\FileRepo::$hashLevels
protected

The number of directory levels for hash-based division of files.

Definition at line 138 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\FileRepo\__construct().

◆ $hasSha1Storage

bool MediaWiki\FileRepo\FileRepo::$hasSha1Storage = false
protected

Definition at line 85 of file FileRepo.php.

◆ $initialCapital

bool MediaWiki\FileRepo\FileRepo::$initialCapital
protected

Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE], determines whether filenames implicitly start with a capital letter.

The current implementation may give incorrect description page links when the local $wgCapitalLinks and initialCapital are mismatched.

Definition at line 122 of file FileRepo.php.

◆ $isPrivate

bool MediaWiki\FileRepo\FileRepo::$isPrivate
protected

Whether all zones should be private (e.g.

private wiki repo)

Definition at line 153 of file FileRepo.php.

◆ $name

string MediaWiki\FileRepo\FileRepo::$name
Note
Use $this->getName(). Public for back-compat only
Todo
make protected

Definition at line 182 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\ForeignAPIRepo\getThumbError(), and MediaWiki\FileRepo\ForeignAPIRepo\getThumbUrlFromCache().

◆ $oldFileFactory

callable false MediaWiki\FileRepo\FileRepo::$oldFileFactory = false
protected

Override these in the base class.

Definition at line 158 of file FileRepo.php.

◆ $oldFileFactoryKey

callable false MediaWiki\FileRepo\FileRepo::$oldFileFactoryKey = false
protected

Override these in the base class.

Definition at line 162 of file FileRepo.php.

◆ $pathDisclosureProtection

string MediaWiki\FileRepo\FileRepo::$pathDisclosureProtection = 'simple'
protected

May be 'paranoid' to remove all parameters from error messages, 'none' to leave the paths in unchanged, or 'simple' to replace paths with placeholders.

Default for LocalRepo is 'simple'.

Definition at line 129 of file FileRepo.php.

◆ $scriptDirUrl

string null MediaWiki\FileRepo\FileRepo::$scriptDirUrl
protected

URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g.

https://en.wikipedia.org/w

Definition at line 112 of file FileRepo.php.

◆ $supportsSha1URLs

bool MediaWiki\FileRepo\FileRepo::$supportsSha1URLs = false
protected

Definition at line 88 of file FileRepo.php.

◆ $thumbProxySecret

string MediaWiki\FileRepo\FileRepo::$thumbProxySecret
protected

Secret key to pass as an X-Swift-Secret header to the proxied thumb service.

Definition at line 169 of file FileRepo.php.

◆ $thumbProxyUrl

string MediaWiki\FileRepo\FileRepo::$thumbProxyUrl
protected

URL of where to proxy thumb.php requests to.

Example: http://127.0.0.1:8888/wiki/dev/thumb/

Definition at line 167 of file FileRepo.php.

◆ $thumbScriptUrl

string MediaWiki\FileRepo\FileRepo::$thumbScriptUrl
protected

URL of thumb.php.

Definition at line 97 of file FileRepo.php.

◆ $thumbUrl

string false MediaWiki\FileRepo\FileRepo::$thumbUrl
protected

The base thumbnail URL.

Defaults to "<url>/thumb".

Definition at line 135 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\ForeignAPIRepo\getZoneUrl().

◆ $transformVia404

bool MediaWiki\FileRepo\FileRepo::$transformVia404
protected

Whether to skip media file transformation on parse and rely on a 404 handler instead.

Definition at line 102 of file FileRepo.php.

◆ $url

string false MediaWiki\FileRepo\FileRepo::$url
protected

◆ $wanCache

WANObjectCache MediaWiki\FileRepo\FileRepo::$wanCache
protected

Definition at line 175 of file FileRepo.php.

◆ $zones

array MediaWiki\FileRepo\FileRepo::$zones = []
protected

Map of zones to config.

Definition at line 94 of file FileRepo.php.

◆ DELETE_SOURCE

const MediaWiki\FileRepo\FileRepo::DELETE_SOURCE = 1

Definition at line 69 of file FileRepo.php.

◆ NAME_AND_TIME_ONLY

const MediaWiki\FileRepo\FileRepo::NAME_AND_TIME_ONLY = 1

Definition at line 74 of file FileRepo.php.

Referenced by MediaWiki\FileRepo\LocalRepo\findFiles().

◆ OVERWRITE

const MediaWiki\FileRepo\FileRepo::OVERWRITE = 2

Definition at line 70 of file FileRepo.php.

◆ OVERWRITE_SAME

const MediaWiki\FileRepo\FileRepo::OVERWRITE_SAME = 4

◆ SKIP_LOCKING

const MediaWiki\FileRepo\FileRepo::SKIP_LOCKING = 8

Definition at line 72 of file FileRepo.php.


The documentation for this class was generated from the following file:

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant