Wp Upgrade, Improve populate_options() function
|Reported by:||twisted1919||Owned by:|
Today i tried to update one wp installation having 1.5 million records in the options table. Needless to say that the current populate_options() implementation is not ready to do this kind of upgrade.
The issue is that the populate_options() issues a sql query that asks for the entire table to be read in memory:
$existing_options = $wpdb->get_col("SELECT option_name FROM $wpdb->options");
I had to allocate 3 GB of memory and set the time limit to 0 in order to make through the upgrade process.
Please make sure the populate_options() can handle such high number of options to upgrade.