Index: trunk/phase3/includes/FileDeleteForm.php |
— | — | @@ -10,6 +10,8 @@ |
11 | 11 | |
12 | 12 | private $title = null; |
13 | 13 | private $file = null; |
| 14 | + |
| 15 | + private $oldfile = null; |
14 | 16 | private $oldimage = ''; |
15 | 17 | |
16 | 18 | /** |
— | — | @@ -50,6 +52,8 @@ |
51 | 53 | $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars( $this->oldimage ) ); |
52 | 54 | return; |
53 | 55 | } |
| 56 | + if( $this->oldimage ) |
| 57 | + $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage ); |
54 | 58 | |
55 | 59 | if( !$this->haveDeletableFile() ) { |
56 | 60 | $wgOut->addHtml( $this->prepareMessage( 'filedelete-nofile' ) ); |
— | — | @@ -57,14 +61,6 @@ |
58 | 62 | return; |
59 | 63 | } |
60 | 64 | |
61 | | - // Don't allow accidental deletion of a single file revision |
62 | | - // if this is, in fact, the current revision; things might break |
63 | | - if( $this->oldimage && $this->file->getTimestamp() == $this->getTimestamp() ) { |
64 | | - $wgOut->addHtml( wfMsgExt( 'filedelete-iscurrent', 'parse' ) ); |
65 | | - $wgOut->addReturnTo( $this->title ); |
66 | | - return; |
67 | | - } |
68 | | - |
69 | 65 | // Perform the deletion if appropriate |
70 | 66 | if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->oldimage ) ) { |
71 | 67 | $comment = $wgRequest->getText( 'wpComment' ); |
— | — | @@ -173,8 +169,9 @@ |
174 | 170 | * @return bool |
175 | 171 | */ |
176 | 172 | private function haveDeletableFile() { |
177 | | - $file = wfFindFile( $this->title, $this->oldimage ); |
178 | | - return $file && $file->exists() && $file->isLocal(); |
| 173 | + return $this->oldimage |
| 174 | + ? $this->oldfile && $this->oldfile->exists() && $this->oldfile->isLocal() |
| 175 | + : $this->file && $this->file->exists() && $this->file->isLocal(); |
179 | 176 | } |
180 | 177 | |
181 | 178 | /** |
— | — | @@ -196,12 +193,7 @@ |
197 | 194 | * @return string |
198 | 195 | */ |
199 | 196 | private function getTimestamp() { |
200 | | - static $timestamp = false; |
201 | | - if( $timestamp === false ) { |
202 | | - $file = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage ); |
203 | | - $timestamp = $file->getTimestamp(); |
204 | | - } |
205 | | - return $timestamp; |
| 197 | + return $this->oldfile->getTimestamp(); |
206 | 198 | } |
207 | 199 | |
208 | 200 | } |
\ No newline at end of file |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1512,7 +1512,7 @@ |
1513 | 1513 | 'filedelete-success' => "'''$1''' has been deleted.", |
1514 | 1514 | 'filedelete-success-old' => "<span class=\"plainlinks\">The version of '''[[Media:$1|$1]]''' as of $3, $2 has been deleted.</span>", |
1515 | 1515 | 'filedelete-nofile' => "'''$1''' does not exist on this site.", |
1516 | | -'filedelete-nofile-old' => "There is no version of '''$1''' dated $3, $2.", |
| 1516 | +'filedelete-nofile-old' => "There is no archived version of '''$1''' with the specified attributes.", |
1517 | 1517 | 'filedelete-iscurrent' => 'You are attempting to delete the most recent version of this file. Please revert to an older version first.', |
1518 | 1518 | |
1519 | 1519 | # MIME search |