Relaunch 4.2 utf8mb4 database upgrade

I think the answer to your question right now is “No”.

There is no easy way to trigger maybe_convert_table_to_utf8mb4 on sites once they were already upgraded beyond WP 4.3 on a server that didn’t meet the requirements laid out in this post:

https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/

Note that, based on looking at WP source code, it seems they moved this from 4.2’s update sequence to 4.3 (it’s no longer present in 4.2, which now has no upgrades at all), maybe hoping to get more users on board.

So that’s your answer and it sucks but is more accurate than the others ¯_(ツ)_/¯

We’re currently working on making a simple script that lets you trigger the essence of the upgrade sequence based on an action hook. If we can get it stable and working we’ll try to come back and share it here for others to use.

Our basic plan is to extract the actual db part of upgrade_430(), isolate it from the db update system, and trigger it manually.

EDIT: SOLUTION BELOW

While there’s no easy way to trigger the script, here’s a hand-coded workaround, based on upgrade_430() but designed as a drop-in.

https://gist.github.com/carlalexander/4106cfaaf405cec454ba195631bcb6bc

You could put this in a plugin, or just paste it in your functions.php. Either way it should be TEMPORARY.

It’s set up to trigger automatically when you visit https://yoursite.com/?update-utf8bm4=1

This ensures that it only runs a single time and you get to choose when (for large databases it could take awhile and you don’t want to have anyone editing a post while it’s happening).

If you don’t want to have the GET trigger just remove the add_action part and the if (!isset($_GET['update-utf8bm4'])) part.

Again: REMOVE THIS WHEN COMPLETE, you don’t want to leave a GET trigger like this lying around 🙂

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)