r79725 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79724‎ | r79725 | r79726 >
Date:15:47, 6 January 2011
Author:reedy
Status:ok
Tags:
Comment:
Fixup my FIXME on r79708

Check inner array set, before doing count

Also add method documentation
Modified paths:
  • /trunk/phase3/includes/filerepo/ForeignAPIFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/ForeignAPIFile.php
@@ -21,7 +21,13 @@
2222 $this->mInfo = $info;
2323 $this->mExists = $exists;
2424 }
25 -
 25+
 26+ /**
 27+ * @static
 28+ * @param $title Title
 29+ * @param $repo ForeignApiRepo
 30+ * @return ForeignAPIFile|null
 31+ */
2632 static function newFromTitle( $title, $repo ) {
2733 $data = $repo->fetchImageQuery( array(
2834 'titles' => 'File:' . $title->getDBKey(),
@@ -31,7 +37,9 @@
3238 $info = $repo->getImageInfo( $data );
3339
3440 if( $info ) {
35 - $lastRedirect = count( $data['query']['redirects'] ) - 1;
 41+ $lastRedirect = isset( $data['query']['redirects'] )
 42+ ? count( $data['query']['redirects'] ) - 1
 43+ : -1;
3644 if( $lastRedirect >= 0 ) {
3745 $newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to']);
3846 $img = new ForeignAPIFile( $newtitle, $repo, $info, true );

Follow-up revisions

RevisionCommit summaryAuthorDate
r798151.17: MFT r78327, r78560, r79131, r79708, r79713, r79725, r79758, r79759, r79...catrope13:55, 7 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79708Fixup minor FIXME on r66724reedy03:21, 6 January 2011

Status & tagging log