Index: branches/new-upload/phase3/includes/HttpFunctions.php |
— | — | @@ -100,7 +100,6 @@ |
101 | 101 | */ |
102 | 102 | public static function doSessionIdDownload( $session_id, $upload_session_key ){ |
103 | 103 | global $wgUser, $wgEnableWriteAPI; |
104 | | - wfDebug("\n\ndoSessionIdDownload\n\n"); |
105 | 104 | //set session to the provided key: |
106 | 105 | session_id($session_id); |
107 | 106 | //start the session |
— | — | @@ -128,15 +127,14 @@ |
129 | 128 | wfDebug("doRequest: " . $sd['url'] . ' tf: ' . $sd['target_file_path'] ); |
130 | 129 | $status = $req->doRequest(); |
131 | 130 | |
132 | | - if( $status->isOK() ){ |
133 | | - |
134 | | - //start up the session again: |
135 | | - if( session_start() === false){ |
136 | | - wfDebug( __METHOD__ . ' ERROR:: Could not start session'); |
137 | | - } |
138 | | - //re-grab the updated session data: |
139 | | - $sd =& $_SESSION[ 'wsDownload' ][$upload_session_key]; |
140 | | - |
| 131 | + |
| 132 | + //start up the session again: |
| 133 | + if( session_start() === false){ |
| 134 | + wfDebug( __METHOD__ . ' ERROR:: Could not start session'); |
| 135 | + } |
| 136 | + //re-grab the updated session data: |
| 137 | + $sd =& $_SESSION[ 'wsDownload' ][$upload_session_key]; |
| 138 | + if( $status->isOK() ){ |
141 | 139 | //setup the faxRequest |
142 | 140 | $fauxReqData = $sd['mParams']; |
143 | 141 | $fauxReqData['action'] = 'upload'; |
— | — | @@ -154,12 +152,14 @@ |
155 | 153 | ob_start(); |
156 | 154 | $printer->execute(); |
157 | 155 | $apiUploadResult = ob_get_clean(); |
158 | | - |
159 | | - wfDebug("\n\n got api result:: $apiUploadResult \n" ); |
| 156 | + |
160 | 157 | //the status updates runner will grab the result form the session: |
161 | | - $sd['apiUploadResult'] = $apiUploadResult; |
162 | | - session_write_close(); |
| 158 | + $sd['apiUploadResult'] = $apiUploadResult; |
| 159 | + }else{ |
| 160 | + //status != OK |
| 161 | + $sd['apiUploadResult'] = ApiFormatJson::getJsonEncode( array( 'error' => $status->getWikiText() ) ); |
163 | 162 | } |
| 163 | + session_write_close(); |
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
— | — | @@ -305,6 +305,7 @@ |
306 | 306 | if ( $retcode != 200 ) { |
307 | 307 | wfDebug( __METHOD__ . ": HTTP return code $retcode\n" ); |
308 | 308 | $status = Status::newFatal( "HTTP return code $retcode\n" ); |
| 309 | + |
309 | 310 | } |
310 | 311 | # Don't return truncated output |
311 | 312 | $errno = curl_errno( $c ); |
Index: branches/new-upload/phase3/includes/api/ApiBase.php |
— | — | @@ -147,9 +147,8 @@ |
148 | 148 | * Get the result object |
149 | 149 | * @return ApiResult |
150 | 150 | */ |
151 | | - public function getResult() { |
152 | | - wfDebug("\n\napiBase:getResult()\n\n"); |
153 | | - // Main module has getResult() method overriden |
| 151 | + public function getResult() { |
| 152 | + // Main module has getResult() method overridden |
154 | 153 | // Safety - avoid infinite loop: |
155 | 154 | if ($this->isMain()) |
156 | 155 | ApiBase :: dieDebug(__METHOD__, 'base method was called on main module. '); |