diff options
Diffstat (limited to 'includes/filerepo/RepoGroup.php')
-rw-r--r-- | includes/filerepo/RepoGroup.php | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 1465400c..b9996941 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -1,14 +1,19 @@ <?php /** - * @defgroup FileRepo FileRepo + * Prioritized list of file repositories * * @file * @ingroup FileRepo */ /** - * @ingroup FileRepo + * @defgroup FileRepo FileRepo + */ + +/** * Prioritized list of file repositories + * + * @ingroup FileRepo */ class RepoGroup { var $localRepo, $foreignRepos, $reposInitialised = false; @@ -48,7 +53,9 @@ class RepoGroup { /** * Construct a group of file repositories. - * @param array $data Array of repository info arrays. + * + * @param $localInfo Associative array for local repo's info + * @param $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. @@ -62,7 +69,8 @@ class RepoGroup { /** * Search repositories for an image. * You can also use wfFindFile() to do this. - * @param mixed $title Title object or string + * + * @param $title Mixed: Title object or string * @param $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 @@ -92,10 +100,15 @@ class RepoGroup { } } + if ( $title->getNamespace() != NS_MEDIA && $title->getNamespace() != NS_FILE ) { + throw new MWException( __METHOD__ . ' recieved an Title object with incorrect namespace' ); + } + # Check the cache if ( empty( $options['ignoreRedirect'] ) && empty( $options['private'] ) - && empty( $options['bypassCache'] ) ) + && empty( $options['bypassCache'] ) + && $title->getNamespace() == NS_FILE ) { $useCache = true; $time = isset( $options['time'] ) ? $options['time'] : ''; @@ -224,7 +237,7 @@ class RepoGroup { if ( !$this->reposInitialised ) { $this->initialiseRepos(); } - foreach ( $this->foreignRepos as $key => $repo ) { + foreach ( $this->foreignRepos as $repo ) { if ( $repo->name == $name) return $repo; } @@ -243,8 +256,8 @@ class RepoGroup { * Call a function for each foreign repo, with the repo object as the * first parameter. * - * @param $callback callback The function to call - * @param $params array Optional additional parameters to pass to the function + * @param $callback Callback: the function to call + * @param $params Array: optional additional parameters to pass to the function */ function forEachForeignRepo( $callback, $params = array() ) { foreach( $this->foreignRepos as $repo ) { @@ -258,7 +271,7 @@ class RepoGroup { /** * Does the installation have any foreign repos set up? - * @return bool + * @return Boolean */ function hasForeignRepos() { return (bool)$this->foreignRepos; |