Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3361,7 +3361,10 @@ |
3362 | 3362 | ); |
3363 | 3363 | break; |
3364 | 3364 | } |
3365 | | - $rev = $id ? Revision::newFromId( $id ) : Revision::newFromTitle( $title ); |
| 3365 | + # Get the revision |
| 3366 | + $rev = $id |
| 3367 | + ? Revision::newFromId( $id ) |
| 3368 | + : Revision::newFromTitle( $title ); |
3366 | 3369 | $rev_id = $rev ? $rev->getId() : 0; |
3367 | 3370 | # If there is no current revision, there is no page |
3368 | 3371 | if ( $id === false && !$rev ) { |
— | — | @@ -3373,6 +3376,13 @@ |
3374 | 3377 | 'title' => $title, |
3375 | 3378 | 'page_id' => $title->getArticleID(), |
3376 | 3379 | 'rev_id' => $rev_id ); |
| 3380 | + if ( $rev && !$title->equals( $rev->getTitle() ) ) { |
| 3381 | + # We fetched a rev from a different title; register it too... |
| 3382 | + $deps[] = array( |
| 3383 | + 'title' => $rev->getTitle(), |
| 3384 | + 'page_id' => $rev->getPage(), |
| 3385 | + 'rev_id' => $rev_id ); |
| 3386 | + } |
3377 | 3387 | |
3378 | 3388 | if ( $rev ) { |
3379 | 3389 | $text = $rev->getText(); |
— | — | @@ -3417,24 +3427,26 @@ |
3418 | 3428 | * @param Title $title |
3419 | 3429 | * @param string $time MW timestamp |
3420 | 3430 | * @param string $sha1 base 36 SHA-1 |
3421 | | - * @return Array ( File or false, Title ) |
| 3431 | + * @return Array ( File or false, Title of file ) |
3422 | 3432 | */ |
3423 | 3433 | function fetchFileAndTitle( $title, $time = false, $sha1 = false ) { |
3424 | 3434 | if ( $time === '0' ) { |
3425 | 3435 | $file = false; // broken thumbnail forced by hook |
3426 | 3436 | } elseif ( $sha1 ) { // get by (sha1,timestamp) |
3427 | 3437 | $file = RepoGroup::singleton()->findFileFromKey( $sha1, array( 'time' => $time ) ); |
3428 | | - if ( $file ) { |
3429 | | - $title = $file->getTitle(); // file title may not match $title |
3430 | | - } |
3431 | 3438 | } else { // get by (name,timestamp) |
3432 | 3439 | $file = wfFindFile( $title, array( 'time' => $time ) ); |
3433 | 3440 | } |
3434 | | - # Register the file as a dependancy |
3435 | 3441 | $time = $file ? $file->getTimestamp() : null; |
3436 | 3442 | $sha1 = $file ? $file->getSha1() : null; |
| 3443 | + # Register the file as a dependency... |
3437 | 3444 | $this->mOutput->addImage( $title->getDBkey(), $time, $sha1 ); |
3438 | | - |
| 3445 | + if ( $file && !$title->equals( $file->getTitle() ) ) { |
| 3446 | + # We fetched a rev from a different title; register it too... |
| 3447 | + $this->mOutput->addImage( $file->getTitle()->getDBkey(), $time, $sha1 ); |
| 3448 | + # Update fetched file title |
| 3449 | + $title = $file->getTitle(); |
| 3450 | + } |
3439 | 3451 | return array( $file, $title ); |
3440 | 3452 | } |
3441 | 3453 | |