Index: branches/REL1_2/phase3/includes/ImagePage.php |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | function delete() |
119 | 119 | { |
120 | 120 | global $wgUser, $wgOut; |
121 | | - global $wpConfirm, $wpReason, $image, $oldimage; |
| 121 | + global $wpConfirm, $wpReason, $image, $oldimage, $wpForce; |
122 | 122 | |
123 | 123 | # Anybody can delete old revisions of images; only sysops |
124 | 124 | # can delete articles and current images |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | # Better double-check that it hasn't been deleted yet! |
136 | 136 | $wgOut->setPagetitle( wfMsg( "confirmdelete" ) ); |
137 | 137 | if ( $image ) { |
138 | | - if ( "" == trim( $image ) ) { |
| 138 | + if ( "" == trim( $image ) && !$wpForce ) { |
139 | 139 | $wgOut->fatalError( wfMsg( "cannotdelete" ) ); |
140 | 140 | return; |
141 | 141 | } |
— | — | @@ -157,14 +157,14 @@ |
158 | 158 | function doDelete() |
159 | 159 | { |
160 | 160 | global $wgOut, $wgUser, $wgLang; |
161 | | - global $image, $oldimage, $wpReason; |
| 161 | + global $image, $oldimage, $wpReason, $wpForce; |
162 | 162 | global $wgUseSquid, $wgInternalServer, $wgDeferredUpdateList; |
163 | 163 | $fname = "Article::doDelete"; |
164 | 164 | |
165 | 165 | if ( $image ) { |
166 | 166 | $dest = wfImageDir( $image ); |
167 | 167 | $archive = wfImageDir( $image ); |
168 | | - if ( ! unlink( "{$dest}/{$image}" ) ) { |
| 168 | + if ( ! unlink( "{$dest}/{$image}" ) && !$wpForce ) { |
169 | 169 | $wgOut->fileDeleteError( "{$dest}/{$image}" ); |
170 | 170 | return; |
171 | 171 | } |
— | — | @@ -243,11 +243,11 @@ |
244 | 244 | |
245 | 245 | function doDeleteOldImage( $oldimage ) |
246 | 246 | { |
247 | | - global $wgOut; |
| 247 | + global $wgOut, $wpForce; |
248 | 248 | |
249 | 249 | $name = substr( $oldimage, 15 ); |
250 | 250 | $archive = wfImageArchiveDir( $name ); |
251 | | - if ( ! unlink( "{$archive}/{$oldimage}" ) ) { |
| 251 | + if ( ! unlink( "{$archive}/{$oldimage}" ) && !$wpForce ) { |
252 | 252 | $wgOut->fileDeleteError( "{$archive}/{$oldimage}" ); |
253 | 253 | } |
254 | 254 | } |