aboutsummaryrefslogtreecommitdiffstats
path: root/config/squid3
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-10-12 00:01:44 +0200
committerdoktornotor <notordoktor@gmail.com>2015-10-12 00:01:44 +0200
commitf0445789ce9fe90918b22626eea90339916d66e6 (patch)
tree6b8532848c18a0ab0e9103d89e58710c95130867 /config/squid3
parentf76829a211478295f6c94072742a32f8561ce263 (diff)
downloadpfsense-packages-f0445789ce9fe90918b22626eea90339916d66e6.tar.gz
pfsense-packages-f0445789ce9fe90918b22626eea90339916d66e6.tar.bz2
pfsense-packages-f0445789ce9fe90918b22626eea90339916d66e6.zip
Move reverse proxy config migration to squid_reverse.inc
Diffstat (limited to 'config/squid3')
-rwxr-xr-xconfig/squid3/34/squid_reverse.inc53
1 files changed, 53 insertions, 0 deletions
diff --git a/config/squid3/34/squid_reverse.inc b/config/squid3/34/squid_reverse.inc
index d69d6a01..9693b21f 100755
--- a/config/squid3/34/squid_reverse.inc
+++ b/config/squid3/34/squid_reverse.inc
@@ -263,6 +263,59 @@ function squid_resync_reverse() {
return $conf;
}
+/* Migrate reverse proxy configuration from old Squid package versions */
+function squid_reverse_upgrade_config() {
+ global $config;
+ if (is_array($config['installedpackages']['squidreverse'])) {
+ $old_reverse_settings = $config['installedpackages']['squidreverse']['config'][0];
+
+ // settings
+ if (!is_array($config['installedpackages']['squidreversegeneral'])) {
+ $config['installedpackages']['squidreversegeneral']['config'][0] = $old_reverse_settings;
+ unset($config['installedpackages']['squidreversegeneral']['config'][0]['reverse_cache_peer']);
+ unset($config['installedpackages']['squidreversegeneral']['config'][0]['reverse_uri']);
+ unset($config['installedpackages']['squidreversegeneral']['config'][0]['reverse_acl']);
+ }
+
+ // peers
+ if (!is_array($config['installedpackages']['squidreversepeer'])) {
+ foreach (explode("\n", sq_text_area_decode($old_reverse_settings['reverse_cache_peer'])) as $cache_peers) {
+ foreach (explode(";", $cache_peers) as $cache_peer) {
+ $config['installedpackages']['squidreversepeer']['config'][] = array(
+ 'description' => 'migrated',
+ 'enable' => 'on',
+ 'name' => $cache_peer[0],
+ 'port' => $cache_peer[1],
+ 'protocol' => $cache_peer[2]
+ );
+ }
+ }
+ }
+
+ // mappings
+ if (!is_array($config['installedpackages']['squidreverseuri'])) {
+ foreach (explode("\n", sq_text_area_decode($old_reverse_settings['reverse_acl'])) as $acls) {
+ foreach (explode(";", $acls) as $acl) {
+ array_push(${'peer_'.$acl[0]}, $acl[1]);
+ }
+ }
+ foreach (explode("\n", sq_text_area_decode($old_reverse_settings['reverse_uri'])) as $uris) {
+ foreach (explode(";", $uris) as $uri) {
+ $peer_list = (is_array(${'peer_' . $uri[0]}) ? implode(",", ${'peer_' . $uri[0]}) : "");
+ $config['installedpackages']['squidreverseuri']['config'][] = array(
+ 'description' => 'migrated',
+ 'enable' => 'on',
+ 'name' => $uri[0],
+ 'uri' => $uri[1],
+ 'vhost' => $uri[2],
+ 'peers' => $peer_list
+ );
+ }
+ }
+ }
+ }
+}
+
/* Reverse Proxy Server input validation */
function squid_validate_reverse($post, &$input_errors) {
global $config;