MediaWiki REL1_33
|
Prioritized list of file repositories. More...
Public Member Functions | |
__construct ( $localInfo, $foreignInfo) | |
Construct a group of file repositories. | |
checkRedirect (Title $title) | |
Interface for FileRepo::checkRedirect() | |
clearCache (Title $title=null) | |
Clear RepoGroup process cache used for finding a file. | |
findBySha1 ( $hash) | |
Find all instances of files with this key. | |
findBySha1s (array $hashes) | |
Find all instances of files with this keys. | |
findFile ( $title, $options=[]) | |
Search repositories for an image. | |
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. | |
findFiles (array $inputItems, $flags=0) | |
Search repositories for many files at once. | |
forEachForeignRepo ( $callback, $params=[]) | |
Call a function for each foreign repo, with the repo object as the first parameter. | |
getFileProps ( $fileName) | |
getLocalRepo () | |
Get the local repository, i.e. | |
getRepo ( $index) | |
Get the repo instance with a given key. | |
getRepoByName ( $name) | |
Get the repo instance by its name. | |
hasForeignRepos () | |
Does the installation have any foreign repos set up? | |
initialiseRepos () | |
Initialise the $repos array. | |
splitVirtualUrl ( $url) | |
Split a virtual URL into repo, zone and rel parts. | |
Static Public Member Functions | |
static | destroySingleton () |
Destroy the singleton instance, so that a new one will be created next time singleton() is called. | |
static | setSingleton ( $instance) |
Set the singleton instance to a given object Used by extensions which hook into the Repo chain. | |
static | singleton () |
Get a RepoGroup instance. | |
Public Attributes | |
const | MAX_CACHE_SIZE = 500 |
Maximum number of cache items. | |
Protected Member Functions | |
newRepo ( $info) | |
Create a repo class based on an info structure. | |
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 31 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 101 of file RepoGroup.php.
References $foreignInfo, $localInfo, and cache.
RepoGroup::checkRedirect | ( | Title | $title | ) |
Interface for FileRepo::checkRedirect()
Title | $title |
Definition at line 231 of file RepoGroup.php.
References and(), and initialiseRepos().
|
static |
Destroy the singleton instance, so that a new one will be created next time singleton() is called.
Definition at line 76 of file RepoGroup.php.
Referenced by ContentSecurityPolicyTest\setUp(), 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 283 of file RepoGroup.php.
References $result, and(), and initialiseRepos().
RepoGroup::findBySha1s | ( | array | $hashes | ) |
Find all instances of files with this keys.
array | $hashes | Base 36 SHA-1 hashes |
Definition at line 303 of file RepoGroup.php.
References $hashes, $result, and(), 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 123 of file RepoGroup.php.
References $image, $options, and(), cache, false, 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 259 of file RepoGroup.php.
References $file, $options, 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 196 of file RepoGroup.php.
References $image, and(), 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 374 of file RepoGroup.php.
References $params, and initialiseRepos().
RepoGroup::getFileProps | ( | $fileName | ) |
string | $fileName |
Definition at line 451 of file RepoGroup.php.
References getRepo(), FileRepo\isVirtualUrl(), list, 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 359 of file RepoGroup.php.
References getRepo().
RepoGroup::getRepo | ( | $index | ) |
Get the repo instance with a given key.
string | int | $index |
Definition at line 325 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 340 of file RepoGroup.php.
References initialiseRepos().
RepoGroup::hasForeignRepos | ( | ) |
Does the installation have any foreign repos set up?
Definition at line 391 of file RepoGroup.php.
References $foreignRepos, and initialiseRepos().
RepoGroup::initialiseRepos | ( | ) |
Initialise the $repos array.
Definition at line 401 of file RepoGroup.php.
References newRepo().
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 419 of file RepoGroup.php.
References $cache.
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 88 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 61 of file RepoGroup.php.
References $instance, $wgForeignFileRepos, and $wgLocalFileRepo.
Referenced by RevDelArchivedFileItem\__construct(), UploadFromStash\__construct(), ApiQueryAllImages\__construct(), UploadFromChunks\__construct(), ParserTestRunner\addArticle(), UploadBase\checkAgainstExistingDupes(), RevertAction\checkCanExecute(), ApiDelete\deleteFile(), ApiUploadTestCase\deleteFileByContent(), ParserTestRunner\deleteFiles(), RevDelFileList\doPreCommitUpdates(), UploadBase\doStashFile(), MovePageForm\doSubmit(), SpecialUploadStash\execute(), ApiMove\execute(), ApiQueryImageInfo\execute(), ApiQueryStashImageInfo\execute(), FileDeleteForm\execute(), LocalFileRestoreBatch\execute(), CheckImages\execute(), CleanupUploadStash\execute(), DeleteArchivedFiles\execute(), FindMissingFiles\execute(), FindOrphanedFiles\execute(), RefreshFileHeaders\execute(), RefreshImageMetadata\execute(), Parser\fetchFileNoRegister(), CleanupImages\filePath(), ImageListPager\formatValue(), ContentSecurityPolicy\getAdditionalSelfUrls(), UploadForm\getDescriptionSection(), FileDuplicateSearchPage\getDupes(), WikiFilePage\getDuplicates(), ApiQueryFileRepoInfo\getInitialisedRepoGroup(), UploadBase\getRealPath(), MigrateFileRepoLayout\getRepo(), ImageBuilder\getRepo(), UploadBase\getTitle(), ImportableUploadRevisionImporter\import(), RevDelFileItem\initFile(), WantedFilesPage\likelyToHaveFalsePositives(), Linker\makeBrokenImageLinkObj(), MovePage\moveFile(), WikiPage\onArticleDelete(), PurgeChangedFiles\purgeFromLogType(), ApiQueryDuplicateFiles\run(), EraseArchivedFile\scrubVersion(), DatabaseUpdater\setFileAccess(), ParserTestRunner\setupUploadBackend(), SpecialUndelete\showFile(), ParserTestRunner\teardownUploadBackend(), RepoGroupTest\testForEachForeignRepo(), RepoGroupTest\testForEachForeignRepoNone(), RepoGroupTest\testHasForeignRepoNegative(), RepoGroupTest\testHasForeignRepoPositive(), UploadStashTest\testT31408(), SpecialUploadStash\tryClearStashedUploads(), SpecialRevisionDelete\tryShowFile(), WikiPage\updateRedirectOn(), ApiFileRevert\validateParameters(), wfExtractThumbRequestInfo(), wfFindFile(), wfLocalFile(), wfStreamThumb(), and wfThumbHandle404().
RepoGroup::splitVirtualUrl | ( | $url | ) |
Split a virtual URL into repo, zone and rel parts.
string | $url |
MWException |
Definition at line 434 of file RepoGroup.php.
References and().
Referenced by getFileProps().
|
protected |
Definition at line 48 of file RepoGroup.php.
Referenced by newRepo().
|
protected |
Definition at line 45 of file RepoGroup.php.
Referenced by __construct().
|
protected |
Definition at line 36 of file RepoGroup.php.
Referenced by hasForeignRepos().
|
staticprotected |
Definition at line 51 of file RepoGroup.php.
Referenced by setSingleton(), and singleton().
|
protected |
Definition at line 42 of file RepoGroup.php.
Referenced by __construct().
|
protected |
Definition at line 33 of file RepoGroup.php.
Referenced by getRepo().
|
protected |
Definition at line 39 of file RepoGroup.php.
const RepoGroup::MAX_CACHE_SIZE = 500 |
Maximum number of cache items.
Definition at line 54 of file RepoGroup.php.