[omd-commits] OMD Git: omd: nagvis: Changed path detections to absolute paths ( to make special things work with local/ hierarchy)

git version control git at mathias-kettner.de
Sun Dec 16 11:58:39 CET 2012


Module:   omd
Branch:   master
Commit:   c469f02597b8152de2e052fbaa27971950f51e8a
URL:      http://omdistro.org/projects/omd/repository/revisions/c469f02597b8152de2e052fbaa27971950f51e8a

Author:   Lars Michelsen <lm at mathias-kettner.de>
Date:     Sun Dec 16 11:59:09 2012 +0100
Commiter: Lars Michelsen <lm at mathias-kettner.de>
Date:     Sun Dec 16 11:59:09 2012 +0100

nagvis: Changed path detections to absolute paths (to make special things work with local/ hierarchy)

---

 packages/nagvis/global.php.patch |   49 ++++++++++++++++++++++++++++---------
 1 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/packages/nagvis/global.php.patch b/packages/nagvis/global.php.patch
index 862e662..2740a0e 100644
--- a/packages/nagvis/global.php.patch
+++ b/packages/nagvis/global.php.patch
@@ -1,26 +1,51 @@
---- nagvis-1.5.3/share/server/core/defines/global.php.orig      2010-10-02 19:43:58.000000000 +0200
-+++ nagvis-1.5.3/share/server/core/defines/global.php   2010-10-02 19:47:00.000000000 +0200
-@@ -64,7 +64,7 @@
+--- nagvis-1.7-nightly/share/server/core/defines/global.php.orig	2012-12-16 11:56:58.912708241 +0100
++++ nagvis-1.7-nightly/share/server/core/defines/global.php	2012-12-16 11:57:59.041006400 +0100
+@@ -38,13 +38,22 @@
+ else
+ 	error_reporting(E_ALL);
+ 
++$_path_parts = explode('/', dirname($_SERVER["SCRIPT_FILENAME"]));
++if($_path_parts[count($_path_parts) - 6] == 'local') // handle OMD local/ hierarchy
++    $_base_dir = join(array_slice(explode('/' ,dirname($_SERVER["SCRIPT_FILENAME"])), 0, -6), '/');
++else
++    $_base_dir = join(array_slice(explode('/' ,dirname($_SERVER["SCRIPT_FILENAME"])), 0, -5), '/');
++
+ /**
+  * Set the search path for included files
+  */
+ set_include_path(
+ 	get_include_path()
+-	.PATH_SEPARATOR.'../../server/core/classes/'
+-	.PATH_SEPARATOR.'../../server/core/classes/objects/'
++	.PATH_SEPARATOR.$_base_dir.'/local/share/nagvis/htdocs/server/core/classes'
++	.PATH_SEPARATOR.$_base_dir.'/local/share/nagvis/htdocs/server/core/classes/objects'
++	.PATH_SEPARATOR.$_base_dir.'/share/nagvis/htdocs/server/core/classes'
++	.PATH_SEPARATOR.$_base_dir.'/share/nagvis/htdocs/server/core/classes/objects'
++	.PATH_SEPARATOR.$_base_dir.'/share/nagvis/htdocs/server/core/ext/php-gettext-1.0.9'
+ );
+ 
+ // Enable/Disable profiling of NagVis using xhprof.  To make use of this the
+@@ -64,7 +73,7 @@
  define('DEBUGLEVEL', 6);
-
+ 
  // Path to the debug file
 -define('DEBUGFILE', '../../../var/nagvis-debug.log');
-+define('DEBUGFILE', join(array_slice(explode('/' ,dirname($_SERVER["SCRIPT_FILENAME"])), 0, -5), '/').'/tmp/nagvis/nagvis-debug.log');
-
- // It is possible to define a second main configuration file
- // to pre-define some options in a file the user may not be
-@@ -78,14 +78,14 @@
++define('DEBUGFILE', $_base_dir.'/tmp/nagvis/nagvis-debug.log');
+ 
+ // It is possible to define a conf.d directory for splitting the main
+ // configuration in several files. Only the values defined in the CONST_MAINCFG
+@@ -78,14 +87,14 @@
  // The last value wins.
  //
  // Path to the main configuration file
 -define('CONST_MAINCFG', '../../../etc/nagvis.ini.php');
 -define('CONST_MAINCFG_CACHE', '../../../var/nagvis-conf');
-+define('CONST_MAINCFG', join(array_slice(explode('/' ,dirname($_SERVER["SCRIPT_FILENAME"])), 0, -5), '/').'/etc/nagvis/nagvis.ini.php');
-+define('CONST_MAINCFG_CACHE', join(array_slice(explode('/' ,dirname($_SERVER["SCRIPT_FILENAME"])), 0, -5), '/').'/tmp/nagvis/nagvis-conf');
++define('CONST_MAINCFG', $_base_dir.'/etc/nagvis/nagvis.ini.php');
++define('CONST_MAINCFG_CACHE', $_base_dir.'/tmp/nagvis/nagvis-conf');
  
  // Path to the main configuration conf.d directory
 -define('CONST_MAINCFG_DIR', '../../../etc/conf.d');
-+define('CONST_MAINCFG_DIR', join(array_slice(explode('/' ,dirname($_SERVER["SCRIPT_FILENAME"])), 0, -5), '/').'/etc/nagvis/conf.d');
++define('CONST_MAINCFG_DIR', $_base_dir.'/etc/nagvis/conf.d');
  
  // The directory below the NagVis root which is shared by the webserver
 -define('HTDOCS_DIR', 'share');



More information about the omd-commits mailing list