From 872c740d983412ada07a7026bfa8d4c770883208 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 24 Nov 2012 15:31:57 +0100 Subject: [PATCH] patches/: adjust-template-path: Fixed the patch for empty templates.d. Some versions of glob() return nothing in this case, resulting in PHP syntax errors and a crash of PNP4Nagios. Thanks to Christoph Anton Mitterer for reporting this and pointing out a fix! Closes: #683138 --- debian/changelog | 5 +++++ debian/patches/adjust-template-path | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 74f5f1c..0748750 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,11 @@ pnp4nagios (0.6.16-2) UNRELEASED; urgency=low - Adapted versioned build-dep on libjs-jquery-ui to the workaround used by that package (1.8.14 -> 1.8.ooops.14). Thanks to Christoph Anton Mitterer for reporting this (Closes: #683100). + * debian/patches/: + - adjust-template-path: Fixed the patch for empty templates.d and some + versions of glob() which in this case returns nothing resulting in PHP + syntax errors and a crash of PNP4Nagios; thanks to Christoph Anton + Mitterer for reporting this and pointing out a fix (Closes: #683138). -- Sebastian Harl Wed, 01 Aug 2012 13:05:54 +0200 diff --git a/debian/patches/adjust-template-path b/debian/patches/adjust-template-path index 263d9b5..15bcf6a 100644 --- a/debian/patches/adjust-template-path +++ b/debian/patches/adjust-template-path @@ -5,14 +5,17 @@ Forwarded: not-needed --- a/sample-config/pnp/config.php.in +++ b/sample-config/pnp/config.php.in -@@ -214,12 +214,15 @@ +@@ -214,12 +214,18 @@ # Add your own template directories here # First match wins! #$conf['template_dirs'][] = '/usr/local/check_mk/pnp-templates'; -$conf['template_dirs'][] = '@datarootdir@/templates'; +$conf['template_dirs'][] = '@sysconfdir@/templates'; -+foreach (glob("/etc/pnp4nagios/templates.d/*", GLOB_ONLYDIR) as $dirname) { -+ $conf['template_dirs'][] = "$dirname"; ++$templates_d = glob("/etc/pnp4nagios/templates.d/*", GLOB_ONLYDIR); ++if (is_array($templates_d) && (count($templates_d) > 0)) { ++ foreach ($templates_d as $dirname) { ++ $conf['template_dirs'][] = "$dirname"; ++ } +} $conf['template_dirs'][] = '@datarootdir@/templates.dist'; -- 2.30.2