CRM-13292 fix
authormonishdeb <monish.deb@webaccess.co.in>
Thu, 29 Aug 2013 13:34:21 +0000 (19:04 +0530)
committermonishdeb <monish.deb@webaccess.co.in>
Thu, 29 Aug 2013 13:34:21 +0000 (19:04 +0530)
----------------------------------------
* CRM-13292: wkhtmltopdf setting should allow use of xvfb-run
  http://issues.civicrm.org/jira/browse/CRM-13292

CRM/Admin/Form/Setting/Miscellaneous.php

index 38b64eb9b630f8655d5d1322c29e811c255bf4d7..c75bbd4adbb8014390220c552697b56e4b77013f 100644 (file)
@@ -122,9 +122,13 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
     if (!empty($fields['wkhtmltopdfPath'])) {
       // check and ensure that thi leads to the wkhtmltopdf binary
       // and it is a valid executable binary
+      // Only check the first space separated piece to allow for a value
+      // such as /usr/bin/xvfb-run -- wkhtmltopdf (CRM-13292)
+      $pieces = explode(' ', $fields['wkhtmltopdfPath']);
+      $path = $pieces[0];
       if (
-        !file_exists($fields['wkhtmltopdfPath']) ||
-        !is_executable($fields['wkhtmltopdfPath'])
+        !file_exists($path) ||
+        !is_executable($path)
       ) {
         $errors['wkhtmltopdfPath'] = ts('The wkhtmltodfPath does not exist or is not valid');
       }