Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -134,6 +134,10 @@ |
135 | 135 | public function isLocal() { |
136 | 136 | return $this->img->isLocal(); |
137 | 137 | } |
| 138 | + |
| 139 | + public function getFile() { |
| 140 | + return $this->img; |
| 141 | + } |
138 | 142 | |
139 | 143 | /** |
140 | 144 | * Create the TOC |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -278,12 +278,13 @@ |
279 | 279 | |
280 | 280 | // Namespace might change when using redirects |
281 | 281 | // Check for redirects ... |
| 282 | + $file = $title->getNamespace() == NS_IMAGE ? $article->getFile() : null; |
282 | 283 | if( ( $action == 'view' || $action == 'render' ) // ... for actions that show content |
283 | 284 | && !$request->getVal( 'oldid' ) && // ... and are not old revisions |
284 | 285 | $request->getVal( 'redirect' ) != 'no' && // ... unless explicitly told not to |
285 | 286 | // ... and the article is not an image page with associated file |
286 | | - !( $title->getNamespace() == NS_IMAGE && wfFindFile( $title->getText(), false, |
287 | | - FileRepo::FIND_IGNORE_REDIRECT ) ) ) { // ... unless it is really an image redirect |
| 287 | + !( is_object( $file ) && $file->exists() && |
| 288 | + !$file->getRedirected() ) ) { // ... unless it is really an image redirect |
288 | 289 | |
289 | 290 | $dbr = wfGetDB( DB_SLAVE ); |
290 | 291 | $article->loadPageData( $article->pageDataFromTitle( $dbr, $title ) ); |
— | — | @@ -303,8 +304,8 @@ |
304 | 305 | $rarticle = self::articleFromTitle( $target ); |
305 | 306 | $rarticle->loadPageData( $rarticle->pageDataFromTitle( $dbr, $target ) ); |
306 | 307 | if ( $rarticle->getTitle()->exists() || |
307 | | - ( $title->getNamespace() == NS_IMAGE && |
308 | | - !$article->isLocal() ) ) { |
| 308 | + ( is_object( $file ) && |
| 309 | + !$file->isLocal() ) ) { |
309 | 310 | $rarticle->setRedirectedFrom( $title ); |
310 | 311 | $article = $rarticle; |
311 | 312 | $title = $target; |