-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-20904 : joomla cron run - load all daos defined in extensions #10692
Conversation
jenkins, retest this please |
CRM/Utils/System/Joomla.php
Outdated
@@ -342,6 +342,8 @@ public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realP | |||
} | |||
CRM_Utils_System::loadBootStrap($bootStrapParams, TRUE, TRUE, FALSE); | |||
} | |||
//CRM-20904 Load all DAOs defined in hooks/extensions. | |||
CRM_Core_DAO_AllCoreTables::reinitializeCache(TRUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting.
If you said there was a bug with Joomla extensions where the cache in AllCoreTables
got stale, that would make sense. (IIRC, hook_civicrm_entityTypes
is actually a boot-critical hook -- the first hook fired. This would mean it fires before Civi has a chance to bootstrap Joomla, so it would initialize without the benefit of any CMS modules.)
Gonna see if I can replicate...
I've tried to reproduce the original issue (before patch). The steps taken were:
(Edit: using |
Thanks @totten Worth seeing if we get all |
OK, I get it now. IMHO, the problem is really with CRM_Utils_Hook_Joomla bailing out. It makes sense to skip stuff like Why? The issue affects all "boot-critical" hooks fired by Civi extensions -- i.e. I think this patch would have the effect of aligning Joomla behavior with Drupal/WordPress behavior: diff --git a/CRM/Utils/Hook/Joomla.php b/CRM/Utils/Hook/Joomla.php
index fd1793c..4e24264 100644
--- a/CRM/Utils/Hook/Joomla.php
+++ b/CRM/Utils/Hook/Joomla.php
@@ -123,6 +123,12 @@ class CRM_Utils_Hook_Joomla extends CRM_Utils_Hook {
}
return $result;
}
+ else {
+ // CRM-20904: We should still call Civi extension hooks even if Joomla isn't online yet.
+ return $this->commonInvoke($numParams,
+ $arg1, $arg2, $arg3, $arg4, $arg5, $arg6,
+ $fnSuffix, 'joomla');
+ }
}
} |
yes, thought about this but proceeded with the simple/safe approach of updating the static variable |
Tested the above diff on the affected site and it worked well in calling the extension hooks. I've updated the PR with the same. Thanks! |
@totten have your issues on this been addressed? |
3c27459
to
35e02b5
Compare
whoops, second commit was a partial update of this PR - thought I removed the original changes. I've updated it now. Thanks @eileenmcnaughton @totten |
@totten looks like this has ben adjusted to meet your requirements - can you recheck & hopefully merge |
I'm merging this as it seems fairly clear that the eventual patch was suggested by @totten (the reviewer) and tested by @jitendrapurohit & used to replace the original. I think Jitendra becomes the tester & - it's too confusing - but I think the final result represents a code collaboration & has been tested |
Joomla doesn't invoke any hooks until J_EXEC is set.
And when cron job is executed via URL - Config run loads all core DAO's in
$self::entityTypes
before joomla is actually bootstraped, this value is unchanged and only keeps core value defined in it.Fix here does a fresh load of all the DAO's defined in extensions, custom modules, etc soon after the bootstrap is done successfully.