Index: trunk/phase3/includes/Article.php |
— | — | @@ -2263,6 +2263,7 @@ |
2264 | 2264 | $dbw->delete( 'externallinks', array( 'el_from' => $id ) ); |
2265 | 2265 | $dbw->delete( 'langlinks', array( 'll_from' => $id ) ); |
2266 | 2266 | $dbw->delete( 'redirect', array( 'rd_from' => $id ) ); |
| 2267 | + $dbw->delete( 'imageredirects', array( 'ir_from' => $t ) ); |
2267 | 2268 | } |
2268 | 2269 | |
2269 | 2270 | # If using cleanup triggers, we can skip some manual deletes |
Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | /** |
48 | 48 | * The following member variables are not lazy-initialised |
49 | 49 | */ |
50 | | - var $repo, $title, $lastError; |
| 50 | + var $repo, $title, $lastError, $redirected; |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Call this constructor from child classes |
— | — | @@ -1136,6 +1136,9 @@ |
1137 | 1137 | return ''; |
1138 | 1138 | } |
1139 | 1139 | } |
| 1140 | + |
| 1141 | + function getRedirectedFrom() { return $this->redirected; } |
| 1142 | + function setRedirectedFrom( $v ) { $this->redirected = $v; } |
1140 | 1143 | } |
1141 | 1144 | /** |
1142 | 1145 | * Aliases for backwards compatibility with 1.6 |
Index: trunk/phase3/includes/filerepo/FileRepo.php |
— | — | @@ -90,11 +90,13 @@ |
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | if ( $img->exists() && ( !$time || $img->getTimestamp() <= $time ) ) { |
| 94 | + $img->setRedirectedFrom( $redirected ); |
94 | 95 | return $img; |
95 | 96 | } |
96 | 97 | # Now try an old version of the file |
97 | 98 | $img = $this->newFile( $title, $time ); |
98 | 99 | if ( $img->exists() ) { |
| 100 | + $img->setRedirectedFrom( $redirected ); |
99 | 101 | return $img; |
100 | 102 | } |
101 | 103 | |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -219,12 +219,17 @@ |
220 | 220 | } |
221 | 221 | |
222 | 222 | switch( $title->getNamespace() ) { |
223 | | - case NS_IMAGE: |
224 | | - return new ImagePage( $title ); |
225 | | - case NS_CATEGORY: |
226 | | - return new CategoryPage( $title ); |
227 | | - default: |
228 | | - return new Article( $title ); |
| 223 | + case NS_IMAGE: |
| 224 | + $file = RepoGroup::singleton()->findFile( $title->getText() ); |
| 225 | + if( $file && $file->getRedirectedFrom() ) { |
| 226 | + return new Article( $title ); |
| 227 | + } else { |
| 228 | + return new ImagePage( $title ); |
| 229 | + } |
| 230 | + case NS_CATEGORY: |
| 231 | + return new CategoryPage( $title ); |
| 232 | + default: |
| 233 | + return new Article( $title ); |
229 | 234 | } |
230 | 235 | } |
231 | 236 | |