-
-
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
Civi::rebuild() - Consolidate super-functions rebuildMenuAndCaches, flushCache, and cleanupCaches #32065
base: master
Are you sure you want to change the base?
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
This looks great @totten . Will try r-running it on some dev sites now :) |
Thanks @ufundo. I've pushed a change in the signature (but not in the main behavior). While re-reading today, it struck me that a lot of Civi::rebuild('*')->execute(); That style is more forward-looking (i.e. one can chain-in new methods without breaking things). I don't want to speculate too much about what those methods should be. (I think the The last commit simply moves the bulk of the code from |
Overview
When doing a general flush/rebuild/reset, one invokes a few gnarly functions. This combines them. The result is still a bit gnarly, but it improves the situation in that:
Before
Civi has many helpers for batch-clearing/batch-rebuilding of caches
CRM_Core_Invoke::rebuildMenuAndCaches(bool $triggerRebuild = FALSE, bool $sessionReset = FALSE)
CRM_Utils_System::flushCache()
CRM_Core_Config::cleanupCaches($sessionReset = FALSE)
All of these are super-functions touching multiple (qualitatively different) structures. The names sound alike. They also call each other. But the lines between them aren't particularly clear. The names put them in a support-gray-zone (sort-of-private; sort-of-public). The functionality is fairly important, so they wind up being used by contrib.
After
All the functions have been merged into one
Civi::rebuild($targets)
, e.g.The original functions are preserved with stubs to call
Civi::rebuild()
.(EDIT: Original draft was non-fluent. Added
execute()
to make style more fluent.)Comments
System.flush
API should be expanded to pass-through more of these keys. (However, in terms of making a robust mechanism that can recover the system from weird states... the API has the challenge of being tied-up with all the same data-structures that are being rebuilt. Keeping the guts of it as plain PHP feels safer.)