From e79a56793c1149737907d514c91b2c148aa8751b Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 16 Aug 2012 23:08:07 +0000 Subject: [PATCH] Disable the Link Manager on any future upgrade if it is still enabled but there are no links. see #21307. git-svn-id: http://core.svn.wordpress.org/trunk@21536 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/upgrade.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 06273b0175..d71163ef5c 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -402,6 +402,8 @@ function upgrade_all() { if ( $wp_current_db_version < 21501 ) upgrade_350(); + maybe_disable_link_manager(); + maybe_disable_automattic_widgets(); update_option( 'db_version', $wp_db_version ); @@ -1908,9 +1910,7 @@ function wp_check_mysql_version() { } /** - * {@internal Missing Short Description}} - * - * {@internal Missing Long Description}} + * Disables the Automattic widgets plugin, which was merged into core. * * @since 2.2.0 */ @@ -1926,6 +1926,18 @@ function maybe_disable_automattic_widgets() { } } +/** + * Disables the Link Manager on upgrade, if at the time of upgrade, no links exist in the DB. + * + * @since 3.5.0 + */ +function maybe_disable_link_manager() { + global $wp_current_db_version, $wpdb; + + if ( $wp_current_db_version >= 21501 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) ) + update_option( 'link_manager_enabled', 0 ); +} + /** * Runs before the schema is upgraded. *