Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | * |
96 | 96 | */ |
97 | 97 | private function initBackgroundDownload( $url, $target_file_path, $content_length = null ){ |
98 | | - global $wgMaxUploadSize, $IP, $wgPhpCli; |
| 98 | + global $wgMaxUploadSize, $IP, $wgPhpCli, $wgServer; |
99 | 99 | $status = Status::newGood(); |
100 | 100 | |
101 | 101 | // generate a session id with all the details for the download (pid, target_file_path ) |
— | — | @@ -104,6 +104,8 @@ |
105 | 105 | // store the url and target path: |
106 | 106 | $_SESSION['wsDownload'][$upload_session_key]['url'] = $url; |
107 | 107 | $_SESSION['wsDownload'][$upload_session_key]['target_file_path'] = $target_file_path; |
| 108 | + //since we request from the cmd line we lose the original host name pass in the session: |
| 109 | + $_SESSION['wsDownload'][$upload_session_key]['orgServer'] = $wgServer; |
108 | 110 | |
109 | 111 | if( $content_length ) |
110 | 112 | $_SESSION['wsDownload'][$upload_session_key]['content_length'] = $content_length; |
— | — | @@ -139,8 +141,8 @@ |
140 | 142 | * (a given client could have started a few http uploads at once) |
141 | 143 | */ |
142 | 144 | public static function doSessionIdDownload( $session_id, $upload_session_key ){ |
143 | | - global $wgUser, $wgEnableWriteAPI, $wgAsyncHTTPTimeout; |
144 | | - wfDebug( __METHOD__ . "\n\ndoSessionIdDownload\n\n" ); |
| 145 | + global $wgUser, $wgEnableWriteAPI, $wgAsyncHTTPTimeout, $wgServer; |
| 146 | + wfDebug( __METHOD__ . "\n\ndoSessionIdDownload:\n\n" ); |
145 | 147 | // set session to the provided key: |
146 | 148 | session_id( $session_id ); |
147 | 149 | // start the session |
— | — | @@ -156,7 +158,12 @@ |
157 | 159 | $wgUser = User::newFromSession(); |
158 | 160 | |
159 | 161 | // grab the session data to setup the request: |
160 | | - $sd =& $_SESSION['wsDownload'][$upload_session_key]; |
| 162 | + $sd =& $_SESSION['wsDownload'][$upload_session_key]; |
| 163 | + |
| 164 | + //update the wgServer var ( since cmd line thinks we are localhost when we are really orgServer) |
| 165 | + if(isset($sd['orgServer']) && $sd['orgServer']){ |
| 166 | + $wgServer = $sd['orgServer']; |
| 167 | + } |
161 | 168 | // close down the session so we can other http queries can get session updates: |
162 | 169 | session_write_close(); |
163 | 170 | |