Options: `register_uninstall_hook()` causes large amounts of unnecessary option updates.
Prevent extra database read/writes from the the hook. Props jeichorn, MikeHansenMe, DrewAPicture, Rahe, tha_sun, mikeschroder. Fixes #31792. Built from https://develop.svn.wordpress.org/trunk@46333 git-svn-id: http://core.svn.wordpress.org/trunk@46132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b6f7c0cbc4
commit
304c19dbac
|
@ -840,10 +840,12 @@ function register_uninstall_hook( $file, $callback ) {
|
|||
* cases. Emphasis should be put on using the 'uninstall.php' way of
|
||||
* uninstalling the plugin.
|
||||
*/
|
||||
$uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
|
||||
$uninstallable_plugins[ plugin_basename( $file ) ] = $callback;
|
||||
|
||||
update_option( 'uninstall_plugins', $uninstallable_plugins );
|
||||
$uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
|
||||
$plugin_basename = plugin_basename( $file );
|
||||
if ( ! isset( $uninstallable_plugins[ $plugin_basename ] ) || $uninstallable_plugins[ $plugin_basename ] !== $callback ) {
|
||||
$uninstallable_plugins[ $plugin_basename ] = $callback;
|
||||
update_option( 'uninstall_plugins', $uninstallable_plugins );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-beta1-46332';
|
||||
$wp_version = '5.3-beta1-46333';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue