Changeset 3025:50e647316e34 for inc/core/class.dc.store.php
- Timestamp:
- 07/01/15 14:23:38 (10 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/core/class.dc.store.php
r2566 r3025 195 195 public function download($url, $dest) 196 196 { 197 try { 198 $client = netHttp::initClient($url, $path); 199 $client->setUserAgent($this->user_agent); 200 $client->useGzip(false); 201 $client->setPersistReferers(false); 202 $client->setOutput($dest); 203 $client->get($path); 204 unset($client); 205 } 206 catch (Exception $e) { 207 unset($client); 197 // Check and add default protocol if necessary 198 if (!preg_match('%^http[s]?:\/\/%',$url)) { 199 $url = 'http://'.$url; 200 } 201 // Download package 202 if ($client = netHttp::initClient($url, $path)) { 203 try { 204 $client->setUserAgent($this->user_agent); 205 $client->useGzip(false); 206 $client->setPersistReferers(false); 207 $client->setOutput($dest); 208 $client->get($path); 209 unset($client); 210 } 211 catch (Exception $e) { 212 unset($client); 213 throw new Exception(__('An error occurred while downloading the file.')); 214 } 215 } else { 208 216 throw new Exception(__('An error occurred while downloading the file.')); 209 217 }
Note: See TracChangeset
for help on using the changeset viewer.