MediaWiki  REL1_19
RepoGroup Class Reference

Prioritized list of file repositories. More...

List of all members.

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.
 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 ($inputItems)
 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

 $cache
 $foreignInfo
 $foreignRepos
 $localInfo
 $localRepo
 $reposInitialised = false
const MAX_CACHE_SIZE = 1000

Protected Member Functions

 newRepo ($info)
 Create a repo class based on an info structure.
 trimCache ()
 Limit cache memory.

Static Protected Attributes

static $instance

Detailed Description

Prioritized list of file repositories.

Definition at line 14 of file RepoGroup.php.


Constructor & Destructor Documentation

RepoGroup::__construct ( localInfo,
foreignInfo 
)

Construct a group of file repositories.

Parameters:
$localInfoAssociative array for local repo's info
$foreignInfoArray 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 74 of file RepoGroup.php.

References $foreignInfo, and $localInfo.


Member Function Documentation

Interface for FileRepo::checkRedirect()

Definition at line 193 of file RepoGroup.php.

References initialiseRepos().

Here is the call graph for this function:

RepoGroup::clearCache ( Title title = null)

Clear RepoGroup process cache used for finding a file.

Parameters:
$titleTitle|null Title of the file or null to clear all files

Definition at line 385 of file RepoGroup.php.

References $title.

static RepoGroup::destroySingleton ( ) [static]

Destroy the singleton instance, so that a new one will be created next time singleton() is called.

Definition at line 49 of file RepoGroup.php.

Referenced by UploadFromUrlTestSuite\setUp(), NewParserTest\setupGlobals(), UploadFromUrlTestSuite\tearDown(), NewParserTest\tearDown(), NewParserTest\teardownGlobals(), and ParserTest\teardownGlobals().

Here is the caller graph for this function:

RepoGroup::findBySha1 ( hash)

Find all instances of files with this key.

Parameters:
$hashString base 36 SHA-1 hash
Returns:
Array of File objects

Definition at line 240 of file RepoGroup.php.

References $result, and initialiseRepos().

Here is the call graph for this function:

RepoGroup::findFile ( title,
options = array() 
)

Search repositories for an image.

You can also use wfFindFile() to do this.

Parameters:
$titleTitle|string Title object or string
$optionsarray 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

Returns:
File object or false if it is not found

Definition at line 99 of file RepoGroup.php.

References $options, $title, initialiseRepos(), File\normalizeTitle(), trimCache(), and wfDebug().

Here is the call graph for this function:

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.

Parameters:
$hashString base 36 SHA-1 hash
$optionsOption array, same as findFile()
Returns:
File object or false if it is not found

Definition at line 219 of file RepoGroup.php.

References $file, $options, and initialiseRepos().

Here is the call graph for this function:

RepoGroup::findFiles ( inputItems)

Definition at line 161 of file RepoGroup.php.

References initialiseRepos(), and File\normalizeTitle().

Here is the call graph for this function:

RepoGroup::forEachForeignRepo ( callback,
params = array() 
)

Call a function for each foreign repo, with the repo object as the first parameter.

Parameters:
$callbackCallback: the function to call
$paramsArray: optional additional parameters to pass to the function

Definition at line 298 of file RepoGroup.php.

RepoGroup::getFileProps ( fileName)

Definition at line 356 of file RepoGroup.php.

References FSFile\getPropsFromPath(), getRepo(), FileRepo\isVirtualUrl(), and splitVirtualUrl().

Here is the call graph for this function:

Get the local repository, i.e.

the one corresponding to the local image table. Files are typically uploaded to the local repository.

Returns:
LocalRepo

Definition at line 287 of file RepoGroup.php.

References getRepo().

Here is the call graph for this function:

RepoGroup::getRepo ( index)

Get the repo instance with a given key.

Definition at line 255 of file RepoGroup.php.

References initialiseRepos().

Referenced by getFileProps(), and getLocalRepo().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the repo instance by its name.

Definition at line 270 of file RepoGroup.php.

References initialiseRepos().

Here is the call graph for this function:

Does the installation have any foreign repos set up?

Returns:
Boolean

Definition at line 312 of file RepoGroup.php.

Initialise the $repos array.

Definition at line 319 of file RepoGroup.php.

References newRepo().

Referenced by checkRedirect(), findBySha1(), findFile(), findFileFromKey(), findFiles(), getRepo(), and getRepoByName().

Here is the call graph for this function:

Here is the caller graph for this function:

RepoGroup::newRepo ( info) [protected]

Create a repo class based on an info structure.

Definition at line 335 of file RepoGroup.php.

Referenced by initialiseRepos().

Here is the caller graph for this function:

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()

Parameters:
$instanceRepoGroup

Definition at line 61 of file RepoGroup.php.

References $instance.

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.

Returns:
RepoGroup

Definition at line 36 of file RepoGroup.php.

References $instance, $wgForeignFileRepos, and $wgLocalFileRepo.

Referenced by UploadFromChunks\__construct(), UploadFromStash\__construct(), SpecialUploadStash\__construct(), ApiQueryAllimages\__construct(), RevDel_FileItem\__construct(), RevertFileAction\checkCanExecute(), UploadBase\checkWarnings(), ApiDelete\deleteFile(), ApiTestCaseUpload\deleteFileByContent(), NewParserTest\deleteFiles(), DeleteArchivedFilesImplementation\doDelete(), RevDel_FileList\doPreCommitUpdates(), MovePageForm\doSubmit(), CheckImages\execute(), ApiQueryStashImageInfo\execute(), ApiMove\execute(), UploadStashCleanup\execute(), FileDeleteForm\execute(), ApiQueryImageInfo\execute(), RefreshImageMetadata\execute(), LocalFileRestoreBatch\execute(), Parser\fetchFileAndTitle(), ImageCleanup\filePath(), UploadForm\getDescriptionSection(), FileDuplicateSearchPage\getDupes(), WikiFilePage\getDuplicates(), UploadBase\getRealPath(), ImageBuilder\getRepo(), WikiRevision\importUpload(), Linker\makeBrokenImageLinkObj(), Title\moveTo(), WikiPage\onArticleDelete(), PurgeDeletedFiles\purgeFromLogType(), UploadBase\saveTempUploadedFile(), NewParserTest\setupUploads(), SpecialUndelete\showFile(), UploadBase\stashFile(), UploadStashTest\testBug29408(), SpecialUploadStash\tryClearStashedUploads(), SpecialRevisionDelete\tryShowFile(), WikiPage\updateRedirectOn(), ApiFileRevert\validateParameters(), wfExtractThumbParams(), wfFindFile(), wfIsBadImage(), wfLocalFile(), and wfStreamThumb().

Here is the caller graph for this function:

Split a virtual URL into repo, zone and rel parts.

Returns:
an array containing repo, zone and rel

Definition at line 344 of file RepoGroup.php.

References $url.

Referenced by getFileProps().

Here is the caller graph for this function:

RepoGroup::trimCache ( ) [protected]

Limit cache memory.

Definition at line 372 of file RepoGroup.php.

References wfDebug().

Referenced by findFile().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

RepoGroup::$cache

Definition at line 23 of file RepoGroup.php.

RepoGroup::$foreignInfo

Definition at line 22 of file RepoGroup.php.

Referenced by __construct().

RepoGroup::$foreignRepos

Definition at line 21 of file RepoGroup.php.

RepoGroup::$instance [static, protected]

Definition at line 28 of file RepoGroup.php.

Referenced by setSingleton(), and singleton().

RepoGroup::$localInfo

Definition at line 22 of file RepoGroup.php.

Referenced by __construct().

RepoGroup::$localRepo

Definition at line 19 of file RepoGroup.php.

RepoGroup::$reposInitialised = false

Definition at line 21 of file RepoGroup.php.

Definition at line 29 of file RepoGroup.php.


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