Index: branches/new-upload/phase3/includes/api/ApiUpload.php |
— | — | @@ -164,28 +164,23 @@ |
165 | 165 | $this->dieUsageMsg( array( 'mustbeloggedin', 'upload' ) ); |
166 | 166 | else |
167 | 167 | $this->dieUsageMsg( array( 'badaccess-groups' ) ); |
168 | | - } |
169 | | - wfDebug("\n\n do perform UPLOAD\n"); |
| 168 | + } |
170 | 169 | // Perform the upload |
171 | 170 | $result = $this->performUpload(); |
172 | | - wfDebug("\n\ndid performUpload result: $result \n\n"); |
173 | 171 | // Cleanup any temporary mess |
174 | 172 | $this->mUpload->cleanupTempFile(); |
175 | | - wfDebug("\n\n do output REsult:\n"); |
176 | 173 | $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
177 | 174 | } |
178 | 175 | private function performUpload() { |
179 | 176 | global $wgUser; |
180 | 177 | $result = array(); |
181 | | - $resultDetails = null; |
182 | | - wfDebug("\n\n call verifyPermissions\n\n"); |
| 178 | + $resultDetails = null; |
183 | 179 | $permErrors = $this->mUpload->verifyPermissions( $wgUser ); |
184 | 180 | if( $permErrors !== true ) { |
185 | 181 | $result['result'] = 'Failure'; |
186 | 182 | $result['error'] = 'permission-denied'; |
187 | 183 | return $result; |
188 | | - } |
189 | | - wfDebug("\n\n call verifyUpload\n\n"); |
| 184 | + } |
190 | 185 | $verification = $this->mUpload->verifyUpload( $resultDetails ); |
191 | 186 | if( $verification != UploadBase::OK ) { |
192 | 187 | $result['result'] = 'Failure'; |
— | — | @@ -246,21 +241,19 @@ |
247 | 242 | $result['sessionkey'] = $sessionKey; |
248 | 243 | return $result; |
249 | 244 | } |
250 | | - } |
251 | | - wfDebug("\n\n call performUpload\n\n"); |
| 245 | + } |
252 | 246 | //do the upload |
253 | 247 | $status = $this->mUpload->performUpload( $this->mParams['comment'], |
254 | 248 | $this->mParams['comment'], $this->mParams['watch'], $wgUser ); |
255 | | - |
256 | | - wfDebug("\n\n check if status is good:".$status->isGood() . ' e: ' . print_r($status->getErrorsArray(), true). "\n\n"); |
| 249 | + |
257 | 250 | if( !$status->isGood() ) { |
258 | 251 | $result['result'] = 'Failure'; |
259 | 252 | $result['error'] = 'internal-error'; |
260 | 253 | $result['details'] = $status->getErrorsArray(); |
261 | 254 | $this->getResult()->setIndexedTagName( $result['details'], 'error' ); |
262 | 255 | return $result; |
263 | | - } |
264 | | - wfDebug("\n\nstatus is good, get local file: \n"); |
| 256 | + } |
| 257 | + |
265 | 258 | $file = $this->mUpload->getLocalFile(); |
266 | 259 | $result['result'] = 'Success'; |
267 | 260 | $result['filename'] = $file->getName(); |
Index: branches/new-upload/phase3/includes/HttpFunctions.php |
— | — | @@ -125,9 +125,8 @@ |
126 | 126 | 'upload_session_key' => $upload_session_key |
127 | 127 | ) ); |
128 | 128 | //run the actual request .. (this can take some time) |
129 | | - wfDebug("do Request: " . $sd['url'] . ' tf: ' . $sd['target_file_path'] ); |
130 | | - $status = $req->doRequest(); |
131 | | - wfDebug("done with req status is: ". $status->isOK(). ' '.$status->value. "\n"); |
| 129 | + wfDebug("doRequest: " . $sd['url'] . ' tf: ' . $sd['target_file_path'] ); |
| 130 | + $status = $req->doRequest(); |
132 | 131 | |
133 | 132 | if( $status->isOK() ){ |
134 | 133 | |
— | — | @@ -143,8 +142,7 @@ |
144 | 143 | $fauxReqData['action'] = 'upload'; |
145 | 144 | $fauxReqData['format'] = 'json'; |
146 | 145 | $fauxReqData['internalhttpsession'] = $upload_session_key; |
147 | | - //evil but no other clean way about it: |
148 | | - |
| 146 | + |
149 | 147 | $faxReq = new FauxRequest($fauxReqData, true); |
150 | 148 | $processor = new ApiMain($faxReq, $wgEnableWriteAPI); |
151 | 149 | |
— | — | @@ -155,9 +153,7 @@ |
156 | 154 | $printer->initPrinter(false); |
157 | 155 | ob_start(); |
158 | 156 | $printer->execute(); |
159 | | - $apiUploadResult = ob_get_clean(); |
160 | | - |
161 | | - wfDebug("\n\n got:" . $apiUploadResult." \n"); |
| 157 | + $apiUploadResult = ob_get_clean(); |
162 | 158 | |
163 | 159 | wfDebug("\n\n got api result:: $apiUploadResult \n" ); |
164 | 160 | //the status updates runner will grab the result form the session: |