Merge pull request #19354 from demeritcowboy/php74-more-more
[civicrm-core.git] / CRM / Utils / Check / Component / Env.php
index 6b5f4f1778c4d0b53e646b8f76b6e79c2fb9bbaa..dc09691b9fb9594f4b44f481c06a585540abb4a2 100644 (file)
@@ -360,7 +360,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
 
     foreach ($settingNames as $settingName) {
       $settingValue = Civi::settings()->get($settingName);
-      if (!empty($settingValue) && $settingValue{0} != '[') {
+      if (!empty($settingValue) && $settingValue[0] != '[') {
         $hasOldStyle = TRUE;
         break;
       }
@@ -399,7 +399,7 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
 
     foreach ($settingNames as $settingName) {
       $settingValue = Civi::settings()->get($settingName);
-      if (!empty($settingValue) && $settingValue{0} != '[') {
+      if (!empty($settingValue) && $settingValue[0] != '[') {
         $hasOldStyle = TRUE;
         break;
       }
@@ -960,4 +960,19 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
     return $messages;
   }
 
+  public function checkWkHtmlToPDFPath() {
+    $messages = [];
+    $wkhtmltopdfPath = CRM_Core_Config::singleton()->wkhtmltopdfPath;
+    if (!empty($wkhtmltopdfPath) && !file_exists($wkhtmltopdfPath)) {
+      $messages[] = new CRM_Utils_Check_Message(
+        __FUNCTION__,
+        ts('CiviCRM is configured to use the wkhtmltopdf package to produce PDFs however it is missing, as such the system will fall back to using the DOMPDF package, this may mean that the output is different to what was expected. You should resolve this by either clearing the setting at Administer -> System Settings -> Miscellaneous or by getting your system administrator to install the wkhtmltopdf package'),
+        ts('Missing System Package: wkhtmltopdf'),
+        \Psr\Log\LogLevel::WARNING,
+        'fa-server'
+      );
+    }
+    return $messages;
+  }
+
 }