Today I spent some time upgrading ACF from version 4 to 5.0.2 with some issues and just want to share what I changed if that can help anyone.
Files update had no issues but database upgrade got stuck on the page where it says “Reading upgrade tasks… Upgrading data to version 5.0.0” (By the way it says 5.0.0 even if I use 5.0.2).
I waited a long time waiting for a confirmation message or something but nothing came after 30 minutes. I tried again and then trouble started. Field groups got duplicated. My site has 30 field groups and a total of 308 fields.
I checked database and checked ACF code to better understand what’s going on. I reverted to backup and tried again.
It converted a few groups and a few fields (around 50 fields) and then stopped (but the little wheel was still turning and no error message). Only first groups in alphabetic order were converted.
But I found this in PHP error log:
PHP Fatal error: Maximum execution time of 30 seconds exceeded in /wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 702, referer: /wp-admin/edit.php?post_type=acf-field-group&page=acf-upgrade
Because of so many groups and fields, the upgrade script had no time to complete all updates. I then added set_time_limit(1000);
in /wp-content/plugins/advanced-custom-fields-pro/admin/updates/5.0.0.php, reverted again to backup database and ran the script again.
After waiting a few minutes, all field groups and fields were updated and the update script completed successfully.
Hi @ptitsuisse
Thanks a million for the feedback and data.
Looks like the super cache plugin is running during the upgrade process and WP is running out of time and memory doing too much!
I wonder If I can tell all caching plugins to turn off during the upgrade process.
Sounds like a better idea to deal with caching then increasing the execution limit.