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. git-svn-id: https://develop.svn.wordpress.org/trunk@46333 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f2e9aa79f5
commit
ea1d3b13cc
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user