Avoid CiviCRM running full drupal cache flush, as this results in CiviCRM clobbering...
[civicrm-core.git] / CRM / Utils / Hook.php
index 60c1c088f00c851781ee790770f3e646be05a8ad..9f001877a27643a75f6003535d7b238ef92ea2e4 100644 (file)
@@ -81,7 +81,6 @@ abstract class CRM_Utils_Hook {
     if (self::$_singleton == NULL || $fresh) {
       $config = CRM_Core_Config::singleton();
       $class = $config->userHookClass;
-      require_once str_replace('_', DIRECTORY_SEPARATOR, $config->userHookClass) . '.php';
       self::$_singleton = new $class();
     }
     return self::$_singleton;
@@ -384,25 +383,6 @@ abstract class CRM_Utils_Hook {
     );
   }
 
-  /**
-   * This hook is invoked during all CiviCRM form validation. An array of errors
-   * detected is returned. Else we assume validation succeeded.
-   *
-   * @param string $formName
-   *   The name of the form.
-   * @param array &$fields the POST parameters as filtered by QF
-   * @param array &$files the FILES parameters as sent in by POST
-   * @param array &$form the form object
-   *
-   * @return mixed
-   *   formRule hooks return a boolean or
-   *                           an array of error messages which display a QF Error
-   */
-  public static function validate($formName, &$fields, &$files, &$form) {
-    return self::singleton()
-      ->invoke(4, $formName, $fields, $files, $form, self::$_nullObject, self::$_nullObject, 'civicrm_validate');
-  }
-
   /**
    * This hook is invoked during all CiviCRM form validation. An array of errors
    * detected is returned. Else we assume validation succeeded.
@@ -1340,7 +1320,7 @@ abstract class CRM_Utils_Hook {
    *   float $x x position in user units
    *   float $y y position in user units
    *   boolean $reseth if true reset the last cell height (default true).
-   *   int $stretch stretch carachter mode: <ul><li>0 = disabled</li><li>1 = horizontal scaling only if
+   *   int $stretch stretch character mode: <ul><li>0 = disabled</li><li>1 = horizontal scaling only if
    *                necessary</li><li>2 = forced horizontal scaling</li><li>3 = character spacing only if
    *                necessary</li><li>4 = forced character spacing</li></ul>
    *   boolean $ishtml set to true if $txt is HTML content (default = false).
@@ -1927,6 +1907,18 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * Check system status.
+   *
+   * @param array $messages
+   *   Array<CRM_Utils_Check_Message>. A list of messages regarding system status.
+   * @return mixed
+   */
+  public static function check(&$messages) {
+    return self::singleton()
+      ->invoke(1, $messages, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_check');
+  }
+
   /**
    * This hook is called when a query string of the CSV Batch export is generated.
    */
@@ -1947,4 +1939,22 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * This hook is called when core resources are being loaded
+   *
+   * @see CRM_Core_Resources::coreResourceList
+   *
+   * @param array $list
+   * @param string $region
+   */
+  public static function coreResourceList(&$list, $region) {
+    // First allow the cms integration to add to the list
+    CRM_Core_Config::singleton()->userSystem->appendCoreResources($list);
+
+    self::singleton()->invoke(2, $list, $region,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_coreResourceList'
+    );
+  }
+
 }