From a05a61883039d38855b2a6a545b571503edaf5d5 Mon Sep 17 00:00:00 2001 From: patrickebates Date: Fri, 25 Apr 2014 08:53:38 -0500 Subject: [PATCH] Add upgrade_383 back in and restore upgrade commands for other earlier versions --- wp-admin/includes/upgrade.php | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index dd0f1c633..f88cd12ed 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -357,6 +357,15 @@ function upgrade_all() { populate_options(); + if ( $wp_current_db_version < 25824 ) + upgrade_370(); + + if ( $wp_current_db_version < 26148 ) + upgrade_372(); + + if ( $wp_current_db_version < 26691 ) + upgrade_380(); + if ( $wp_current_db_version < 26692 ) upgrade_383(); @@ -403,6 +412,34 @@ function upgrade_380() { deactivate_plugins( array( 'mp6/mp6.php' ), true ); } } +/** + * Execute changes made in WordPress 3.8.3. + * + * @since 3.8.3 + */ +function upgrade_383() { + global $wp_current_db_version, $wpdb; + if ( $wp_current_db_version < 26692 ) { + // Find all lost Quick Draft auto-drafts and promote them to proper drafts. + $posts = $wpdb->get_results( "SELECT ID, post_title, post_content FROM $wpdb->posts WHERE post_type = 'post' + AND post_status = 'auto-draft' AND post_date >= '2014-04-08 00:00:00'" ); + + foreach ( $posts as $post ) { + // A regular auto-draft should never have content as that would mean it should have been promoted. + // If an auto-draft has content, it's from Quick Draft and it should be recovered. + if ( '' === $post->post_content ) { + // If it does not have content, we must evaluate whether the title should be recovered. + if ( 'Auto Draft' === $post->post_title || __( 'Auto Draft' ) === $post->post_title ) { + // This a plain old auto draft. Ignore it. + continue; + } + } + + $wpdb->update( $wpdb->posts, array( 'post_status' => 'draft' ), array( 'ID' => $post->ID ) ); + clean_post_cache( $post->ID ); + } + } +} /** * Execute network level changes *