MediaWiki
master
|
Prioritized list of file repositories. More...
Public Member Functions | |
__construct ( $localInfo, $foreignInfo, WANObjectCache $wanCache, MimeAnalyzer $mimeAnalyzer) | |
Construct a group of file repositories. More... | |
checkRedirect ( $title) | |
Interface for FileRepo::checkRedirect() More... | |
clearCache ( $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... | |
newCustomLocalRepo ( $info=[]) | |
Create a local repo with the specified option overrides. More... | |
Protected Member Functions | |
newRepo ( $info) | |
Create a repo class based on an info structure. More... | |
Protected Attributes | |
MapCacheLRU | $cache |
array | $foreignInfo |
FileRepo[] | $foreignRepos |
array | $localInfo |
LocalRepo | $localRepo |
bool | $reposInitialised = false |
WANObjectCache | $wanCache |
Private Member Functions | |
splitVirtualUrl ( $url) | |
Split a virtual URL into repo, zone and rel parts. More... | |
Private Attributes | |
MimeAnalyzer | $mimeAnalyzer |
const | MAX_CACHE_SIZE = 500 |
Maximum number of cache items. More... | |
Prioritized list of file repositories.
Definition at line 29 of file RepoGroup.php.
RepoGroup::__construct | ( | $localInfo, | |
$foreignInfo, | |||
WANObjectCache | $wanCache, | ||
MimeAnalyzer | $mimeAnalyzer | ||
) |
Construct a group of file repositories.
Do not call this – use MediaWikiServices::getRepoGroup.
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. |
WANObjectCache | $wanCache | |
MimeAnalyzer | $mimeAnalyzer |
Definition at line 69 of file RepoGroup.php.
References $foreignInfo, $localInfo, $mimeAnalyzer, and $wanCache.
RepoGroup::checkRedirect | ( | $title | ) |
Interface for FileRepo::checkRedirect()
PageIdentity | LinkTarget | string | $title |
Definition at line 209 of file RepoGroup.php.
References $title, initialiseRepos(), and File\normalizeTitle().
RepoGroup::clearCache | ( | $title = null | ) |
Clear RepoGroup process cache used for finding a file.
PageIdentity | string | null | $title | File page or file name, or null to clear all files |
Definition at line 459 of file RepoGroup.php.
References $title.
RepoGroup::findBySha1 | ( | $hash | ) |
Find all instances of files with this key.
string | $hash | Base 36 SHA-1 hash |
Definition at line 263 of file RepoGroup.php.
References initialiseRepos().
RepoGroup::findBySha1s | ( | array | $hashes | ) |
Find all instances of files with this keys.
string[] | $hashes | Base 36 SHA-1 hashes |
Definition at line 283 of file RepoGroup.php.
References $hashes, and initialiseRepos().
RepoGroup::findFile | ( | $title, | |
$options = [] |
|||
) |
Search repositories for an image.
PageIdentity | LinkTarget | string | $title | The file to find |
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 Authority object, return restricted (deleted) files if the performer is allowed to view them. Otherwise, such files will not be found. Authority is only accepted since 1.37, User was required before. latest: If true, load from the latest available data into File objects @phpcs:ignore Generic.Files.LineLength |
Definition at line 100 of file RepoGroup.php.
References $title, 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 239 of file RepoGroup.php.
References $file, 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 174 of file RepoGroup.php.
References 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 352 of file RepoGroup.php.
References initialiseRepos().
RepoGroup::getFileProps | ( | $fileName | ) |
string | $fileName |
Definition at line 439 of file RepoGroup.php.
References getRepo(), FileRepo\isVirtualUrl(), 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 339 of file RepoGroup.php.
References getRepo().
Referenced by ApiQueryAllImages\__construct(), ImageListPager\__construct(), SpecialUndelete\__construct(), and SpecialUploadStash\__construct().
RepoGroup::getRepo | ( | $index | ) |
Get the repo instance with a given key.
string | int | $index |
Definition at line 305 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 320 of file RepoGroup.php.
References initialiseRepos().
RepoGroup::hasForeignRepos | ( | ) |
Does the installation have any foreign repos set up?
Definition at line 369 of file RepoGroup.php.
References $foreignRepos, and initialiseRepos().
RepoGroup::initialiseRepos | ( | ) |
Initialise the $repos array.
Definition at line 379 of file RepoGroup.php.
References newRepo().
Referenced by checkRedirect(), findBySha1(), findBySha1s(), findFile(), findFileFromKey(), findFiles(), forEachForeignRepo(), getRepo(), getRepoByName(), and hasForeignRepos().
RepoGroup::newCustomLocalRepo | ( | $info = [] | ) |
Create a local repo with the specified option overrides.
array | $info |
Definition at line 398 of file RepoGroup.php.
References newRepo().
|
protected |
Create a repo class based on an info structure.
array | $info |
Definition at line 408 of file RepoGroup.php.
References $wanCache.
Referenced by initialiseRepos(), and newCustomLocalRepo().
|
private |
Split a virtual URL into repo, zone and rel parts.
string | $url |
MWException |
Definition at line 422 of file RepoGroup.php.
Referenced by getFileProps().
|
protected |
Definition at line 49 of file RepoGroup.php.
|
protected |
Definition at line 46 of file RepoGroup.php.
Referenced by __construct().
|
protected |
Definition at line 34 of file RepoGroup.php.
Referenced by hasForeignRepos().
|
protected |
Definition at line 43 of file RepoGroup.php.
Referenced by __construct().
|
protected |
Definition at line 31 of file RepoGroup.php.
Referenced by getRepo().
|
private |
Definition at line 55 of file RepoGroup.php.
Referenced by __construct().
|
protected |
Definition at line 40 of file RepoGroup.php.
|
protected |
Definition at line 37 of file RepoGroup.php.
Referenced by __construct(), and newRepo().
|
private |
Maximum number of cache items.
Definition at line 52 of file RepoGroup.php.