Clarify parameters to wfFindFile and wfLocalFile, and return caveat to the "This...
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 22 Jan 2010 19:48:10 +0000 (19:48 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 22 Jan 2010 19:48:10 +0000 (19:48 +0000)
includes/GlobalFunctions.php
includes/specials/SpecialListfiles.php

index 1383303..b8916c2 100644 (file)
@@ -2954,6 +2954,7 @@ function &wfGetLBFactory() {
 /**
  * Find a file.
  * Shortcut for RepoGroup::singleton()->findFile()
+ * @param $title Either a string or Title object
  * @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
@@ -2976,6 +2977,8 @@ function wfFindFile( $title, $options = array() ) {
 /**
  * Get an object referring to a locally registered file.
  * Returns a valid placeholder object if the file does not exist.
+ * @param $title Either a string or Title object
+ * @return File, or null if passed an invalid Title
  */
 function wfLocalFile( $title ) {
        return RepoGroup::singleton()->getLocalRepo()->newFile( $title );
index 7880097..463be89 100644 (file)
@@ -133,6 +133,10 @@ class ImageListPager extends TablePager {
                                $name = $this->mCurrentRow->img_name;
                                $link = $this->getSkin()->linkKnown( Title::makeTitle( NS_FILE, $name ), $value );
                                $image = wfLocalFile( $value );
+                               if( !$image ) {
+                                       wfDebug( __METHOD__ . " was passed a bogus title '$value'" );
+                                       return '';
+                               }
                                $url = $image->getURL();
                                $download = Xml::element('a', array( 'href' => $url ), $imgfile );
                                return "$link ($download)";