From 9b16a37984607aaa74ba915a66dcae47bc338821 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Fri, 30 Mar 2012 11:57:38 -0400
Subject: [PATCH] - nginx: merge function: default action is now to replace older locations in the nginx vhost configuration; a merge  instead of a replacement can be achieved by putting the string "##merge##" (without quotes) at the end of the most recent location line (e.g. "location ~ \.php$ { ##merge##").

---
 server/plugins-available/nginx_plugin.inc.php |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 69cd032..ffd5ff7 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -1629,10 +1629,16 @@
 					}
 					unset($loc_parts);
 					
+					if(!isset($locations[$location]['action'])) $locations[$location]['action'] = 'replace';
+					if(substr($l, -9) == '##merge##'){
+						$locations[$location]['action'] = 'merge';
+					}
+					
 					if(!isset($locations[$location]['open_tag'])) $locations[$location]['open_tag'] = '        location '.$location.' {';
-					if(!isset($locations[$location]['location'])) $locations[$location]['location'] = '';
+					if(!isset($locations[$location]['location']) || $locations[$location]['action'] == 'replace') $locations[$location]['location'] = '';
 					if(!isset($locations[$location]['end_tag'])) $locations[$location]['end_tag'] = '        }';
 					if(!isset($locations[$location]['start_line'])) $locations[$location]['start_line'] = $i;
+
 					unset($lines[$i]);
 					
 				} else {

--
Gitblit v1.9.1