r50492 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50491‎ | r50492 | r50493 >
Date:17:13, 11 May 2009
Author:dale
Status:deferred
Tags:
Comment:
updated error handling on http copy
Modified paths:
  • /branches/new-upload/phase3/includes/HttpFunctions.php (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/includes/HttpFunctions.php
@@ -133,17 +133,21 @@
134134 //run the actual request .. (this can take some time)
135135 wfDebug("do Request: " . $sd['url'] . ' tf: ' . $sd['target_file_path'] );
136136 $status = $req->doRequest();
137 - wfDebug("done with req status is: ". $status->isOK(). ' '.$status->value. "\n");
 137+ wfDebug("done with req status is: ". $status->isOK(). ' '.$status->getWikiText(). "\n");
 138+
 139+ //start up the session again:
 140+ if( session_start() === false){
 141+ wfDebug( __METHOD__ . ' ERROR:: Could not start session');
 142+ }
 143+ //grab the updated session data pointer
 144+ $sd =& $_SESSION[ 'wsDownload' ][$upload_session_key];
138145
139 - if( $status->isOK() ){
140 -
141 - //start up the session again:
142 - if( session_start() === false){
143 - wfDebug( __METHOD__ . ' ERROR:: Could not start session');
144 - }
145 - //re-grab the updated session data:
146 - $sd =& $_SESSION[ 'wsDownload' ][$upload_session_key];
147 -
 146+ //if error update status:
 147+ if( !$status->isOK() ){
 148+ $sd['error'] = $status->getWikiText();
 149+ }
 150+ //if status oky process upload using fauxReq to api:
 151+ if( $status->isOK() ){
148152 //setup the faxRequest
149153 $fauxReqData = $sd['mParams'];
150154 $fauxReqData['action'] = 'upload';
@@ -161,15 +165,14 @@
162166 $printer->initPrinter(false);
163167 ob_start();
164168 $printer->execute();
165 - $apiUploadResult = ob_get_clean();
166 -
167 - wfDebug("\n\n got:" . $apiUploadResult." \n");
 169+ $apiUploadResult = ob_get_clean();
168170
169171 wfDebug("\n\n got api result:: $apiUploadResult \n" );
170172 //the status updates runner will grab the result form the session:
171 - $sd['apiUploadResult'] = $apiUploadResult;
172 - session_write_close();
 173+ $sd['apiUploadResult'] = $apiUploadResult;
173174 }
 175+ //close the session:
 176+ session_write_close();
174177 }
175178
176179 /**

Status & tagging log