From b9b85843572bf283f48285001e276ba7e61b63f6 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 22 Feb 2009 13:37:51 +0100 Subject: updated to MediaWiki 1.14.0 --- includes/filerepo/RepoGroup.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'includes/filerepo/RepoGroup.php') diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 7cb837b3..2303f581 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -82,7 +82,7 @@ class RepoGroup { } return false; } - function findFiles( $titles, $flags = 0 ) { + function findFiles( $titles ) { if ( !$this->reposInitialised ) { $this->initialiseRepos(); } @@ -90,11 +90,12 @@ class RepoGroup { $titleObjs = array(); foreach ( $titles as $title ) { if ( !( $title instanceof Title ) ) - $title = Title::makeTitleSafe( NS_IMAGE, $title ); - $titleObjs[$title->getDBkey()] = $title; + $title = Title::makeTitleSafe( NS_FILE, $title ); + if ( $title ) + $titleObjs[$title->getDBkey()] = $title; } - $images = $this->localRepo->findFiles( $titleObjs, $flags ); + $images = $this->localRepo->findFiles( $titleObjs ); foreach ( $this->foreignRepos as $repo ) { // Remove found files from $titleObjs @@ -102,7 +103,7 @@ class RepoGroup { if ( isset( $titleObjs[$name] ) ) unset( $titleObjs[$name] ); - $images = array_merge( $images, $repo->findFiles( $titleObjs, $flags ) ); + $images = array_merge( $images, $repo->findFiles( $titleObjs ) ); } return $images; } @@ -176,6 +177,13 @@ class RepoGroup { return $this->getRepo( 'local' ); } + /** + * 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 + */ function forEachForeignRepo( $callback, $params = array() ) { foreach( $this->foreignRepos as $repo ) { $args = array_merge( array( $repo ), $params ); @@ -186,8 +194,12 @@ class RepoGroup { return false; } + /** + * Does the installation have any foreign repos set up? + * @return bool + */ function hasForeignRepos() { - return !empty( $this->foreignRepos ); + return (bool)$this->foreignRepos; } /** -- cgit v1.2.3-54-g00ecf