From c12eb8447485ccac17b9aedc4e5d600f62bce489 Mon Sep 17 00:00:00 2001 From: rob1n Date: Sun, 29 Apr 2007 20:53:29 +0000 Subject: [PATCH] Automattically deactivate Automattic Widgets, if activated. see #4169 git-svn-id: https://develop.svn.wordpress.org/trunk@5344 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/upgrade-functions.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index c403340e07..055af65318 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -188,6 +188,8 @@ function upgrade_all() { if ( $wp_current_db_version < 5200 ) { upgrade_230(); } + + maybe_disable_automattic_widgets(); $wp_rewrite->flush_rules(); @@ -1111,4 +1113,13 @@ function wp_check_mysql_version() { die(sprintf(__('ERROR: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version)); } -?> +function maybe_disable_automattic_widgets() { + $plugins = __get_option( 'active_plugins' ); + + if ( in_array( 'widgets/widgets.php', $plugins ) ) { + array_splice( $plugins, array_search( 'widgets/widgets.php', $plugins ), 1 ); + update_option( 'active_plugins', $plugins ); + } +} + +?> \ No newline at end of file