Index: trunk/phase3/includes/filerepo/FileRepo.php |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | /** |
48 | 48 | * Create a new File object from the local repository |
49 | 49 | * @param mixed $title Title object or string |
50 | | - * @param mixed $time Time at which the image is supposed to have existed. |
| 50 | + * @param mixed $time Time at which the image was uploaded. |
51 | 51 | * If this is specified, the returned object will be an |
52 | 52 | * instance of the repository's old file class instead of |
53 | 53 | * a current file. Repositories not supporting version |
— | — | @@ -72,12 +72,19 @@ |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Find an instance of the named file created at the specified time |
76 | | - * Returns false if the file did not exist. Repositories not supporting |
| 76 | + * Returns false if the file does not exist. Repositories not supporting |
77 | 77 | * version control should return false if the time is specified. |
78 | 78 | * |
| 79 | + * @param mixed $title Title object or string |
79 | 80 | * @param mixed $time 14-character timestamp, or false for the current version |
80 | 81 | */ |
81 | 82 | function findFile( $title, $time = false, $flags = 0 ) { |
| 83 | + if ( !($title instanceof Title) ) { |
| 84 | + $title = Title::makeTitleSafe( NS_IMAGE, $title ); |
| 85 | + if ( !is_object( $title ) ) { |
| 86 | + return false; |
| 87 | + } |
| 88 | + } |
82 | 89 | # First try the current version of the file to see if it precedes the timestamp |
83 | 90 | $img = $this->newFile( $title ); |
84 | 91 | if ( !$img ) { |
Index: trunk/phase3/includes/filerepo/LocalRepo.php |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | * Function link Title::getArticleID(). |
76 | 76 | * We can't say Title object, what database it should use, so we duplicate that function here. |
77 | 77 | */ |
78 | | - private function getArticleID( $title ) { |
| 78 | + protected function getArticleID( $title ) { |
79 | 79 | if( !$title instanceof Title ) { |
80 | 80 | return 0; |
81 | 81 | } |
— | — | @@ -92,6 +92,11 @@ |
93 | 93 | } |
94 | 94 | |
95 | 95 | function checkRedirect( $title ) { |
| 96 | + global $wgFileRedirects; |
| 97 | + if( !$wgFileRedirects ) { |
| 98 | + return false; |
| 99 | + } |
| 100 | + |
96 | 101 | if( $title instanceof Title && $title->getNamespace() == NS_MEDIA ) { |
97 | 102 | $title = Title::makeTitle( NS_IMAGE, $title->getText() ); |
98 | 103 | } |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -461,6 +461,11 @@ |
462 | 462 | */ |
463 | 463 | $wgRepositoryBaseUrl = "http://commons.wikimedia.org/wiki/Image:"; |
464 | 464 | |
| 465 | +/** |
| 466 | + * File redirects |
| 467 | + * If enabled, MediaWiki checks redirects in Image: namespace. |
| 468 | + */ |
| 469 | +$wgFileRedirects = false; |
465 | 470 | |
466 | 471 | # |
467 | 472 | # Email settings |