From 958bb9ce049c25246b103a8810cdbeb5133b6ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Champagne?= Date: Wed, 27 Feb 2013 15:56:53 -0500 Subject: [PATCH] Use kernel.rootdir to look for custom config, Use the root dir instead of relative ../../.. had a bug with ISPConfig because of the open basedir restrictions. --- Resources/config/services.yml | 2 +- Wrapper/DompdfWrapper.php | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Resources/config/services.yml b/Resources/config/services.yml index c7585bb..5a0feed 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -4,4 +4,4 @@ parameters: services: slik_dompdf: class: Slik\DompdfBundle\Wrapper\DompdfWrapper - arguments: [] + arguments: ["%kernel.root_dir%"] diff --git a/Wrapper/DompdfWrapper.php b/Wrapper/DompdfWrapper.php index 24508ab..2364483 100644 --- a/Wrapper/DompdfWrapper.php +++ b/Wrapper/DompdfWrapper.php @@ -22,13 +22,12 @@ class DompdfWrapper public function getpdf($html) { // test if dompdf config exists in symfony app folder - $testFilePath = "/../../../../../../app/dompdf_config.inc.php"; - if (file_exists(dirname(__FILE__).$testFilePath)) { - require_once(dirname(__FILE__).$testFilePath); - } - else { - require_once dirname(__FILE__).'/../DomPDF/dompdf_config.inc.php'; - } + $testFilePath = $this->root_dir . "/dompdf_config.inc.php"; + if (file_exists($testFilePath)) { + require_once($testFilePath); + } else { + require_once dirname(__FILE__) . '/../DomPDF/dompdf_config.inc.php'; + } $this->pdf = new \DOMPDF();