2

Sometimes I install an extension that creates a new MySQL table, but it breaks because I have binary ("advanced") logging enabled. CiviCRM tries to write to the binary log, and it fails because the table doesn't exist.

Other times, there's a corrupt binary log table, which I can only fix by dropping it.

In these situations, I know that disabling and re-enabling binary logging will fix the situation, but then I lose my existing logs! Is there another less destructive solution?

3

As of CiviCRM 4.7, you can fix this by installing any extension; see CRM-15078. Schema differences are fixed on extension installation.

If you are on an earlier version of CiviCRM, there's a trick you can do. Edit the PHP for a page that doesn't normally get used - I like the API Explorer page (CRM/Admin/Page/APIExplorer.php).

Right after public function run() {, I put:

$temp = new CRM_Logging_Schema();
$temp->fixSchemaDifferences(TRUE);
echo "Binary log schema differences are now fixed.";
die;

Once I get back the "now fixed" message, I remove the code from the page and everything works.

  • 2
    I was the one who fixed that bug at the sprint, it happened to be something I had already encountered. In one of my extensions that creates a custom entity type, I put the fixSchemaDifferences stuff in the extension's hook_civicrm_enable instance, so the extension works on older versions with logging too. – DaveFF Jan 8 '16 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.