Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
a532c65c
Unverified
Commit
a532c65c
authored
5 years ago
by
Seamus Lee
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #16046 from seamuslee001/dev_core_1449_5_20
#1449
Do not dispatch pre and post hooks whilst we are in an …
parents
d22f50ae
87f319c3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Utils/Hook.php
+11
-0
11 additions, 0 deletions
CRM/Utils/Hook.php
with
11 additions
and
0 deletions
CRM/Utils/Hook.php
+
11
−
0
View file @
a532c65c
...
...
@@ -175,6 +175,7 @@ abstract class CRM_Utils_Hook {
// 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
;
...
...
@@ -371,6 +372,11 @@ abstract class CRM_Utils_Hook {
* 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
();
...
...
@@ -393,6 +399,11 @@ abstract class CRM_Utils_Hook {
* 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
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment