Skip to content

Commit

Permalink
Merge pull request #16049 from civicrm/5.21
Browse files Browse the repository at this point in the history
5.21
  • Loading branch information
eileenmcnaughton authored Dec 9, 2019
2 parents fd2b370 + 76ade0b commit 249f085
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CRM/Utils/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public function invoke(
// quantities of low-importance data or the table not having an id field, which could cause a fatal error.
// Instead of not calling any hooks we only call those we know to be frequently important - if a particular extension wanted
// to avoid this they could do an early return on CRM_Core_Config::singleton()->isUpgradeMode
// Futther discussion is happening at https://lab.civicrm.org/dev/core/issues/1460
$upgradeFriendlyHooks = ['civicrm_alterSettingsFolders', 'civicrm_alterSettingsMetaData', 'civicrm_triggerInfo', 'civicrm_alterLogTables', 'civicrm_container'];
if (CRM_Core_Config::singleton()->isUpgradeMode() && !in_array($fnSuffix, $upgradeFriendlyHooks)) {
return;
Expand Down Expand Up @@ -355,6 +356,11 @@ public function requireCiviModules(&$moduleList) {
* the return value is ignored
*/
public static function pre($op, $objectName, $id, &$params) {
// Dev/core#1449 DO not dispatch hook_civicrm_pre if we are in an upgrade as this cases the upgrade to fail
// Futher discussion is happening at https://lab.civicrm.org/dev/core/issues/1460
if (CRM_Core_Config::singleton()->isUpgradeMode()) {
return;
}
$event = new \Civi\Core\Event\PreEvent($op, $objectName, $id, $params);
\Civi::dispatcher()->dispatch('hook_civicrm_pre', $event);
return $event->getReturnValues();
Expand All @@ -377,6 +383,11 @@ public static function pre($op, $objectName, $id, &$params) {
* an error message which aborts the operation
*/
public static function post($op, $objectName, $objectId, &$objectRef = NULL) {
// Dev/core#1449 DO not dispatch hook_civicrm_post if we are in an upgrade as this cases the upgrade to fail
// Futher discussion is happening at https://lab.civicrm.org/dev/core/issues/1460
if (CRM_Core_Config::singleton()->isUpgradeMode()) {
return;
}
$event = new \Civi\Core\Event\PostEvent($op, $objectName, $objectId, $objectRef);
\Civi::dispatcher()->dispatch('hook_civicrm_post', $event);
return $event->getReturnValues();
Expand Down

0 comments on commit 249f085

Please sign in to comment.