aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-11-12 18:14:41 +0100
committerdoktornotor <notordoktor@gmail.com>2015-11-12 18:14:41 +0100
commite1367f1c0ee6bc8187f145d397120fdbda44f22c (patch)
treef9651d1e9ab13166805cd3197329c8634c11a31b
parent6a9837c9abd3011d22eccb31175e56fc02b9f286 (diff)
downloadpfsense-packages-e1367f1c0ee6bc8187f145d397120fdbda44f22c.tar.gz
pfsense-packages-e1367f1c0ee6bc8187f145d397120fdbda44f22c.tar.bz2
pfsense-packages-e1367f1c0ee6bc8187f145d397120fdbda44f22c.zip
systempatches - make fetch work if pfsense is behind proxy (fixes Bug #4369)
-rw-r--r--config/systempatches/patches.inc15
1 files changed, 14 insertions, 1 deletions
diff --git a/config/systempatches/patches.inc b/config/systempatches/patches.inc
index 2298e170..92825799 100644
--- a/config/systempatches/patches.inc
+++ b/config/systempatches/patches.inc
@@ -29,6 +29,7 @@
*/
require_once("globals.inc");
require_once("util.inc");
+require_once("pfsense-utils.inc");
global $git_root_url, $patch_suffix, $patch_dir, $patch_cmd;
$git_root_url = "https://github.com/pfsense/pfsense/commit/";
@@ -88,8 +89,20 @@ function patch_test_revert($patch, $fulldetail=false) {
/* Fetch a patch from a URL or github */
function patch_fetch(& $patch) {
+ global $g;
$url = patch_fixup_url($patch['location']);
- $text = @file_get_contents($url);
+ $temp_filename = tempnam("{$g['tmp_path']}/", "system_patches");
+ /*
+ * Backwards compatibility with older 2.1.x pfSense versions
+ * that did not contain download_file() function in pfsense-utils.inc
+ */
+ if (!function_exists("download_file")) {
+ download_file_with_progress_bar($url, $temp_filename);
+ } else {
+ download_file($url, $temp_filename);
+ }
+ $text = @file_get_contents($temp_filename);
+ unlink($temp_filename);
if (empty($text)) {
return false;
} else {