- Make variables protected. Only class that uses these is LuceneResult
and it's fine
- Don't bother constructing a new file object if we've already got
one in memory (we likely do)
Change-Id: I7973aff1e96297a2fea70392b765c93a8c884d52
/**
* @var Revision
*/
- var $mRevision = null;
- var $mImage = null;
+ protected $mRevision = null;
+
+ /**
+ * @var File
+ */
+ protected $mImage = null;
/**
* @var Title
*/
- var $mTitle;
+ protected $mTitle;
/**
* @var String
*/
- var $mText;
+ protected $mText;
/**
* Return a new SearchResult and initializes it with a title.
* @return Boolean
*/
function isBrokenTitle() {
- if ( is_null( $this->mTitle ) ) {
- return true;
- }
- return false;
+ return is_null( $this->mTitle );
}
/**
return $this->mTitle;
}
+ /**
+ * Get the file for this page, if one exists
+ * @return File|null
+ */
+ function getFile() {
+ return $this->mImage;
+ }
+
/**
* @return float|null if not supported
*/
// Include a thumbnail for media files...
if ( $t->getNamespace() == NS_FILE ) {
- $img = wfFindFile( $t );
+ $img = $result->getFile();
+ $img = $img ?: wfFindFile( $t );
if ( $img ) {
$thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
if ( $thumb ) {