r51514 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51513‎ | r51514 | r51515 >
Date:19:17, 5 June 2009
Author:catrope
Status:ok
Tags:
Comment:
API: Fix bug where deleting a file description page without an associated file resulted in "Unknown error: ``nofile''"
Modified paths:
  • /trunk/phase3/includes/api/ApiDelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiDelete.php
@@ -78,10 +78,6 @@
7979 $this->dieUsageMsg(reset($retval));
8080 } else {
8181 $articleObj = new Article($titleObj);
82 - if($articleObj->isBigDeletion() && !$wgUser->isAllowed('bigdelete')) {
83 - global $wgDeleteRevisionsLimit;
84 - $this->dieUsageMsg(array('delete-toobig', $wgDeleteRevisionsLimit));
85 - }
8682 $retval = self::delete($articleObj, $params['token'], $reason);
8783
8884 if(count($retval))
@@ -122,6 +118,10 @@
123119 public static function delete(&$article, $token, &$reason = NULL)
124120 {
125121 global $wgUser;
 122+ if($article->isBigDeletion() && !$wgUser->isAllowed('bigdelete')) {
 123+ global $wgDeleteRevisionsLimit;
 124+ return array(array('delete-toobig', $wgDeleteRevisionsLimit)));
 125+ }
126126 $title = $article->getTitle();
127127 $errors = self::getPermissionsError($title, $token);
128128 if (count($errors)) return $errors;
@@ -164,7 +164,7 @@
165165 $oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $oldimage );
166166
167167 if( !FileDeleteForm::haveDeletableFile($file, $oldfile, $oldimage) )
168 - return array(array('nofile'));
 168+ return self::delete(new Article($title), $token, $reason);
169169 if (is_null($reason)) # Log and RC don't like null reasons
170170 $reason = '';
171171 $status = FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, $suppress );

Follow-up revisions

RevisionCommit summaryAuthorDate
r51515RELEASE-NOTES for r51514catrope19:18, 5 June 2009

Status & tagging log