MediaWiki  master
FileRepo Class Reference

Base class for file repositories. More...

Inheritance diagram for FileRepo:
Collaboration diagram for FileRepo:

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

int $descriptionCacheExpiry
 
bool $fetchDescription
 Whether to fetch commons image description pages and display them on the local wiki. More...
 
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. More...
 
 enumFilesInStorage ( $callback)
 Call a callback function for every public file in the repository. More...
 
 getZoneLocation ( $zone)
 The storage container and base path of a zone. More...
 
 initDirectory ( $dir)
 Creates a directory with the appropriate zone permissions. More...
 
 initZones ( $doZones=[])
 Check if a single zone or list of zones is defined for usage. More...
 
 resolveToStoragePathIfVirtual ( $path)
 If a path is a virtual URL, resolve it to a storage path. More...
 

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. More...
 
string $articleUrl
 Equivalent to $wgArticlePath, e.g. More...
 
FileBackend $backend
 
int $deletedHashLevels
 The number of directory levels for hash-based division of deleted files. More...
 
string $descBaseUrl
 URL of image description pages, e.g. More...
 
bool $disableLocalTransform = false
 Disable local image scaling. More...
 
string $favicon
 The URL of the repo's favicon, if any. More...
 
callable $fileFactory = [ UnregisteredLocalFile::class, 'newFromTitle' ]
 Override these in the base class. More...
 
callable false $fileFactoryKey = false
 Override these in the base class. More...
 
int $hashLevels
 The number of directory levels for hash-based division of files. More...
 
bool $hasSha1Storage = false
 
bool $initialCapital
 Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE], determines whether filenames implicitly start with a capital letter. More...
 
bool $isPrivate
 Whether all zones should be private (e.g. More...
 
callable false $oldFileFactory = false
 Override these in the base class. More...
 
callable false $oldFileFactoryKey = false
 Override these in the base class. More...
 
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. More...
 
string $scriptDirUrl
 URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g. More...
 
bool $supportsSha1URLs = false
 
string $thumbProxySecret
 Secret key to pass as an X-Swift-Secret header to the proxied thumb service. More...
 
string $thumbProxyUrl
 URL of where to proxy thumb.php requests to. More...
 
string $thumbScriptUrl
 URL of thumb.php. More...
 
string $thumbUrl
 The base thumbnail URL. More...
 
bool $transformVia404
 Whether to skip media file transformation on parse and rely on a 404 handler instead. More...
 
string false $url
 Public zone URL. More...
 
WANObjectCache $wanCache
 
array $zones = []
 Map of zones to config. More...
 

Private Member Functions

 getErrorCleanupFunction ()
 Get a callback function to use for cleaning error message parameters. More...
 

Detailed Description

Base class for file repositories.

See the architecture doc for more information.

Definition at line 45 of file FileRepo.php.

Constructor & Destructor Documentation

◆ __construct()

FileRepo::__construct ( array  $info = null)
See also
Documentation of info options at $wgLocalFileRepo
Parameters
array | null$info
Exceptions
MWException

Reimplemented in LocalRepo.

Definition at line 167 of file FileRepo.php.

References $hashLevels, WANObjectCache\newEmpty(), NS_FILE, and supportsSha1URLs().

Member Function Documentation

◆ assertWritableRepo()

FileRepo::assertWritableRepo ( )
protected

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

This does not and should not check getReadOnlyReason().

Returns
void
Exceptions
MWException

Reimplemented in NullRepo, ForeignDBViaLBRepo, ForeignDBRepo, and ForeignAPIRepo.

Definition at line 1982 of file FileRepo.php.

Referenced by cleanDir(), cleanupBatch(), cleanupDeletedBatch(), concatenate(), delete(), deleteBatch(), freeTemp(), publish(), publishBatch(), LocalRepo\skipWriteOperationIfSha1(), store(), storeBatch(), and storeTemp().

◆ backendSupportsUnicodePaths()

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

Definition at line 347 of file FileRepo.php.

References FileBackend\ATTR_UNICODE_PATHS, and getBackend().

◆ canTransformLocally()

FileRepo::canTransformLocally ( )

Returns true if the repository can transform files locally.

Since
1.36
Returns
bool

Definition at line 707 of file FileRepo.php.

References $disableLocalTransform.

◆ canTransformVia404()

FileRepo::canTransformVia404 ( )

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

Returns
bool

Definition at line 697 of file FileRepo.php.

References $transformVia404.

◆ checkRedirect()

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|bool

Reimplemented in LocalRepo.

Definition at line 1839 of file FileRepo.php.

Referenced by findFile().

◆ cleanDir()

FileRepo::cleanDir (   $dir)

Deletes a directory if empty.

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

Definition at line 1429 of file FileRepo.php.

References assertWritableRepo(), and newGood().

◆ cleanupBatch()

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 LocalRepo.

Definition at line 1011 of file FileRepo.php.

References $path, assertWritableRepo(), getZonePath(), newGood(), resolveToStoragePathIfVirtual(), and true.

◆ cleanupDeletedBatch()

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 LocalRepo.

Definition at line 1561 of file FileRepo.php.

References assertWritableRepo().

◆ concatenate()

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

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

Parameters
array$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 1212 of file FileRepo.php.

References $source, assertWritableRepo(), newGood(), quickPurgeBatch(), and resolveToStoragePathIfVirtual().

◆ delete()

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 LocalRepo.

Definition at line 1480 of file FileRepo.php.

References assertWritableRepo(), and deleteBatch().

◆ deleteBatch()

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.
Exceptions
MWException
Returns
Status

Reimplemented in LocalRepo.

Definition at line 1503 of file FileRepo.php.

References $backend, assertWritableRepo(), FileBackend\doOperations(), getZonePath(), initDirectory(), initZones(), newFatal(), newGood(), true, and validateFilename().

Referenced by delete().

◆ enumFiles()

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 ForeignAPIRepo.

Definition at line 1720 of file FileRepo.php.

References enumFilesInStorage().

◆ enumFilesInStorage()

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 1731 of file FileRepo.php.

References $hashLevels, $name, $path, and getZonePath().

Referenced by enumFiles().

◆ fileExists()

FileRepo::fileExists (   $file)

Checks existence of a file.

Parameters
string$fileVirtual URL (or storage path) of file to check
Returns
bool

Definition at line 1445 of file FileRepo.php.

References $file, and fileExistsBatch().

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

◆ fileExistsBatch()

FileRepo::fileExistsBatch ( array  $files)

Checks existence of an array of files.

Parameters
string[]$filesVirtual URLs (or storage paths) of files to check
Returns
array Map of files and existence flags, or false

Reimplemented in ForeignAPIRepo.

Definition at line 1457 of file FileRepo.php.

References $file, $path, and resolveToStoragePathIfVirtual().

Referenced by fileExists().

◆ findBySha1()

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 LocalRepo, and ForeignAPIRepo.

Definition at line 630 of file FileRepo.php.

Referenced by findBySha1s().

◆ findBySha1s()

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 LocalRepo.

Definition at line 641 of file FileRepo.php.

References $hashes, and findBySha1().

◆ findFile()

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|bool False on failure
Exceptions
InvalidArgumentException

Definition at line 458 of file FileRepo.php.

References $title, checkRedirect(), File\DELETED_FILE, newFile(), File\normalizeTitle(), and NS_FILE.

Referenced by findFiles().

◆ findFileFromKey()

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|bool False on failure
Exceptions
InvalidArgumentExceptionif the private option is set and not an Authority object

Definition at line 586 of file FileRepo.php.

References File\DELETED_FILE.

◆ findFiles()

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

Reimplemented in LocalRepo.

Definition at line 541 of file FileRepo.php.

References $file, $title, findFile(), RequestContext\getMain(), and File\normalizeTitle().

◆ findFilesByPrefix()

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 LocalRepo.

Definition at line 661 of file FileRepo.php.

◆ freeTemp()

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 1190 of file FileRepo.php.

References assertWritableRepo(), getVirtualUrl(), quickPurge(), and wfDebug().

◆ getBackend()

FileRepo::getBackend ( )

Get the file backend instance.

Use this function wisely.

Returns
FileBackend

Definition at line 251 of file FileRepo.php.

References $backend.

Referenced by backendSupportsUnicodePaths(), CleanupUploadStash\doOperations(), ForeignAPIRepo\getThumbUrlFromCache(), LocalFile\publishTo(), and PurgeChangedFiles\purgeFromArchiveTable().

◆ getDeletedHashPath()

FileRepo::getDeletedHashPath (   $key)

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

s/z/a/ for sza251lrxrc1jad41h5mgilp8nysje52.jpg

Parameters
string$key
Exceptions
MWException
Returns
string

Definition at line 1573 of file FileRepo.php.

References $deletedHashLevels, and $path.

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

◆ getDescriptionRenderUrl()

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 864 of file FileRepo.php.

References $lang, getDescriptionUrl(), makeUrl(), wfAppendQuery(), and wfUrlencode().

◆ getDescriptionStylesheetUrl()

FileRepo::getDescriptionStylesheetUrl ( )

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

Returns
string|bool False on failure

Definition at line 889 of file FileRepo.php.

References makeUrl().

◆ getDescriptionUrl()

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 830 of file FileRepo.php.

References $name, makeUrl(), and wfUrlencode().

Referenced by getDescriptionRenderUrl().

◆ getDisplayName()

FileRepo::getDisplayName ( )

Get the human-readable name of the repo.

Returns
string

Definition at line 1858 of file FileRepo.php.

References $wgSitename, isLocal(), and wfMessageFallback().

Referenced by getInfo(), and ForeignAPIRepo\getThumbError().

◆ getErrorCleanupFunction()

FileRepo::getErrorCleanupFunction ( )
private

Get a callback function to use for cleaning error message parameters.

Returns
callable

Definition at line 1772 of file FileRepo.php.

Referenced by newFatal(), and newGood().

◆ getFileProps()

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 ForeignAPIRepo.

Definition at line 1635 of file FileRepo.php.

References getLocalReference().

◆ getFileSha1()

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 1677 of file FileRepo.php.

References $path, and resolveToStoragePathIfVirtual().

Referenced by PurgeChangedFiles\getDeletedPath(), and LocalFile\publishTo().

◆ getFileSize()

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 1665 of file FileRepo.php.

References $path, and resolveToStoragePathIfVirtual().

◆ getFileTimestamp()

FileRepo::getFileTimestamp (   $virtualUrl)

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

Parameters
string$virtualUrl
Returns
string|bool False on failure

Definition at line 1653 of file FileRepo.php.

References $path, and resolveToStoragePathIfVirtual().

◆ getHashLevels()

FileRepo::getHashLevels ( )

Get the number of hash directory levels.

Returns
int

Definition at line 790 of file FileRepo.php.

References $hashLevels.

◆ getHashPath()

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 749 of file FileRepo.php.

References $name, and getHashPathForLevel().

Referenced by UnregisteredLocalFile\__construct(), ForeignAPIRepo\getThumbUrlFromCache(), and storeTemp().

◆ getHashPathForLevel()

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

Definition at line 771 of file FileRepo.php.

References $name, and $path.

Referenced by getHashPath(), and getTempHashPath().

◆ getInfo()

FileRepo::getInfo ( )

Return information about the repository.

Returns
array
Since
1.22

Reimplemented in LocalRepo, ForeignDBViaLBRepo, ForeignDBRepo, and ForeignAPIRepo.

Definition at line 1991 of file FileRepo.php.

References getDisplayName(), getName(), getZoneUrl(), and isLocal().

Referenced by ApiQueryFileRepoInfo\execute(), ForeignDBRepo\getInfo(), ForeignDBViaLBRepo\getInfo(), and ApiQueryFileRepoInfo\getProps().

◆ getLocalCacheKey()

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 1920 of file FileRepo.php.

References getName().

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

◆ getLocalCopy()

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 Returns null on failure

Definition at line 1608 of file FileRepo.php.

References $path, and resolveToStoragePathIfVirtual().

◆ getLocalReference()

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 Returns null on failure.

Definition at line 1622 of file FileRepo.php.

References $path, and resolveToStoragePathIfVirtual().

Referenced by getFileProps().

◆ getName()

FileRepo::getName ( )

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

Returns
string

Definition at line 799 of file FileRepo.php.

References $name.

Referenced by getInfo(), getLocalCacheKey(), and isLocal().

◆ getNameFromTitle()

FileRepo::getNameFromTitle (   $title)

Get the name of a file from its title.

Parameters
PageIdentity | LinkTarget$title
Returns
string

Definition at line 717 of file FileRepo.php.

References $name, $title, and NS_FILE.

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

◆ getReadOnlyReason()

FileRepo::getReadOnlyReason ( )

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

This checks if an administrator disabled writes to the backend.

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

Definition at line 261 of file FileRepo.php.

Referenced by LocalFile\publishTo().

◆ getRootDirectory()

FileRepo::getRootDirectory ( )

Get the public zone root storage directory of the repository.

Returns
string

Definition at line 738 of file FileRepo.php.

References getZonePath().

Referenced by UnregisteredLocalFile\__construct().

◆ getSharedCacheKey()

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 LocalRepo.

Definition at line 1905 of file FileRepo.php.

◆ getTempHashPath()

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 760 of file FileRepo.php.

References $name, and getHashPathForLevel().

◆ getTempRepo()

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 TempFileRepo.

Definition at line 1936 of file FileRepo.php.

◆ getThumbProxySecret()

FileRepo::getThumbProxySecret ( )

Get the secret key for the proxied thumb service.

Returns
string

Definition at line 688 of file FileRepo.php.

References $thumbProxySecret.

◆ getThumbProxyUrl()

FileRepo::getThumbProxyUrl ( )

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

Returns
string

Definition at line 679 of file FileRepo.php.

References $thumbProxyUrl.

◆ getThumbScriptUrl()

FileRepo::getThumbScriptUrl ( )

Get the URL of thumb.php.

Returns
string

Definition at line 670 of file FileRepo.php.

References $thumbScriptUrl.

◆ getUploadStash()

FileRepo::getUploadStash ( UserIdentity  $user = null)

Get an UploadStash associated with this repo.

Parameters
UserIdentity | null$user
Returns
UploadStash

Definition at line 1971 of file FileRepo.php.

◆ getVirtualUrl()

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 | bool$suffix
Returns
string

Definition at line 302 of file FileRepo.php.

References $name, and $path.

Referenced by freeTemp(), and storeTemp().

◆ getZoneLocation()

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 385 of file FileRepo.php.

Referenced by getZonePath().

◆ getZonePath()

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 ForeignAPIRepo.

Definition at line 399 of file FileRepo.php.

References $base, and getZoneLocation().

Referenced by UploadStashFile\__construct(), cleanupBatch(), LocalRepo\cleanupDeletedBatch(), deleteBatch(), enumFilesInStorage(), getRootDirectory(), initZones(), publishBatch(), resolveVirtualUrl(), and storeBatch().

◆ getZoneUrl()

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|bool

Reimplemented in ForeignAPIRepo.

Definition at line 318 of file FileRepo.php.

References $ext, $thumbUrl, and $url.

Referenced by getInfo().

◆ hasSha1Storage()

FileRepo::hasSha1Storage ( )

Returns whether or not storage is SHA-1 based.

Returns
bool

Definition at line 2016 of file FileRepo.php.

References $hasSha1Storage.

Referenced by LocalRepo\__construct(), LocalRepo\cleanupDeletedBatch(), LocalFile\publishTo(), and LocalRepo\skipWriteOperationIfSha1().

◆ initDirectory()

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

Definition at line 1403 of file FileRepo.php.

References $path, newGood(), resolveToStoragePathIfVirtual(), FileBackend\splitStoragePath(), and true.

Referenced by deleteBatch(), publishBatch(), quickImportBatch(), and storeBatch().

◆ initZones()

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

Check if a single zone or list of zones is defined for usage.

Parameters
string[] | string$doZonesOnly do a particular zones
Exceptions
MWException
Returns
Status

Definition at line 272 of file FileRepo.php.

References getZonePath(), and newGood().

Referenced by deleteBatch(), and publishBatch().

◆ invalidateImageRedirect()

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 LocalRepo.

Definition at line 1850 of file FileRepo.php.

◆ isLocal()

FileRepo::isLocal ( )

Returns true if this the local file repository.

Returns
bool

Definition at line 1890 of file FileRepo.php.

References getName().

Referenced by getDisplayName(), and getInfo().

◆ isVirtualUrl()

static FileRepo::isVirtualUrl (   $url)
static

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

Parameters
string$url
Returns
bool

Definition at line 290 of file FileRepo.php.

References $url.

Referenced by UploadStashFile\__construct(), RepoGroup\getFileProps(), UploadBase\getRealPath(), LocalFile\publishTo(), and LocalFile\upload().

◆ makeUrl()

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

Make an url to this repo.

Parameters
string | string[]$queryQuery string to append
string$entryEntry point; defaults to index
Returns
string|bool False on failure

Definition at line 810 of file FileRepo.php.

References wfAppendQuery().

Referenced by getDescriptionRenderUrl(), getDescriptionStylesheetUrl(), getDescriptionUrl(), and ForeignAPIRepo\httpGetCached().

◆ nameForThumb()

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 1876 of file FileRepo.php.

References $ext, $name, and FileBackend\extensionFromPath().

◆ newFatal()

FileRepo::newFatal (   $message,
  $parameters 
)

Create a new fatal error.

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

Definition at line 1811 of file FileRepo.php.

References getErrorCleanupFunction(), and StatusValue\newFatal().

Referenced by deleteBatch(), publishBatch(), and storeBatch().

◆ newFile()

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

Create a new File object from the local repository.

Parameters
PageIdentity | LinkTarget | string$title
bool | string$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 ForeignAPIRepo.

Definition at line 423 of file FileRepo.php.

References $title, and File\normalizeTitle().

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

◆ newGood()

FileRepo::newGood (   $value = null)

◆ paranoidClean()

FileRepo::paranoidClean (   $param)

Path disclosure protection function.

Parameters
string$param
Returns
string

Definition at line 1790 of file FileRepo.php.

◆ passThrough()

FileRepo::passThrough (   $param)

Path disclosure protection function.

Parameters
string$param
Returns
string

Definition at line 1800 of file FileRepo.php.

◆ publish()

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 LocalRepo.

Definition at line 1265 of file FileRepo.php.

References assertWritableRepo(), and publishBatch().

Referenced by LocalFile\publishTo().

◆ publishBatch()

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
Exceptions
MWException
Returns
Status

Reimplemented in LocalRepo.

Definition at line 1292 of file FileRepo.php.

References $backend, $file, assertWritableRepo(), DELETE_SOURCE, FileBackend\doOperations(), fileExists(), getZonePath(), initDirectory(), initZones(), FileBackend\isStoragePath(), newFatal(), newGood(), resolveToStoragePathIfVirtual(), true, and validateFilename().

Referenced by publish().

◆ quickCleanDir()

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 1129 of file FileRepo.php.

References newGood().

◆ quickImport()

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

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

This does no locking nor journaling 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 1055 of file FileRepo.php.

References quickImportBatch().

Referenced by LocalFile\publishTo(), and storeTemp().

◆ quickImportBatch()

FileRepo::quickImportBatch ( array  $triples)

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

This does no locking nor journaling 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 1073 of file FileRepo.php.

References initDirectory(), FileBackend\isStoragePath(), newGood(), and resolveToStoragePathIfVirtual().

Referenced by quickImport().

◆ quickPurge()

FileRepo::quickPurge (   $path)
final

Purge a file from the repo.

This does no locking nor journaling. 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 1118 of file FileRepo.php.

References $path, and quickPurgeBatch().

Referenced by freeTemp().

◆ quickPurgeBatch()

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 nor journaling and is intended for purging thumbnails.

Parameters
array$pathsList of virtual URLs or storage paths
Returns
Status

Definition at line 1145 of file FileRepo.php.

References $path, newGood(), resolveToStoragePathIfVirtual(), and true.

Referenced by concatenate(), and quickPurge().

◆ resolveToStoragePathIfVirtual()

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
Exceptions
MWException

Definition at line 1593 of file FileRepo.php.

References $path, and resolveVirtualUrl().

Referenced by cleanupBatch(), concatenate(), fileExistsBatch(), getFileSha1(), getFileSize(), getFileTimestamp(), getLocalCopy(), getLocalReference(), initDirectory(), publishBatch(), quickImportBatch(), quickPurgeBatch(), storeBatch(), and streamFileWithStatus().

◆ resolveVirtualUrl()

FileRepo::resolveVirtualUrl (   $url)

Get the backend storage path corresponding to a virtual URL.

Use this function wisely.

Parameters
string$url
Exceptions
MWException
Returns
string

Definition at line 359 of file FileRepo.php.

References $base, $url, and getZonePath().

Referenced by UploadStashFile\__construct(), and resolveToStoragePathIfVirtual().

◆ store()

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 LocalRepo.

Definition at line 916 of file FileRepo.php.

References assertWritableRepo(), and storeBatch().

◆ storeBatch()

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
Exceptions
MWException
Returns
Status

Reimplemented in LocalRepo.

Definition at line 941 of file FileRepo.php.

References $backend, assertWritableRepo(), FileBackend\doOperations(), getZonePath(), initDirectory(), FileBackend\isStoragePath(), newFatal(), newGood(), OVERWRITE, resolveToStoragePathIfVirtual(), true, validateFilename(), and wfDebug().

Referenced by store().

◆ storeTemp()

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 1170 of file FileRepo.php.

References assertWritableRepo(), getHashPath(), MWTimestamp\getInstance(), getVirtualUrl(), and quickImport().

◆ streamFileWithStatus()

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 1692 of file FileRepo.php.

References $path, newGood(), and resolveToStoragePathIfVirtual().

◆ supportsSha1URLs()

FileRepo::supportsSha1URLs ( )

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

Returns
bool

Definition at line 2024 of file FileRepo.php.

References $supportsSha1URLs.

Referenced by __construct().

◆ validateFilename()

FileRepo::validateFilename (   $filename)

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

not blank or involving directory traveral

Parameters
string$filename
Returns
bool

Definition at line 1759 of file FileRepo.php.

References FileBackend\isPathTraversalFree().

Referenced by UploadStashFile\__construct(), deleteBatch(), ForeignAPIRepo\getThumbUrlFromCache(), publishBatch(), and storeBatch().

Member Data Documentation

◆ $abbrvThreshold

int 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 124 of file FileRepo.php.

◆ $articleUrl

string FileRepo::$articleUrl
protected

Equivalent to $wgArticlePath, e.g.

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

Definition at line 92 of file FileRepo.php.

◆ $backend

◆ $deletedHashLevels

int FileRepo::$deletedHashLevels
protected

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

Definition at line 118 of file FileRepo.php.

Referenced by getDeletedHashPath().

◆ $descBaseUrl

string FileRepo::$descBaseUrl
protected

URL of image description pages, e.g.

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

Definition at line 84 of file FileRepo.php.

◆ $descriptionCacheExpiry

int FileRepo::$descriptionCacheExpiry

Definition at line 59 of file FileRepo.php.

◆ $disableLocalTransform

bool FileRepo::$disableLocalTransform = false
protected

Disable local image scaling.

Definition at line 149 of file FileRepo.php.

Referenced by canTransformLocally().

◆ $favicon

string FileRepo::$favicon
protected

The URL of the repo's favicon, if any.

Definition at line 127 of file FileRepo.php.

◆ $fetchDescription

bool FileRepo::$fetchDescription

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

Definition at line 56 of file FileRepo.php.

◆ $fileFactory

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

Override these in the base class.

Definition at line 133 of file FileRepo.php.

◆ $fileFactoryKey

callable false FileRepo::$fileFactoryKey = false
protected

Override these in the base class.

Definition at line 137 of file FileRepo.php.

◆ $hashLevels

int FileRepo::$hashLevels
protected

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

Definition at line 115 of file FileRepo.php.

Referenced by __construct(), enumFilesInStorage(), and getHashLevels().

◆ $hasSha1Storage

bool FileRepo::$hasSha1Storage = false
protected

Definition at line 62 of file FileRepo.php.

Referenced by hasSha1Storage().

◆ $initialCapital

bool 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 99 of file FileRepo.php.

◆ $isPrivate

bool FileRepo::$isPrivate
protected

Whether all zones should be private (e.g.

private wiki repo)

Definition at line 130 of file FileRepo.php.

◆ $name

◆ $oldFileFactory

callable false FileRepo::$oldFileFactory = false
protected

Override these in the base class.

Definition at line 135 of file FileRepo.php.

◆ $oldFileFactoryKey

callable false FileRepo::$oldFileFactoryKey = false
protected

Override these in the base class.

Definition at line 139 of file FileRepo.php.

◆ $pathDisclosureProtection

string 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 106 of file FileRepo.php.

◆ $scriptDirUrl

string FileRepo::$scriptDirUrl
protected

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

https://en.wikipedia.org/w

Definition at line 89 of file FileRepo.php.

◆ $supportsSha1URLs

bool FileRepo::$supportsSha1URLs = false
protected

Definition at line 65 of file FileRepo.php.

Referenced by supportsSha1URLs().

◆ $thumbProxySecret

string FileRepo::$thumbProxySecret
protected

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

Definition at line 146 of file FileRepo.php.

Referenced by getThumbProxySecret().

◆ $thumbProxyUrl

string 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 144 of file FileRepo.php.

Referenced by getThumbProxyUrl().

◆ $thumbScriptUrl

string FileRepo::$thumbScriptUrl
protected

URL of thumb.php.

Definition at line 74 of file FileRepo.php.

Referenced by getThumbScriptUrl().

◆ $thumbUrl

string FileRepo::$thumbUrl
protected

The base thumbnail URL.

Defaults to "<url>/thumb".

Definition at line 112 of file FileRepo.php.

Referenced by getZoneUrl(), and ForeignAPIRepo\getZoneUrl().

◆ $transformVia404

bool FileRepo::$transformVia404
protected

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

Definition at line 79 of file FileRepo.php.

Referenced by canTransformVia404().

◆ $url

string false FileRepo::$url
protected

◆ $wanCache

WANObjectCache FileRepo::$wanCache
protected

Definition at line 152 of file FileRepo.php.

◆ $zones

array FileRepo::$zones = []
protected

Map of zones to config.

Definition at line 71 of file FileRepo.php.

◆ DELETE_SOURCE

const FileRepo::DELETE_SOURCE = 1

◆ NAME_AND_TIME_ONLY

const FileRepo::NAME_AND_TIME_ONLY = 1

Definition at line 51 of file FileRepo.php.

Referenced by LocalRepo\findFiles().

◆ OVERWRITE

const FileRepo::OVERWRITE = 2

Definition at line 47 of file FileRepo.php.

Referenced by storeBatch().

◆ OVERWRITE_SAME

const FileRepo::OVERWRITE_SAME = 4

◆ SKIP_LOCKING

const FileRepo::SKIP_LOCKING = 8

Definition at line 49 of file FileRepo.php.


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