X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FHook.php;h=c697851787d8ad3eafce484fe25accd10a148696;hb=4b4b8a02477c56182c8df6def1ba14987033dd65;hp=d2fb744c88439184311e67f6ccecfb3c853134b7;hpb=3eaa853f566bbcbea2708db15ec3c542efdc8ded;p=civicrm-core.git diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index d2fb744c88..c697851787 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -1676,6 +1676,22 @@ abstract class CRM_Utils_Hook { ); } + /** + * (EXPERIMENTAL) Scan extensions for a list of auto-registered interfaces. + * + * This hook is currently experimental. It is a means to implementing `mixin/scan-classes@1`. + * If there are no major difficulties circa 5.55, then it can be marked stable. + * + * @param string[] $classes + * List of classes which may be of interest to the class-scanner. + */ + public static function scanClasses(array &$classes) { + self::singleton()->invoke(['classes'], $classes, self::$_nullObject, + self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, + 'civicrm_scanClasses' + ); + } + /** * This hook is called when we are determining the contactID for a specific * email address @@ -1865,15 +1881,41 @@ abstract class CRM_Utils_Hook { } /** - * This hook is called when a module-extension is installed. - * Each module will receive hook_civicrm_install during its own installation (but not during the - * installation of unrelated modules). + * Run early installation steps for an extension. Ex: Create new MySQL table. + * + * This dispatches directly to each new extension. You will only receive notices for your own installation. + * + * If multiple extensions are installed simultaneously, they will all run + * `hook_install`/`hook_enable` back-to-back (in order of dependency). + * + * This runs BEFORE refreshing major caches and services (such as + * `ManagedEntities` and `CRM_Logging_Schema`). + * + * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install */ public static function install() { // Actually invoke via CRM_Extension_Manager_Module::callHook throw new \RuntimeException(sprintf("The method %s::%s is just a documentation stub and should not be invoked directly.", __CLASS__, __FUNCTION__)); } + /** + * Run later installation steps. Ex: Call a bespoke API-job for the first time. + * + * This dispatches directly to each new extension. You will only receive notices for your own installation. + * + * If multiple extensions are installed simultaneously, they will all run + * `hook_postInstall` back-to-back (in order of dependency). + * + * This runs AFTER refreshing major caches and services (such as + * `ManagedEntities` and `CRM_Logging_Schema`). + * + * @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postInstall + */ + public static function postInstall() { + // Actually invoke via CRM_Extension_Manager_Module::callHook + throw new \RuntimeException(sprintf("The method %s::%s is just a documentation stub and should not be invoked directly.", __CLASS__, __FUNCTION__)); + } + /** * This hook is called when a module-extension is uninstalled. * Each module will receive hook_civicrm_uninstall during its own uninstallation (but not during the @@ -2755,6 +2797,21 @@ abstract class CRM_Utils_Hook { ); } + /** + * Fired if the status of a queue changes. + * + * @param \CRM_Queue_Queue $queue + * @param string $status + * New status. + * Ex: 'completed', 'active', 'aborted' + */ + public static function queueStatus(CRM_Queue_Queue $queue, string $status): void { + self::singleton()->invoke(['queue', 'status'], $queue, $status, + self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, + 'civicrm_queueStatus' + ); + } + /** * This is called if automatic execution of a queue-task fails. *