Merge pull request #19354 from demeritcowboy/php74-more-more
[civicrm-core.git] / CRM / Utils / Check / Component / Schema.php
index 33eef62216aca85dd8d5ae5d3d822d35f643f6c1..4e9e9c7ed7e0e1d37954adbdaff069e96da9395b 100644 (file)
@@ -19,7 +19,7 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component {
   /**
    * Check defined indices exist.
    *
-   * @return array
+   * @return CRM_Utils_Check_Message[]
    * @throws \CiviCRM_API3_Exception
    */
   public function checkIndices() {
@@ -62,7 +62,7 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component {
   }
 
   /**
-   * @return array
+   * @return CRM_Utils_Check_Message[]
    */
   public function checkMissingLogTables() {
     $messages = [];
@@ -91,9 +91,13 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component {
   /**
    * Check that no smart groups exist that contain deleted custom fields.
    *
-   * @return array
+   * @return CRM_Utils_Check_Message[]
    */
   public function checkSmartGroupCustomFieldCriteria() {
+    if (CRM_Core_BAO_Domain::isDBUpdateRequired()) {
+      // Do not run this check when the db has not been updated as it might fail on non-updated schema issues.
+      return [];
+    }
     $messages = $problematicSG = [];
     $customFieldIds = array_keys(CRM_Core_BAO_CustomField::getFields('ANY', FALSE, FALSE, NULL, NULL, FALSE, FALSE, FALSE));
     try {
@@ -178,4 +182,25 @@ class CRM_Utils_Check_Component_Schema extends CRM_Utils_Check_Component {
     return $messages;
   }
 
+  /**
+   * @return CRM_Utils_Check_Message[]
+   */
+  public function checkMoneyValueFormatConfig() {
+    $messages = [];
+    if (CRM_Core_Config::singleton()->moneyvalueformat !== '%!i') {
+      $msg = new CRM_Utils_Check_Message(
+        __FUNCTION__,
+        ts(
+          '<p>The Monetary Value Display format is a deprecated setting, and this site has a non-standard format. Please report your configuration on <a href="%1">this Gitlab issue</a>.',
+          [1 => 'https://lab.civicrm.org/dev/core/-/issues/1494']
+        ),
+        ts('Deprecated monetary value display format configuration'),
+        \Psr\Log\LogLevel::WARNING,
+        'fa-server'
+      );
+      $messages[] = $msg;
+    }
+    return $messages;
+  }
+
 }