Index: branches/new-upload/phase3/includes/HttpFunctions.php |
— | — | @@ -133,17 +133,21 @@ |
134 | 134 | //run the actual request .. (this can take some time) |
135 | 135 | wfDebug("do Request: " . $sd['url'] . ' tf: ' . $sd['target_file_path'] ); |
136 | 136 | $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]; |
138 | 145 | |
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() ){ |
148 | 152 | //setup the faxRequest |
149 | 153 | $fauxReqData = $sd['mParams']; |
150 | 154 | $fauxReqData['action'] = 'upload'; |
— | — | @@ -161,15 +165,14 @@ |
162 | 166 | $printer->initPrinter(false); |
163 | 167 | ob_start(); |
164 | 168 | $printer->execute(); |
165 | | - $apiUploadResult = ob_get_clean(); |
166 | | - |
167 | | - wfDebug("\n\n got:" . $apiUploadResult." \n"); |
| 169 | + $apiUploadResult = ob_get_clean(); |
168 | 170 | |
169 | 171 | wfDebug("\n\n got api result:: $apiUploadResult \n" ); |
170 | 172 | //the status updates runner will grab the result form the session: |
171 | | - $sd['apiUploadResult'] = $apiUploadResult; |
172 | | - session_write_close(); |
| 173 | + $sd['apiUploadResult'] = $apiUploadResult; |
173 | 174 | } |
| 175 | + //close the session: |
| 176 | + session_write_close(); |
174 | 177 | } |
175 | 178 | |
176 | 179 | /** |