MediaWiki REL1_30
ForeignDBViaLBRepo Class Reference

A foreign repository with a MediaWiki database accessible via the configured LBFactory. More...

Inheritance diagram for ForeignDBViaLBRepo:
Collaboration diagram for ForeignDBViaLBRepo:

Public Member Functions

 __construct ( $info)
 
 getInfo ()
 Return information about the repository.
 
 getMasterDB ()
 
 getReplicaDB ()
 
 getSharedCacheKey ()
 Get a key on the primary cache for this repository.
 
 hasSharedCache ()
 
- Public Member Functions inherited from LocalRepo
 __construct (array $info=null)
 
 checkRedirect (Title $title)
 Checks if there is a redirect named as $title.
 
 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.
 
 delete ( $srcRel, $archiveRel)
 Move a file to the deletion archive.
 
 deleteBatch (array $sourceDestPairs)
 Move a group of files to the deletion archive.
 
 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.
 
 findFiles (array $items, $flags=0)
 Find many files at once.
 
 findFilesByPrefix ( $prefix, $limit)
 Return an array of files where the name starts with $prefix.
 
 getSlaveDB ()
 Alias for getReplicaDB()
 
 invalidateImageRedirect (Title $title)
 Invalidates image redirect cache related to that image.
 
 newFileFromRow ( $row)
 
 newFromArchiveName ( $title, $archiveName)
 
 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.
 
 store ( $srcPath, $dstZone, $dstRel, $flags=0)
 Store a file to a given destination.
 
 storeBatch (array $triplets, $flags=0)
 Store a batch of files.
 
- Public Member Functions inherited from FileRepo
 backendSupportsUnicodePaths ()
 
 canTransformVia404 ()
 Returns true if the repository can transform files via a 404 handler.
 
 cleanDir ( $dir)
 Deletes a directory if empty.
 
 concatenate (array $srcPaths, $dstPath, $flags=0)
 Concatenate a list of temporary files into a target file location.
 
 enumFiles ( $callback)
 Call a callback function for every public regular file in the repository.
 
 fileExists ( $file)
 Checks existence of a a file.
 
 fileExistsBatch (array $files)
 Checks existence of an array of files.
 
 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.
 
 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.
 
 getErrorCleanupFunction ()
 Get a callback function to use for cleaning error message parameters.
 
 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.
 
 getLocalCacheKey ()
 Get a key for this repo in the local cache domain.
 
 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 $title)
 Get the name of a file from its title object.
 
 getReadOnlyReason ()
 Get an explanatory message if this repo is read-only.
 
 getRootDirectory ()
 Get the public zone root storage directory of the repository.
 
 getTempHashPath ( $suffix)
 Get a relative path including trailing slash, e.g.
 
 getTempRepo ()
 Get a temporary private FileRepo associated with this repo.
 
 getThumbScriptUrl ()
 Get the URL of thumb.php.
 
 getUploadStash (User $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.
 
 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)
 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.
 
 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.
 
 storeTemp ( $originalName, $srcPath)
 Pick a random name in the temp zone and store a file to it.
 
 streamFile ( $virtualUrl, $headers=[])
 Attempt to stream a file with the given virtual URL/storage path.
 
 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.
 

Protected Member Functions

 assertWritableRepo ()
 Throw an exception if this repo is read-only by design.
 
 getDBFactory ()
 
- Protected Member Functions inherited from LocalRepo
 deletedFileHasKey ( $key, $lock=null)
 Check if a deleted (filearchive) file has this sha1 key.
 
 hiddenFileHasKey ( $key, $lock=null)
 Check if a hidden (revision delete) file has this sha1 key.
 
 skipWriteOperationIfSha1 ( $function, array $args)
 Skips the write operation if storage is sha1-based, executes it normally otherwise.
 
- Protected Member Functions inherited from FileRepo
 enumFilesInStorage ( $callback)
 Call a callback function for every public file in the repository.
 
 getZoneLocation ( $zone)
 The the storage container and base path of a zone.
 
 initDirectory ( $dir)
 Creates a directory with the appropriate zone permissions.
 
 initZones ( $doZones=[])
 Check if a single zone or list of zones is defined for usage.
 
 resolveToStoragePath ( $path)
 If a path is a virtual URL, resolve it to a storage path.
 

Protected Attributes

string $dbName
 
array $fileFactory = [ 'ForeignDBFile', 'newFromTitle' ]
 
array $fileFromRowFactory = [ 'ForeignDBFile', 'newFromRow' ]
 
bool $hasSharedCache
 
string $tablePrefix
 
string $wiki
 
- Protected Attributes inherited from LocalRepo
callable $fileFactory = [ 'LocalFile', 'newFromTitle' ]
 
callable $fileFactoryKey = [ 'LocalFile', 'newFromKey' ]
 
callable $fileFromRowFactory = [ 'LocalFile', 'newFromRow' ]
 
callable $oldFileFactory = [ 'OldLocalFile', 'newFromTitle' ]
 
callable $oldFileFactoryKey = [ 'OldLocalFile', 'newFromKey' ]
 
callable $oldFileFromRowFactory = [ 'OldLocalFile', 'newFromRow' ]
 
- Protected Attributes inherited from FileRepo
int $abbrvThreshold
 File names over this size will use the short form of thumbnail names.
 
string $articleUrl
 Equivalent to $wgArticlePath, e.g.
 
FileBackend $backend
 
int $deletedHashLevels
 The number of directory levels for hash-based division of deleted files.
 
string $descBaseUrl
 URL of image description pages, e.g.
 
string $favicon
 The URL of the repo's favicon, if any.
 
array $fileFactory = [ 'UnregisteredLocalFile', 'newFromTitle' ]
 callable Override these in the base class
 
array $fileFactoryKey = false
 callable|bool 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.
 
array $oldFileFactory = false
 callable|bool Override these in the base class
 
array $oldFileFactoryKey = false
 callable|bool 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 $scriptDirUrl
 URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g.
 
string $scriptExtension
 Script extension of the MediaWiki installation, equivalent to the old $wgScriptExtension, e.g.
 
bool $supportsSha1URLs = false
 
string $thumbScriptUrl
 URL of thumb.php.
 
string $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.
 
array $zones = []
 Map of zones to config.
 

Additional Inherited Members

- Static Public Member Functions inherited from LocalRepo
static getHashFromKey ( $key)
 Gets the SHA1 hash from a storage key.
 
- Static Public Member Functions inherited from FileRepo
static isVirtualUrl ( $url)
 Determine if a string is an mwrepo:// URL.
 
- Public Attributes inherited from FileRepo
int $descriptionCacheExpiry
 
bool $fetchDescription
 Whether to fetch commons image description pages and display them on the local wiki.
 
const DELETE_SOURCE = 1
 
const NAME_AND_TIME_ONLY = 1
 
const OVERWRITE = 2
 
const OVERWRITE_SAME = 4
 
const SKIP_LOCKING = 8
 
- Static Protected Member Functions inherited from FileRepo
static getHashPathForLevel ( $name, $levels)
 

Detailed Description

A foreign repository with a MediaWiki database accessible via the configured LBFactory.

Definition at line 29 of file ForeignDBViaLBRepo.php.

Constructor & Destructor Documentation

◆ __construct()

ForeignDBViaLBRepo::__construct ( $info)
Parameters
array | null$info

Definition at line 51 of file ForeignDBViaLBRepo.php.

References hasSharedCache(), list, and wfSplitWikiID().

Member Function Documentation

◆ assertWritableRepo()

ForeignDBViaLBRepo::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 from FileRepo.

Definition at line 102 of file ForeignDBViaLBRepo.php.

◆ getDBFactory()

ForeignDBViaLBRepo::getDBFactory ( )
protected
Returns
Closure

Reimplemented from LocalRepo.

Definition at line 75 of file ForeignDBViaLBRepo.php.

References wfGetLB().

◆ getInfo()

ForeignDBViaLBRepo::getInfo ( )

Return information about the repository.

Returns
array
Since
1.22

Reimplemented from LocalRepo.

Definition at line 106 of file ForeignDBViaLBRepo.php.

References FileRepo\getInfo().

◆ getMasterDB()

ForeignDBViaLBRepo::getMasterDB ( )
Returns
IDatabase

Reimplemented from LocalRepo.

Definition at line 61 of file ForeignDBViaLBRepo.php.

References DB_MASTER, and wfGetLB().

◆ getReplicaDB()

ForeignDBViaLBRepo::getReplicaDB ( )
Returns
IDatabase

Reimplemented from LocalRepo.

Definition at line 68 of file ForeignDBViaLBRepo.php.

References DB_REPLICA, and wfGetLB().

◆ getSharedCacheKey()

ForeignDBViaLBRepo::getSharedCacheKey ( )

Get a key on the primary cache for this repository.

Returns false if the repository's cache is not accessible at this site. The parameters are the parts of the key, as for wfMemcKey().

Returns
bool|string

Reimplemented from LocalRepo.

Definition at line 91 of file ForeignDBViaLBRepo.php.

References $args, and hasSharedCache().

◆ hasSharedCache()

ForeignDBViaLBRepo::hasSharedCache ( )

Definition at line 81 of file ForeignDBViaLBRepo.php.

References $hasSharedCache.

Referenced by __construct(), and getSharedCacheKey().

Member Data Documentation

◆ $dbName

string ForeignDBViaLBRepo::$dbName
protected

Definition at line 34 of file ForeignDBViaLBRepo.php.

◆ $fileFactory

array ForeignDBViaLBRepo::$fileFactory = [ 'ForeignDBFile', 'newFromTitle' ]
protected

Definition at line 40 of file ForeignDBViaLBRepo.php.

◆ $fileFromRowFactory

array ForeignDBViaLBRepo::$fileFromRowFactory = [ 'ForeignDBFile', 'newFromRow' ]
protected

Definition at line 43 of file ForeignDBViaLBRepo.php.

◆ $hasSharedCache

bool ForeignDBViaLBRepo::$hasSharedCache
protected

Definition at line 46 of file ForeignDBViaLBRepo.php.

Referenced by hasSharedCache().

◆ $tablePrefix

string ForeignDBViaLBRepo::$tablePrefix
protected

Definition at line 37 of file ForeignDBViaLBRepo.php.

◆ $wiki

string ForeignDBViaLBRepo::$wiki
protected

Definition at line 31 of file ForeignDBViaLBRepo.php.


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