From 8c520f09e1368b3ae2dfa605db68099660d3432d Mon Sep 17 00:00:00 2001 From: patrickebates Date: Mon, 14 Apr 2014 22:26:15 -0500 Subject: [PATCH] Merge in changes from WP 3.8.3 --- README.md | 2 +- wp-admin/about.php | 6 +++++- wp-admin/includes/post.php | 19 ++++++++++++------- wp-admin/includes/upgrade.php | 33 +++++++++++++++++++++++++++++++++ wp-includes/pn-version.php | 2 +- wp-includes/version.php | 4 ++-- 6 files changed, 54 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 655486375..3b6c78542 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Project Nami =============== -###Version: `0.9.12`### +###Version: `0.9.13`### ###Description:### diff --git a/wp-admin/about.php b/wp-admin/about.php index aa8a10693..ce9c80226 100644 --- a/wp-admin/about.php +++ b/wp-admin/about.php @@ -39,7 +39,11 @@
-

+

+

Version %1$s addressed %2$s bug.', + 'Version %1$s addressed %2$s bugs.', 2 ), '3.8.3', number_format_i18n( 2 ) ); ?> + the release notes.' ), 'http://codex.wordpress.org/Version_3.8.3' ); ?> +

Version %1$s addressed some security issues and fixed %2$s bug.', 'Version %1$s addressed some security issues and fixed %2$s bugs.', 9 ), '3.8.2', number_format_i18n( 9 ) ); ?> the release notes.' ), 'http://codex.wordpress.org/Version_3.8.2' ); ?> diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index bd624979c..11aa9cf8f 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -203,10 +203,6 @@ function edit_post( $post_data = null ) { _wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_ID ) ); } - if ( ( empty( $post_data['action'] ) || 'autosave' != $post_data['action'] ) && 'auto-draft' == $post_data['post_status'] ) { - $post_data['post_status'] = 'draft'; - } - if ( isset($post_data['visibility']) ) { switch ( $post_data['visibility'] ) { case 'public' : @@ -227,6 +223,10 @@ function edit_post( $post_data = null ) { if ( is_wp_error($post_data) ) wp_die( $post_data->get_error_message() ); + if ( ( empty( $post_data['action'] ) || 'autosave' != $post_data['action'] ) && 'auto-draft' == $post_data['post_status'] ) { + $post_data['post_status'] = 'draft'; + } + // Post Formats if ( isset( $post_data['post_format'] ) ) set_post_format( $post_ID, $post_data['post_format'] ); @@ -411,7 +411,12 @@ function bulk_edit_posts( $post_data = null ) { } $updated = $skipped = $locked = array(); + $shared_post_data = $post_data; + foreach ( $post_IDs as $post_ID ) { + // Start with fresh post data with each iteration. + $post_data = $shared_post_data; + $post_type_object = get_post_type_object( get_post_type( $post_ID ) ); if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( 'edit_post', $post_ID ) ) { @@ -460,13 +465,13 @@ function bulk_edit_posts( $post_data = null ) { $post_data['ID'] = $post_ID; $post_data['post_ID'] = $post_ID; - $translated_post_data = _wp_translate_postdata( true, $post_data ); - if ( is_wp_error( $translated_post_data ) ) { + $post_data = _wp_translate_postdata( true, $post_data ); + if ( is_wp_error( $post_data ) ) { $skipped[] = $post_ID; continue; } - $updated[] = wp_update_post( $translated_post_data ); + $updated[] = wp_update_post( $post_data ); if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) { if ( 'sticky' == $post_data['sticky'] ) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 057b44c82..685819692 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -338,6 +338,9 @@ function upgrade_all() { populate_options(); + if ( $wp_current_db_version < 26692 ) + upgrade_383(); + maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -381,6 +384,36 @@ 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 * diff --git a/wp-includes/pn-version.php b/wp-includes/pn-version.php index e3befe215..0af2f2800 100644 --- a/wp-includes/pn-version.php +++ b/wp-includes/pn-version.php @@ -1,5 +1,5 @@ diff --git a/wp-includes/version.php b/wp-includes/version.php index b24963273..15ae453cb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,14 +4,14 @@ * * @global string $wp_version */ -$wp_version = '3.8.2'; +$wp_version = '3.8.3'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * * @global int $wp_db_version */ -$wp_db_version = 26691; +$wp_db_version = 26692; /** * Holds the TinyMCE version