BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
LocalRepo Class Reference
Inheritance diagram for LocalRepo:
Collaboration diagram for LocalRepo:

Public Member Functions

 __construct (array $info=null)
 
 newFileFromRow ($row)
 
 newFromArchiveName ($title, $archiveName)
 
 cleanupDeletedBatch (array $storageKeys)
 
 checkRedirect (Title $title)
 
 findFiles (array $items, $flags=0)
 
 findBySha1 ($hash)
 
 findBySha1s (array $hashes)
 
 findFilesByPrefix ($prefix, $limit)
 
 getReplicaDB ()
 
 getSlaveDB ()
 
 getMasterDB ()
 
 getSharedCacheKey ()
 
 invalidateImageRedirect (Title $title)
 
 getInfo ()
 
 store ($srcPath, $dstZone, $dstRel, $flags=0)
 
 storeBatch (array $triplets, $flags=0)
 
 cleanupBatch (array $files, $flags=0)
 
 publish ($src, $dstRel, $archiveRel, $flags=0, array $options=[])
 
 publishBatch (array $ntuples, $flags=0)
 
 delete ($srcRel, $archiveRel)
 
 deleteBatch (array $sourceDestPairs)
 
- Public Member Functions inherited from FileRepo
 __construct (array $info=null)
 
 getBackend ()
 
 getReadOnlyReason ()
 
 getVirtualUrl ($suffix=false)
 
 getZoneUrl ($zone, $ext=null)
 
 backendSupportsUnicodePaths ()
 
 resolveVirtualUrl ($url)
 
 getZonePath ($zone)
 
 newFile ($title, $time=false)
 
 findFile ($title, $options=[])
 
 findFiles (array $items, $flags=0)
 
 findFileFromKey ($sha1, $options=[])
 
 findBySha1 ($hash)
 
 findBySha1s (array $hashes)
 
 findFilesByPrefix ($prefix, $limit)
 
 getThumbScriptUrl ()
 
 getThumbProxyUrl ()
 
 getThumbProxySecret ()
 
 canTransformVia404 ()
 
 getNameFromTitle (Title $title)
 
 getRootDirectory ()
 
 getHashPath ($name)
 
 getTempHashPath ($suffix)
 
 getHashLevels ()
 
 getName ()
 
 makeUrl ($query= '', $entry= 'index')
 
 getDescriptionUrl ($name)
 
 getDescriptionRenderUrl ($name, $lang=null)
 
 getDescriptionStylesheetUrl ()
 
 store ($srcPath, $dstZone, $dstRel, $flags=0)
 
 storeBatch (array $triplets, $flags=0)
 
 cleanupBatch (array $files, $flags=0)
 
 quickImport ($src, $dst, $options=null)
 
 quickPurge ($path)
 
 quickCleanDir ($dir)
 
 quickImportBatch (array $triples)
 
 quickPurgeBatch (array $paths)
 
 storeTemp ($originalName, $srcPath)
 
 freeTemp ($virtualUrl)
 
 concatenate (array $srcPaths, $dstPath, $flags=0)
 
 publish ($src, $dstRel, $archiveRel, $flags=0, array $options=[])
 
 publishBatch (array $ntuples, $flags=0)
 
 cleanDir ($dir)
 
 fileExists ($file)
 
 fileExistsBatch (array $files)
 
 delete ($srcRel, $archiveRel)
 
 deleteBatch (array $sourceDestPairs)
 
 cleanupDeletedBatch (array $storageKeys)
 
 getDeletedHashPath ($key)
 
 getLocalCopy ($virtualUrl)
 
 getLocalReference ($virtualUrl)
 
 getFileProps ($virtualUrl)
 
 getFileTimestamp ($virtualUrl)
 
 getFileSize ($virtualUrl)
 
 getFileSha1 ($virtualUrl)
 
 streamFileWithStatus ($virtualUrl, $headers=[], $optHeaders=[])
 
 streamFile ($virtualUrl, $headers=[])
 
 enumFiles ($callback)
 
 validateFilename ($filename)
 
 getErrorCleanupFunction ()
 
 paranoidClean ($param)
 
 passThrough ($param)
 
 newFatal ($message)
 
 newGood ($value=null)
 
 checkRedirect (Title $title)
 
 invalidateImageRedirect (Title $title)
 
 getDisplayName ()
 
 nameForThumb ($name)
 
 isLocal ()
 
 getSharedCacheKey ()
 
 getLocalCacheKey ()
 
 getTempRepo ()
 
 getUploadStash (User $user=null)
 
 getInfo ()
 
 hasSha1Storage ()
 
 supportsSha1URLs ()
 

Static Public Member Functions

static getHashFromKey ($key)
 
- Static Public Member Functions inherited from FileRepo
static isVirtualUrl ($url)
 

Protected Member Functions

 deletedFileHasKey ($key, $lock=null)
 
 hiddenFileHasKey ($key, $lock=null)
 
 getDBFactory ()
 
 skipWriteOperationIfSha1 ($function, array $args)
 
- Protected Member Functions inherited from FileRepo
 initZones ($doZones=[])
 
 getZoneLocation ($zone)
 
 initDirectory ($dir)
 
 resolveToStoragePath ($path)
 
 enumFilesInStorage ($callback)
 
 assertWritableRepo ()
 

Protected Attributes

 $fileFactory = [ LocalFile::class, 'newFromTitle' ]
 
 $fileFactoryKey = [ LocalFile::class, 'newFromKey' ]
 
 $fileFromRowFactory = [ LocalFile::class, 'newFromRow' ]
 
 $oldFileFromRowFactory = [ OldLocalFile::class, 'newFromRow' ]
 
 $oldFileFactory = [ OldLocalFile::class, 'newFromTitle' ]
 
 $oldFileFactoryKey = [ OldLocalFile::class, 'newFromKey' ]
 
- Protected Attributes inherited from FileRepo
 $hasSha1Storage = false
 
 $supportsSha1URLs = false
 
 $backend
 
 $zones = []
 
 $thumbScriptUrl
 
 $transformVia404
 
 $descBaseUrl
 
 $scriptDirUrl
 
 $articleUrl
 
 $initialCapital
 
 $pathDisclosureProtection = 'simple'
 
 $url
 
 $thumbUrl
 
 $hashLevels
 
 $deletedHashLevels
 
 $abbrvThreshold
 
 $favicon
 
 $isPrivate
 
 $fileFactory = [ UnregisteredLocalFile::class, 'newFromTitle' ]
 
 $oldFileFactory = false
 
 $fileFactoryKey = false
 
 $oldFileFactoryKey = false
 
 $thumbProxyUrl
 
 $thumbProxySecret
 

Additional Inherited Members

- Public Attributes inherited from FileRepo
const DELETE_SOURCE = 1
 
const OVERWRITE = 2
 
const OVERWRITE_SAME = 4
 
const SKIP_LOCKING = 8
 
const NAME_AND_TIME_ONLY = 1
 
 $fetchDescription
 
 $descriptionCacheExpiry
 
- Static Protected Member Functions inherited from FileRepo
static getHashPathForLevel ($name, $levels)
 

Detailed Description

A repository that stores files in the local filesystem and registers them in the wiki's own database. This is the most commonly used repository class.

Member Function Documentation

LocalRepo::checkRedirect ( Title  $title)

Checks if there is a redirect named as $title

Parameters
Title$titleTitle of file
Returns
bool|Title
LocalRepo::cleanupDeletedBatch ( array  $storageKeys)

Delete files in the deleted directory if they are not referenced in the filearchive table. This needs to be done in the repo because it needs to interleave database locks with file operations, which is potentially a remote operation.

Parameters
string[]$storageKeys
Returns
Status
LocalRepo::deletedFileHasKey (   $key,
  $lock = null 
)
protected

Check if a deleted (filearchive) file has this sha1 key

Parameters
string$keyFile storage key (base-36 sha1 key with file extension)
string | null$lockUse "lock" to lock the row via FOR UPDATE
Returns
bool File with this key is in use
LocalRepo::findBySha1 (   $hash)

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

Parameters
string$hashA sha1 hash to look for
Returns
LocalFile[]
LocalRepo::findBySha1s ( array  $hashes)

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

Overrides generic implementation in FileRepo for performance reason

Parameters
string[]$hashes An array of hashes
Returns
array[] An Array of arrays or iterators of file objects and the hash as key
LocalRepo::findFilesByPrefix (   $prefix,
  $limit 
)

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

Parameters
string$prefixThe prefix to search for
int$limitThe maximum amount of files to return
Returns
LocalFile[]
LocalRepo::getDBFactory ( )
protected

Get a callback to get a DB handle given an index (DB_REPLICA/DB_MASTER)

Returns
Closure
static LocalRepo::getHashFromKey (   $key)
static

Gets the SHA1 hash from a storage key

Parameters
string$key
Returns
string
LocalRepo::getInfo ( )

Return information about the repository.

Returns
array
Since
1.22
LocalRepo::getMasterDB ( )

Get a connection to the master DB

Returns
IDatabase
LocalRepo::getReplicaDB ( )

Get a connection to the replica DB

Returns
IDatabase
LocalRepo::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
string
LocalRepo::getSlaveDB ( )

Alias for getReplicaDB()

Returns
IDatabase
Deprecated:
Since 1.29
LocalRepo::hiddenFileHasKey (   $key,
  $lock = null 
)
protected

Check if a hidden (revision delete) file has this sha1 key

Parameters
string$keyFile storage key (base-36 sha1 key with file extension)
string | null$lockUse "lock" to lock the row via FOR UPDATE
Returns
bool File with this key is in use
LocalRepo::invalidateImageRedirect ( Title  $title)

Invalidates image redirect cache related to that image

Parameters
Title$titleTitle of page
Returns
void
LocalRepo::newFileFromRow (   $row)
Exceptions
MWException
Parameters
stdClass$row
Returns
LocalFile
LocalRepo::newFromArchiveName (   $title,
  $archiveName 
)
Parameters
Title$title
string$archiveName
Returns
OldLocalFile
LocalRepo::skipWriteOperationIfSha1 (   $function,
array  $args 
)
protected

Skips the write operation if storage is sha1-based, executes it normally otherwise

Parameters
string$function
array$args
Returns
Status

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