Changeset 2390
- Timestamp:
- 11/26/2011 4:26:52 AM (19 months ago)
- Location:
- trunk/website/scripts
- Files:
-
- 2 edited
-
BuildPublish.php (modified) (1 diff)
-
BuildUtil.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/website/scripts/BuildPublish.php
r2389 r2390 44 44 45 45 //Then update our website builds information 46 46 $serverResponse = fopen('php://temp', 'rw'); 47 try 48 { 49 Download(sprintf('http://eraser.heidi.ie/scripts/BuildServer.php?branch=%s&revision=%d&filesize=%d&url=%s', 50 $argv[1], $argv[2], filesize($argv[3]), urlencode(HTTP_WEB_ROOT . $installerPath)), 51 $serverResponse, $build_username, $build_password); 52 fseek($serverResponse, 0); 53 while (($line = fgets($handle, 4096)) !== false) 54 echo $line; 55 if (!feof($handle)) 56 throw new Exception('Unexpected fgets() failure'); 57 fclose($serverResponse); 58 } 59 catch (Exception $e) 60 { 61 fclose($serverResponse); 62 Delete(SHELL_WEB_ROOT . $installerPath, $sftp_username, $sftp_password); 63 throw $e; 64 } 47 65 } 48 66 catch (Exception $e) -
trunk/website/scripts/BuildUtil.php
r2386 r2390 22 22 23 23 printf("File uploaded.\n"); 24 } 25 26 /** 27 * Downloads the contents of a particular URL to a stream. 28 * 29 * @param string $url The URL to download. 30 * @param string $stream The stream to save to. 31 * @param string $username The username of the user, if required. 32 * @param string $password The password of the user, if required. 33 */ 34 function Download($url, $stream, $username = '', $password = '') 35 { 36 printf('Downloading %s... ', $url); 37 38 $curl = curl_init($url); 39 curl_setopt($curl, CURLOPT_USERPWD, sprintf('%s:%s', $username, $password)); 40 curl_setopt($curl, CURLOPT_FILE, $stream); 41 42 if (curl_exec($curl) === false) 43 throw new Exception('cURL Error: ' . curl_error($curl)); 44 curl_close($curl); 45 46 printf("File downloaded.\n"); 24 47 } 25 48
Note: See TracChangeset
for help on using the changeset viewer.
