Changeset 2404
- Timestamp:
- 12/24/2011 4:51:20 AM (5 months ago)
- File:
-
- 1 edited
-
trunk/website/scripts/BuildPublish.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/website/scripts/BuildPublish.php
r2396 r2404 17 17 require_once('BuildBranch.php'); 18 18 require_once('BuildUtil.php'); 19 20 /** 21 * Reads a HTTP response stream and strips it of HTML, returning as a buffer. 22 * This is similar to file_get_contents 23 * 24 * @param resource $file The file stream to read. 25 * @return string The contents of the response, without HTML. 26 * @throws Exception An I/O error occurred. 27 */ 28 function http_get_contents($file) 29 { 30 $result = ''; 31 while (($line = fgetss($file, 4096)) !== false) 32 $result .= $line . "\n"; 33 if (!feof($file)) 34 throw new Exception('Unexpected fgets() failure'); 35 36 return $result; 37 } 19 38 20 39 $file = fopen($argv[3], 'rb'); … … 51 70 $serverResponse, $build_username, $build_password); 52 71 fseek($serverResponse, 0); 53 while (($line = fgetss($serverResponse, 4096)) !== false) 54 echo $line; 55 if (!feof($serverResponse)) 56 throw new Exception('Unexpected fgets() failure'); 72 echo http_get_contents($serverResponse); 57 73 fclose($serverResponse); 58 74 } 59 75 catch (Exception $e) 60 76 { 77 fseek($serverResponse, 0); 78 $serverResponseText = http_get_contents($serverResponse); 61 79 fclose($serverResponse); 80 81 echo 'Error: ' . $e->getMessage(); 82 if (!empty($serverResponseText)) 83 echo " with error message:\n" . $serverResponseText . "\n"; 84 62 85 Delete(SHELL_WEB_ROOT . $installerPath, $sftp_username, $sftp_password); 63 throw $e;86 exit(1); 64 87 } 65 88 }
Note: See TracChangeset
for help on using the changeset viewer.
