r25507 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25506‎ | r25507 | r25508 >
Date:19:29, 4 September 2007
Author:rfrisar
Status:old
Tags:
Comment:
No change on functionality.
Changes to make easier merge: 'printf' removed, tabs, etc.
Modified paths:
  • /branches/ApiEdit_Vodafone/includes/api/ApiUploadFile.php (modified) (history)

Diff [purge]

Index: branches/ApiEdit_Vodafone/includes/api/ApiUploadFile.php
@@ -30,7 +30,7 @@
3131
3232 /**
3333 * A module to upload given files
34 - *
 34+ *
3535 * @addtogroup API
3636 */
3737 class ApiUploadFile extends ApiBase {
@@ -42,7 +42,7 @@
4343 const UPLOAD_READ_ONLY = -6;
4444 const UPLOAD_BAD_TOKEN = -7;
4545
46 -
 46+
4747 public function __construct($query, $moduleName) {
4848 parent :: __construct($query, $moduleName, 'up');
4949 }
@@ -58,20 +58,20 @@
5959 extract($this->extractRequestParams());
6060
6161 /*** VODAFONE DEBUG COMMENTS ***/
62 - print "\nPARAMETERS POST:\n <br>";
 62+ /** print "\nPARAMETERS POST:\n <br>";
6363 print_r($this->extractRequestParams());
6464 print "<br><br>";
6565 print "\n_FILES:\n <br>";
6666 print_r($_FILES);
67 - print "<br><br>";
 67+ print "<br><br>"; */
6868 /*******************************/
6969
70 - $data = array(//'wpUploadFile' => $file,
71 - 'wpSourceType' => "file",
72 - 'wpDestFile' => $destfile,
73 - 'wpUploadDescription' => $summary,
74 - 'wpWatchthis' => $watch,
75 - 'wpIgnoreWarning' => $ignore,
 70+ $data = array(//'wpUploadFile' => $file,
 71+ 'wpSourceType' => "file",
 72+ 'wpDestFile' => $destfile,
 73+ 'wpUploadDescription' => $summary,
 74+ 'wpWatchthis' => $watch,
 75+ 'wpIgnoreWarning' => $ignore,
7676 'wpLicense' => $license);
7777 $request = new FauxRequest($data);
7878
@@ -86,16 +86,16 @@
8787 if( $userid!="" && $usertoken!="" ){
8888 $MyUser = new User();
8989 $MyUser->setID( $userid );
90 -
 90+
9191 if( $MyUser->loadFromId() ){
92 - print "\n<br>entro x 1 - user cargado\n<br>";
93 -
 92+ //print "\n<br>entro x 1 - user cargado\n<br>";
 93+
9494 if( $usertoken == $MyUser->mToken ){
95 - print "\n<br>entro x 2 - tokens coinciden\n<br>";
 95+ //print "\n<br>entro x 2 - tokens coinciden\n<br>";
9696 $MyUser->setCookies();
9797 $wgUser = $MyUser;
9898 }else{
99 - print "\n<br>entro x 3 - mal token\n<br>";
 99+ //print "\n<br>entro x 3 - mal token\n<br>";
100100 $this->process( self::UPLOAD_BAD_TOKEN );
101101 return;
102102 }
@@ -103,12 +103,12 @@
104104 }
105105
106106 /*** VODAFONE DEBUG COMMENTS ***/
107 - print "\n<br>USER: <br>";
 107+ /**print "\n<br>USER: <br>";
108108 print_r($wgUser);
109109 print "<br><br>";
110110 print "_SESSION: <br>";
111111 print_r($_SESSION);
112 - print "<br><br>";
 112+ print "<br><br>"; */
113113 /*******************************/
114114
115115 # Check uploading enabled
@@ -143,9 +143,9 @@
144144 return;
145145 }
146146
147 - $this->process($form->processUpload());
 147+ $this->process($form->internalProcessUpload());
148148 // $this->cleanupTempFile();
149 -
 149+
150150 } else {
151151 $this->process( self::UPLOAD_INVALID );
152152 }
@@ -178,7 +178,7 @@
179179 case ApiUploadFile::UPLOAD_READ_ONLY :
180180 $result['result'] = 'Upload_Read_Only';
181181 break;
182 -
 182+
183183 case ApiUploadFile::UPLOAD_BAD_TOKEN :
184184 $result['result'] = 'UPLOAD_BAD_TOKEN';
185185 break;
@@ -236,7 +236,7 @@
237237 case UploadForm::UPLOAD_WARNING:
238238 $result['result'] = 'Upload_Warning';
239239 break;
240 -
 240+
241241 default :
242242 $result['result'] = 'Upload_Invalid';
243243 }
@@ -271,7 +271,7 @@
272272 ApiBase :: PARAM_TYPE => 'string'
273273 ),
274274
275 -
 275+
276276 );
277277 }
278278
@@ -294,9 +294,17 @@
295295
296296 protected function getExamples() {
297297 return array (
298 - "For test Upload file selected: ",
299 - " http://esdt32606/wikisvn/api_upload_form.php",
300 -
 298+ "Multipart post request: api.php ? action=upload ",
 299+ "Post Parameters:",
 300+ " upfile=<path_to_file>",
 301+ " upsourcetype=<file>",
 302+ " updestfile=<file_name.jpg>",
 303+ " upsummary=<summary>",
 304+ " [upwatch=yes/no]",
 305+ " [upignore=yes/no]",
 306+ " [uplicense=<License>]",
 307+ " [upuserid=<userId>]",
 308+ " [uplgtoken=lgToken]",
301309 );
302310 }
303311

Status & tagging log