Skip to content

Commit

Permalink
Disable the Link Manager on any future upgrade if it is still enabled…
Browse files Browse the repository at this point in the history
… 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
nacin committed Aug 16, 2012
1 parent 95e5caf commit e79a567
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions wp-admin/includes/upgrade.php
Expand Up @@ -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 );
Expand Down Expand Up @@ -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
*/
Expand All @@ -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.
*
Expand Down

0 comments on commit e79a567

Please sign in to comment.