1

I am getting random errors when I first log into Civicrm on Wordpress. It seems to be related to the check of existing indexes versus required indexes.

Warning: Invalid argument supplied for foreach() in /home/sporti62/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/SchemaHandler.php on line 750

Is there a tool where I can have the indexes checked and possibly rebuilt?

Norm

2

If there are indices problem, you can get false indices displayed on Administer -> Administration Console -> System Status page.

It will list the wrong indices in your table with the Update Indices button to rebuild them.

enter image description here

The above button tries to delete the listed false indices and recreate them in the correct order. If for some reason the Update Indices is unable to clear the message, you can manually delete the indices from the Table Name shown in the above screen and then create them using the same button.

Note that you can only see this message and button if your civi version is <= 4.7.29. From 4.7.30, this message is hidden via CRM-21298.

So, on version >= 4.7.30, as this UI is not present, you can try rebuilding them using the api via API explorer from Support -> Developer -> API Explorer with

Entity = System and Action = updateindexes (present on all versions).

  • Ok, thanks for this. I'm running 4.7.29 so I ran the API updateindexes. Unfortunately I continue to get the error noted in the original issue. It can't seem to evaluate between existing indexes and required indexes? Where does it get the list of required indexes for the comparison? Perhaps there is an issue there. – Norm Dressler Jan 8 '18 at 14:28
  • Interesting - I migrated a copy of production to a local VM running LAMP and I don't seem to get that error there! – Norm Dressler Jan 8 '18 at 21:16
  • Do you see the screenshot on the "System Status" page? i.e, any false indices showing up there? If not, try rebuilding the menu using http://<yourdomain>/civicrm/menu/rebuild?reset=1 in the URL and clearing drupal cache. – jitendra - fuzion Jan 9 '18 at 4:38
0

I have seen same issue before and for same index 'UI_case_contact_id'. The reason is 'update indices' script tries to recreate the index which already exists so we need to delete the existing 'UI_case_contact_id' index and let the script create from scratch but before that you would need to create a temporary foreign key which will be deleted at the end of all steps. Follow the following steps to fix it:

  1. Create temporary foreign key by SQL command:

    CREATE UNIQUE INDEX my_temp_key ON civicrm_case_contact (case_id, contact_id);

  2. Delete index UI_case_contact_id:

    DROP INDEX UI_case_contact_id ON civicrm_case_contact;

  3. Run the 'Update indices' script
  4. Delete temporary key that was created:

    DROP INDEX my_temp_key ON civicrm_case_contact;

  • It's not me who is missing or have an issue with that index - its the replier to my original post. Mine isn't showing any missing indexes, just the error. – Norm Dressler Jan 8 '18 at 19:48

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.