Details
-
Type: Bug
-
Status: Won't Do
-
Priority: Trivial
-
Resolution: Won't Do
-
Affects Version/s: 4.7.28
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
-
Verified?:No
Description
When enabling logging on one CiviCRM instance, i've got the message "DB error" and the logging is not enabled.
It seems to come from a string replacement that don't work well in my case in CRM/Logging/Schema.php -> fixTimeStampAndNotNullSQL :
$query = str_ireplace("DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", '', $query);
For some reason, in this instance, there is sometimes CURRENT_TIMESTAMP and sometimes CURRENT_TIMESTAMP() – the later is not replaced by the str_ireplace.
Without trying to understand why it's sometimes a syntax or another, a quick fix is to first replace all CURRENT_TIMESTAMP() to CURRENT_TIMESTAMP before doing the more advanced replacement like so :
$query = str_ireplace("CURRENT_TIMESTAMP()", "CURRENT_TIMESTAMP", $query); $query = str_ireplace("DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", '', $query);
Attachments
Issue Links
- duplicates
-
CRM-21687 MariaDB 10.2 and logging: log_civicrm_activity schema syntax error
- Done/Fixed