From 29aaa363b41cb66bf3566afee4ee94a6d30f5ac3 Mon Sep 17 00:00:00 2001
From: Johannes Meyer <johannes.meyer@icinga.com>
Date: Tue, 14 Jan 2020 10:59:01 +0100
Subject: [PATCH 1/2] Pdf: Utilize an pdfexport hook without calling
 `isSupported()`

If it's not supported, users should disable the module. If there
are multiple hooks supported at some point we need to touch this
again anyways. So that should suffice for now.
---
 library/Icinga/File/Pdf.php | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/library/Icinga/File/Pdf.php b/library/Icinga/File/Pdf.php
index dfe8f74d3..c0c8d116e 100644
--- a/library/Icinga/File/Pdf.php
+++ b/library/Icinga/File/Pdf.php
@@ -70,17 +70,14 @@ class Pdf
 
         if (Hook::has('Pdfexport')) {
             $pdfexport = Hook::first('Pdfexport');
+            $pdfexport->streamPdfFromHtml($html, sprintf(
+                '%s-%s-%d',
+                $request->getControllerName(),
+                $request->getActionName(),
+                time()
+            ));
 
-            if ($pdfexport->isSupported()) {
-                $pdfexport->streamPdfFromHtml($html, sprintf(
-                    '%s-%s-%d',
-                    $request->getControllerName(),
-                    $request->getActionName(),
-                    time()
-                ));
-
-                return;
-            }
+            return;
         }
 
         $options = new Options();

From 6a8f17faf2be7743e495435e582dec93bbe8aad2 Mon Sep 17 00:00:00 2001
From: Johannes Meyer <johannes.meyer@icinga.com>
Date: Tue, 14 Jan 2020 11:01:53 +0100
Subject: [PATCH 2/2] OutputFormat: Just provide the pdf export if there's a
 hook available

Calling `isSupported()` is bad here since there may be IO involved.
---
 library/Icinga/Web/Widget/Tabextension/OutputFormat.php | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/library/Icinga/Web/Widget/Tabextension/OutputFormat.php b/library/Icinga/Web/Widget/Tabextension/OutputFormat.php
index ea33485e9..d5d83aff5 100644
--- a/library/Icinga/Web/Widget/Tabextension/OutputFormat.php
+++ b/library/Icinga/Web/Widget/Tabextension/OutputFormat.php
@@ -82,11 +82,7 @@ class OutputFormat implements Tabextension
     {
         $supportedTypes = array();
 
-        $pdfexport = false;
-
-        if (Hook::has('Pdfexport')) {
-            $pdfexport = Hook::first('Pdfexport')->isSupported();
-        }
+        $pdfexport = Hook::has('Pdfexport');
 
         if ($pdfexport || Platform::extensionLoaded('gd')) {
             $supportedTypes[self::TYPE_PDF] = array(