r32812 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32811‎ | r32812 | r32813 >
Date:15:12, 5 April 2008
Author:btongminh
Status:old
Tags:
Comment:
Fix variable usage and FileDeletionForm call
Modified paths:
  • /branches/ApiEdit_Vodafone/includes/api/ApiDelete.php (modified) (history)

Diff [purge]

Index: branches/ApiEdit_Vodafone/includes/api/ApiDelete.php
@@ -99,7 +99,7 @@
100100
101101 // Check permissions
102102 $errors = $title->getUserPermissionsErrors('delete', $wgUser);
103 - if (count($errors)) return $errors;
 103+ if (count($errors) > 0) return $errors;
104104
105105 // Check token
106106 if(!$wgUser->matchEditToken($token))
@@ -118,9 +118,8 @@
119119 public static function delete(&$article, $token, &$reason = NULL)
120120 {
121121 $errors = self::getPermissionsError($article->getTitle(), $token);
122 - if (count(errors)) return $errors;
 122+ if (count($errors)) return $errors;
123123
124 -
125124 // Auto-generate a summary, if necessary
126125 if(is_null($reason))
127126 {
@@ -139,7 +138,7 @@
140139 public static function deleteFile($token, &$title, $oldimage, &$reason = NULL, $suppress = false)
141140 {
142141 $errors = self::getPermissionsError($title, $token);
143 - if (count(errors)) return $errors;
 142+ if (count($errors)) return $errors;
144143
145144 if( $oldimage && !FileDeleteForm::isValidOldSpec($oldimage) )
146145 return array(array('invalidoldimage'));
@@ -153,7 +152,7 @@
154153 if( !FileDeleteForm::haveDeletableFile($file, $oldfile, $oldimage) )
155154 return array(array('nofile'));
156155
157 - $status = self::doDelete( $title, $file, $oldimage, $reason, $suppress );
 156+ $status = FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, $suppress );
158157
159158 if( !$status->isGood() )
160159 return array(array('cannotdelete', $title->getPrefixedText()));

Status & tagging log