MediaWiki
REL1_24
|
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=array()) | |
Search repositories for an image. | |
findFileFromKey ($hash, $options=array()) | |
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=array()) | |
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 | $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 92 of file RepoGroup.php.
RepoGroup::checkRedirect | ( | Title $ | title | ) |
Interface for FileRepo::checkRedirect()
Title | $title |
Definition at line 216 of file RepoGroup.php.
References as, and initialiseRepos().
RepoGroup::clearCache | ( | Title $ | title = null | ) |
Clear RepoGroup process cache used for finding a file.
Definition at line 452 of file RepoGroup.php.
static RepoGroup::destroySingleton | ( | ) | [static] |
Destroy the singleton instance, so that a new one will be created next time singleton() is called.
Definition at line 67 of file RepoGroup.php.
Referenced by UploadFromUrlTestSuite\setUp(), RepoGroupTest\setUpForeignRepo(), UploadFromUrlTestSuite\tearDown(), NewParserTest\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 268 of file RepoGroup.php.
RepoGroup::findBySha1s | ( | array $ | hashes | ) |
Find all instances of files with this keys.
array | $hashes | Base 36 SHA-1 hashes |
Definition at line 288 of file RepoGroup.php.
RepoGroup::findFile | ( | $ | title, |
$ | options = array() |
||
) |
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. bypassCache: If true, do not use the process-local cache of File objects |
Definition at line 114 of file RepoGroup.php.
RepoGroup::findFileFromKey | ( | $ | hash, |
$ | options = array() |
||
) |
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 244 of file RepoGroup.php.
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 = array( 'title' => $title, 'private' => true ); $findBatch = array( $findItem ); $repo->findFiles( $findBatch );
No title should appear in $items twice, as the result use titles as keys
int | $flags | Supports:
|
Definition at line 181 of file RepoGroup.php.
RepoGroup::forEachForeignRepo | ( | $ | callback, |
$ | params = array() |
||
) |
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 359 of file RepoGroup.php.
RepoGroup::getFileProps | ( | $ | fileName | ) |
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 347 of file RepoGroup.php.
RepoGroup::getRepo | ( | $ | index | ) |
Get the repo instance with a given key.
string | int | $index |
Definition at line 310 of file RepoGroup.php.
References initialiseRepos().
RepoGroup::getRepoByName | ( | $ | name | ) |
Get the repo instance by its name.
string | $name |
Definition at line 328 of file RepoGroup.php.
References $name, as, and initialiseRepos().
Does the installation have any foreign repos set up?
Definition at line 377 of file RepoGroup.php.
Initialise the $repos array.
Definition at line 387 of file RepoGroup.php.
Referenced by checkRedirect(), getRepo(), and getRepoByName().
RepoGroup::newRepo | ( | $ | info | ) | [protected] |
Create a repo class based on an info structure.
array | $info |
Definition at line 405 of file RepoGroup.php.
static RepoGroup::setSingleton | ( | $ | instance | ) | [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 79 of file RepoGroup.php.
static RepoGroup::singleton | ( | ) | [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 53 of file RepoGroup.php.
References $instance, and global.
Referenced by RevDelFileItem\__construct(), ApiQueryAllImages\__construct(), UploadFromStash\__construct(), SpecialUploadStash\__construct(), LocalFileRestoreBatch\addIds(), RevertAction\checkCanExecute(), UploadBase\checkWarnings(), ApiDelete\deleteFile(), ApiTestCaseUpload\deleteFileByContent(), DeleteArchivedFilesImplementation\doDelete(), ApiMove\execute(), ApiQueryStashImageInfo\execute(), FindMissingFiles\execute(), CheckImages\execute(), RefreshFileHeaders\execute(), UploadStashCleanup\execute(), ApiQueryImageInfo\execute(), RefreshImageMetadata\execute(), Parser\fetchFileNoRegister(), ImageCleanup\filePath(), ImageListPager\formatValue(), UploadForm\getDescriptionSection(), ApiQueryFileRepoInfo\getInitialisedRepoGroup(), UploadBase\getRealPath(), UploadBase\getTitle(), WantedFilesPage\likelyToHaveFalsePositives(), Linker\makeBrokenImageLinkObj(), ApiQueryDuplicateFiles\run(), EraseArchivedFile\scrubVersion(), UploadBase\stashFile(), RepoGroupTest\testForEachForeignRepo(), RepoGroupTest\testForEachForeignRepoNone(), RepoGroupTest\testHasForeignRepoNegative(), RepoGroupTest\testHasForeignRepoPositive(), SpecialUploadStash\tryClearStashedUploads(), wfExtractThumbRequestInfo(), wfFindFile(), wfIsBadImage(), wfLocalFile(), wfStreamThumb(), and wfThumbHandle404().
RepoGroup::splitVirtualUrl | ( | $ | url | ) |
Split a virtual URL into repo, zone and rel parts.
string | $url |
MWException |
Definition at line 417 of file RepoGroup.php.
ProcessCacheLRU RepoGroup::$cache [protected] |
*
Definition at line 40 of file RepoGroup.php.
array RepoGroup::$foreignInfo [protected] |
*
Definition at line 38 of file RepoGroup.php.
FileRepo [] RepoGroup::$foreignRepos [protected] |
*
Definition at line 32 of file RepoGroup.php.
RepoGroup::$instance [static, protected] |
Definition at line 43 of file RepoGroup.php.
Referenced by singleton().
array RepoGroup::$localInfo [protected] |
*
Definition at line 36 of file RepoGroup.php.
LocalRepo RepoGroup::$localRepo [protected] |
*
Definition at line 30 of file RepoGroup.php.
bool RepoGroup::$reposInitialised = false [protected] |
*
Definition at line 34 of file RepoGroup.php.
const RepoGroup::MAX_CACHE_SIZE = 500 |
Maximum number of cache items.
Definition at line 46 of file RepoGroup.php.