Permalink
Browse files

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
  • Loading branch information...
1 parent 95e5caf commit e79a56793c1149737907d514c91b2c148aa8751b @nacin nacin committed Aug 16, 2012
Showing with 15 additions and 3 deletions.
  1. +15 −3 wp-admin/includes/upgrade.php
View
18 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
*/
@@ -1927,6 +1927,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.
*
* @since 2.9.0

0 comments on commit e79a567

Please sign in to comment.