fix detailed logs not showing user ID - #369
Open
MegaphoneJon wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
If you have detailed (trigger-based) logging enabled in WordPress, it no longer records the user ID who instigated the action. This regressed at least 6 months ago.
To replicate: Enabled detailed logging on WP, then make a change (in the web UI, so a user ID is associated with the change). The change will be recorded, but
log_user_idwill beNULL.Before
No user ID recorded.
After
User ID recorded.
Technical Details
The user id is set by a SQL statement in
CRM_Core_Config::authenticate(), which is called duringCRM_Core_Config::singleton()(called on line 502) - but only the first time it's instantiated. But the user ID isn't known untilCRM_Core_BAO_UFMatch::synchronize()is called (line 510). So we callauthenticate()again to set the user ID correctly.