MediaWiki
1.28.0
|
Prioritized list of file repositories. More...
Public Member Functions | |
__construct ($localInfo, $foreignInfo) | |
Construct a group of file repositories. More... | |
checkRedirect (Title $title) | |
Interface for FileRepo::checkRedirect() More... | |
clearCache (Title $title=null) | |
Clear RepoGroup process cache used for finding a file. More... | |
findBySha1 ($hash) | |
Find all instances of files with this key. More... | |
findBySha1s (array $hashes) | |
Find all instances of files with this keys. More... | |
findFile ($title, $options=[]) | |
Search repositories for an image. More... | |
findFileFromKey ($hash, $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 $inputItems, $flags=0) | |
Search repositories for many files at once. More... | |
forEachForeignRepo ($callback, $params=[]) | |
Call a function for each foreign repo, with the repo object as the first parameter. More... | |
getFileProps ($fileName) | |
getLocalRepo () | |
Get the local repository, i.e. More... | |
getRepo ($index) | |
Get the repo instance with a given key. More... | |
getRepoByName ($name) | |
Get the repo instance by its name. More... | |
hasForeignRepos () | |
Does the installation have any foreign repos set up? More... | |
initialiseRepos () | |
Initialise the $repos array. More... | |
splitVirtualUrl ($url) | |
Split a virtual URL into repo, zone and rel parts. More... | |
Static Public Member Functions | |
static | destroySingleton () |
Destroy the singleton instance, so that a new one will be created next time singleton() is called. More... | |
static | setSingleton ($instance) |
Set the singleton instance to a given object Used by extensions which hook into the Repo chain. More... | |
static | singleton () |
Get a RepoGroup instance. More... | |
Public Attributes | |
const | MAX_CACHE_SIZE = 500 |
Maximum number of cache items. More... | |
Protected Member Functions | |
newRepo ($info) | |
Create a repo class based on an info structure. More... | |
Protected Attributes | |
ProcessCacheLRU | $cache |
array | $foreignInfo |
FileRepo[] | $foreignRepos |
array | $localInfo |
LocalRepo | $localRepo |
bool | $reposInitialised = false |
Static Protected Attributes | |
static RepoGroup | $instance |
Prioritized list of file repositories.
Definition at line 29 of file RepoGroup.php.
RepoGroup::__construct | ( | $localInfo, | |
$foreignInfo | |||
) |
Construct a group of file repositories.
array | $localInfo | Associative array for local repo's info |
array | $foreignInfo | Array of repository info arrays. Each info array is an associative array with the 'class' member giving the class name. The entire array is passed to the repository constructor as the first parameter. |
Definition at line 98 of file RepoGroup.php.
References $foreignInfo, $localInfo, and cache.
RepoGroup::checkRedirect | ( | Title | $title | ) |
Interface for FileRepo::checkRedirect()
Title | $title |
Definition at line 227 of file RepoGroup.php.
References as, and initialiseRepos().
RepoGroup::clearCache | ( | Title | $title = null | ) |
|
static |
Destroy the singleton instance, so that a new one will be created next time singleton() is called.
Definition at line 73 of file RepoGroup.php.
Referenced by UploadFromUrlTestSuite\setUp(), RepoGroupTest\setUpForeignRepo(), ParserTestRunner\staticSetup(), UploadFromUrlTestSuite\tearDown(), RepoGroupTest\testForEachForeignRepoNone(), and RepoGroupTest\testHasForeignRepoNegative().
RepoGroup::findBySha1 | ( | $hash | ) |
Find all instances of files with this key.
string | $hash | Base 36 SHA-1 hash |
Definition at line 279 of file RepoGroup.php.
References as, and initialiseRepos().
RepoGroup::findBySha1s | ( | array | $hashes | ) |
Find all instances of files with this keys.
array | $hashes | Base 36 SHA-1 hashes |
Definition at line 299 of file RepoGroup.php.
References $files, as, and initialiseRepos().
RepoGroup::findFile | ( | $title, | |
$options = [] |
|||
) |
Search repositories for an image.
You can also use wfFindFile() to do this.
Title | string | $title | Title object or string |
array | $options | Associative array of options: time: requested time for an archived image, or false for the current version. An image object will be returned which was created at the specified time. ignoreRedirect: If true, do not follow file redirects private: If true, return restricted (deleted) files if the current user is allowed to view them. Otherwise, such files will not be found. latest: If true, load from the latest available data into File objects |
Definition at line 120 of file RepoGroup.php.
References $image, $options, $time, $title, as, cache, initialiseRepos(), and File\normalizeTitle().
RepoGroup::findFileFromKey | ( | $hash, | |
$options = [] |
|||
) |
Find an instance of the file with this key, created at the specified time Returns false if the file does not exist.
string | $hash | Base 36 SHA-1 hash |
array | $options | Option array, same as findFile() |
Definition at line 255 of file RepoGroup.php.
References $options, as, and initialiseRepos().
RepoGroup::findFiles | ( | array | $inputItems, |
$flags = 0 |
|||
) |
Search repositories for many files at once.
array | $inputItems | An 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
int | $flags | Supports:
|
Definition at line 192 of file RepoGroup.php.
References $flags, $image, $name, as, initialiseRepos(), and File\normalizeTitle().
RepoGroup::forEachForeignRepo | ( | $callback, | |
$params = [] |
|||
) |
Call a function for each foreign repo, with the repo object as the first parameter.
callable | $callback | The function to call |
array | $params | Optional additional parameters to pass to the function |
Definition at line 370 of file RepoGroup.php.
References $args, $params, as, and initialiseRepos().
RepoGroup::getFileProps | ( | $fileName | ) |
string | $fileName |
Definition at line 445 of file RepoGroup.php.
References getRepo(), FileRepo\isVirtualUrl(), list, MimeMagic\singleton(), and splitVirtualUrl().
RepoGroup::getLocalRepo | ( | ) |
Get the local repository, i.e.
the one corresponding to the local image table. Files are typically uploaded to the local repository.
Definition at line 358 of file RepoGroup.php.
References getRepo().
RepoGroup::getRepo | ( | $index | ) |
Get the repo instance with a given key.
string | int | $index |
Definition at line 321 of file RepoGroup.php.
References $localRepo, and initialiseRepos().
Referenced by getFileProps(), and getLocalRepo().
RepoGroup::getRepoByName | ( | $name | ) |
Get the repo instance by its name.
string | $name |
Definition at line 339 of file RepoGroup.php.
References $name, as, and initialiseRepos().
RepoGroup::hasForeignRepos | ( | ) |
Does the installation have any foreign repos set up?
Definition at line 388 of file RepoGroup.php.
References $foreignRepos, and initialiseRepos().
RepoGroup::initialiseRepos | ( | ) |
Initialise the $repos array.
Definition at line 398 of file RepoGroup.php.
Referenced by checkRedirect(), findBySha1(), findBySha1s(), findFile(), findFileFromKey(), findFiles(), forEachForeignRepo(), getRepo(), getRepoByName(), and hasForeignRepos().
|
protected |
Create a repo class based on an info structure.
array | $info |
Definition at line 416 of file RepoGroup.php.
Referenced by initialiseRepos().
|
static |
Set the singleton instance to a given object Used by extensions which hook into the Repo chain.
It's not enough to just create a superclass ... you have to get people to call into it even though all they know is RepoGroup::singleton()
RepoGroup | $instance |
Definition at line 85 of file RepoGroup.php.
References $instance.
Referenced by ParserTestRunner\staticSetup().
|
static |
Get a RepoGroup instance.
At present only one instance of RepoGroup is needed in a MediaWiki invocation, this may change in the future.
Definition at line 59 of file RepoGroup.php.
References $wgForeignFileRepos, $wgLocalFileRepo, and global.
Referenced by RevDelArchivedFileItem\__construct(), RevDelFileItem\__construct(), ApiQueryAllImages\__construct(), UploadFromChunks\__construct(), UploadFromStash\__construct(), ParserTestRunner\addArticle(), RevertAction\checkCanExecute(), UploadBase\checkWarnings(), ApiDelete\deleteFile(), ApiTestCaseUpload\deleteFileByContent(), ParserTestRunner\deleteFiles(), RevDelFileList\doPreCommitUpdates(), UploadBase\doStashFile(), MovePageForm\doSubmit(), ApiMove\execute(), ApiQueryStashImageInfo\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), CheckImages\execute(), DeleteArchivedFiles\execute(), UploadStashCleanup\execute(), RefreshFileHeaders\execute(), ApiQueryImageInfo\execute(), FileDeleteForm\execute(), SpecialUploadStash\execute(), RefreshImageMetadata\execute(), LocalFileRestoreBatch\execute(), Parser\fetchFileNoRegister(), ImageCleanup\filePath(), ImageListPager\formatValue(), UploadForm\getDescriptionSection(), FileDuplicateSearchPage\getDupes(), WikiFilePage\getDuplicates(), ApiQueryFileRepoInfo\getInitialisedRepoGroup(), UploadBase\getRealPath(), ImageBuilder\getRepo(), MigrateFileRepoLayout\getRepo(), UploadBase\getTitle(), WikiRevision\importUpload(), WantedFilesPage\likelyToHaveFalsePositives(), Linker\makeBrokenImageLinkObj(), MovePage\move(), WikiPage\onArticleDelete(), PurgeChangedFiles\purgeFromLogType(), ApiQueryDuplicateFiles\run(), EraseArchivedFile\scrubVersion(), DatabaseUpdater\setFileAccess(), ParserTestRunner\setupUploadBackend(), SpecialUndelete\showFile(), ParserTestRunner\teardownUploadBackend(), UploadStashTest\testBug29408(), RepoGroupTest\testForEachForeignRepo(), RepoGroupTest\testForEachForeignRepoNone(), RepoGroupTest\testHasForeignRepoNegative(), RepoGroupTest\testHasForeignRepoPositive(), SpecialUploadStash\tryClearStashedUploads(), SpecialRevisionDelete\tryShowFile(), WikiPage\updateRedirectOn(), ApiFileRevert\validateParameters(), wfExtractThumbRequestInfo(), wfStreamThumb(), and wfThumbHandle404().
RepoGroup::splitVirtualUrl | ( | $url | ) |
Split a virtual URL into repo, zone and rel parts.
string | $url |
MWException |
Definition at line 428 of file RepoGroup.php.
Referenced by getFileProps().
|
protected |
Definition at line 46 of file RepoGroup.php.
|
protected |
Definition at line 43 of file RepoGroup.php.
Referenced by __construct().
|
protected |
Definition at line 34 of file RepoGroup.php.
Referenced by hasForeignRepos().
|
staticprotected |
Definition at line 49 of file RepoGroup.php.
Referenced by setSingleton().
|
protected |
Definition at line 40 of file RepoGroup.php.
Referenced by __construct().
|
protected |
Definition at line 31 of file RepoGroup.php.
Referenced by getRepo().
|
protected |
Definition at line 37 of file RepoGroup.php.
const RepoGroup::MAX_CACHE_SIZE = 500 |
Maximum number of cache items.
Definition at line 52 of file RepoGroup.php.