Follow-up r88054: register the file if a hook changed the target file.
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 9 Jul 2011 10:31:09 +0000 (10:31 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 9 Jul 2011 10:31:09 +0000 (10:31 +0000)
includes/parser/Parser.php

index 6227ac3..6cf9bbc 100644 (file)
@@ -3554,6 +3554,12 @@ class Parser {
                if ( $file && !$title->equals( $file->getTitle() ) ) {
                        # Update fetched file title
                        $title = $file->getTitle();
+                       if ( is_null( $file->getRedirectedTitle() ) ) {
+                               # This file was not a redirect, but the title does not match.
+                               # Register under the new name because otherwise the link will
+                               # get lost.
+                               $this->mOutput->addImage( $title->getDBkey(), $time, $sha1 );
+                       }
                }
                return array( $file, $title );
        }