diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2008-03-21 11:49:34 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2008-03-21 11:49:34 +0100 |
commit | 086ae52d12011746a75f5588e877347bc0457352 (patch) | |
tree | e73263c7a29d0f94fafb874562610e16eb292ba8 /includes/filerepo/RepoGroup.php | |
parent | 749e7fb2bae7bbda855de3c9e319435b9f698ff7 (diff) |
Update auf MediaWiki 1.12.0
Diffstat (limited to 'includes/filerepo/RepoGroup.php')
-rw-r--r-- | includes/filerepo/RepoGroup.php | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 23d222af..b0e1d782 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -32,6 +32,13 @@ class RepoGroup { } /** + * Set the singleton instance to a given object + */ + static function setSingleton( $instance ) { + self::$instance = $instance; + } + + /** * Construct a group of file repositories. * @param array $data Array of repository info arrays. * Each info array is an associative array with the 'class' member @@ -47,8 +54,8 @@ class RepoGroup { * Search repositories for an image. * You can also use wfGetFile() to do this. * @param mixed $title Title object or string - * @param mixed $time The 14-char timestamp before which the file should - * have been uploaded, or false for the current version + * @param mixed $time The 14-char timestamp the file should have + * been uploaded, or false for the current version * @return File object or false if it is not found */ function findFile( $title, $time = false ) { @@ -70,13 +77,34 @@ class RepoGroup { } /** + * Interface for FileRepo::checkRedirect() + */ + function checkRedirect( $title ) { + if ( !$this->reposInitialised ) { + $this->initialiseRepos(); + } + + $redir = $this->localRepo->checkRedirect( $title ); + if( $redir ) { + return $redir; + } + foreach ( $this->foreignRepos as $repo ) { + $redir = $repo->checkRedirect( $title ); + if ( $redir ) { + return $redir; + } + } + return false; + } + + /** * Get the repo instance with a given key. */ function getRepo( $index ) { if ( !$this->reposInitialised ) { $this->initialiseRepos(); } - if ( $index == 'local' ) { + if ( $index === 'local' ) { return $this->localRepo; } elseif ( isset( $this->foreignRepos[$index] ) ) { return $this->foreignRepos[$index]; @@ -84,6 +112,19 @@ class RepoGroup { return false; } } + /** + * Get the repo instance by its name + */ + function getRepoByName( $name ) { + if ( !$this->reposInitialised ) { + $this->initialiseRepos(); + } + foreach ( $this->foreignRepos as $key => $repo ) { + if ( $repo->name == $name) + return $repo; + } + return false; + } /** * Get the local repository, i.e. the one corresponding to the local image |