diff options
Diffstat (limited to 'config/systempatches')
-rw-r--r-- | config/systempatches/patches.inc | 20 | ||||
-rw-r--r-- | config/systempatches/systempatches.xml | 2 |
2 files changed, 20 insertions, 2 deletions
diff --git a/config/systempatches/patches.inc b/config/systempatches/patches.inc index 2298e170..1c6ea4ba 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 { @@ -162,6 +175,11 @@ function is_github_url($url) { function bootup_apply_patches() { global $config; + if (!isset($config['installedpackages']['patches']['item']) || + !is_array($config['installedpackages']['patches']['item'])) { + $config['installedpackages']['patches']['item'] = array(); + } + $a_patches = &$config['installedpackages']['patches']['item']; foreach ($a_patches as $patch) { diff --git a/config/systempatches/systempatches.xml b/config/systempatches/systempatches.xml index 61f3df84..01501df7 100644 --- a/config/systempatches/systempatches.xml +++ b/config/systempatches/systempatches.xml @@ -43,7 +43,7 @@ </copyright> <description>System Patches applies patches supplied by the user to the firewall.</description> <name>System Patches</name> - <version>1.0.6</version> + <version>1.0.8</version> <title>System: Patches</title> <include_file>/usr/local/pkg/patches.inc</include_file> <menu> |