Changeset 47922
- Timestamp:
- 06/07/2020 09:22:07 AM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/bookmark.php
r47851 r47922 206 206 if ( false === $wpdb->update( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ), compact( 'link_id' ) ) ) { 207 207 if ( $wp_error ) { 208 return new WP_Error( 'db_update_error', __( 'Could not update link in the database ' ), $wpdb->last_error );208 return new WP_Error( 'db_update_error', __( 'Could not update link in the database.' ), $wpdb->last_error ); 209 209 } else { 210 210 return 0; … … 214 214 if ( false === $wpdb->insert( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ) ) ) { 215 215 if ( $wp_error ) { 216 return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database ' ), $wpdb->last_error );216 return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database.' ), $wpdb->last_error ); 217 217 } else { 218 218 return 0; -
trunk/src/wp-includes/comment.php
r47887 r47922 2306 2306 if ( ! $wpdb->update( $wpdb->comments, array( 'comment_approved' => $status ), array( 'comment_ID' => $comment_old->comment_ID ) ) ) { 2307 2307 if ( $wp_error ) { 2308 return new WP_Error( 'db_update_error', __( 'Could not update comment status ' ), $wpdb->last_error );2308 return new WP_Error( 'db_update_error', __( 'Could not update comment status.' ), $wpdb->last_error ); 2309 2309 } else { 2310 2310 return false; -
trunk/src/wp-includes/post.php
r47892 r47922 3644 3644 $post_ID = $postarr['ID']; 3645 3645 $post_before = get_post( $post_ID ); 3646 3646 3647 if ( is_null( $post_before ) ) { 3647 3648 if ( $wp_error ) { … … 3662 3663 $post_content = $postarr['post_content']; 3663 3664 $post_excerpt = $postarr['post_excerpt']; 3665 3664 3666 if ( isset( $postarr['post_name'] ) ) { 3665 3667 $post_name = $postarr['post_name']; … … 3700 3702 3701 3703 $post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status']; 3704 3702 3705 if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash', 'auto-draft' ), true ) ) { 3703 3706 $post_status = 'inherit'; … … 3745 3748 // On updates, we need to check to see if it's using the old, fixed sanitization context. 3746 3749 $check_name = sanitize_title( $post_name, '', 'old-save' ); 3750 3747 3751 if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) { 3748 3752 $post_name = $check_name; … … 3876 3880 if ( 'trash' === $previous_status && 'trash' !== $post_status ) { 3877 3881 $desired_post_slug = get_post_meta( $post_ID, '_wp_desired_post_slug', true ); 3882 3878 3883 if ( $desired_post_slug ) { 3879 3884 delete_post_meta( $post_ID, '_wp_desired_post_slug' ); … … 3918 3923 if ( isset( $data[ $emoji_field ] ) ) { 3919 3924 $charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field ); 3925 3920 3926 if ( 'utf8' === $charset ) { 3921 3927 $data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] ); … … 3951 3957 $data = apply_filters( 'wp_insert_post_data', $data, $postarr, $unsanitized_postarr ); 3952 3958 } 3959 3953 3960 $data = wp_unslash( $data ); 3954 3961 $where = array( 'ID' => $post_ID ); … … 3964 3971 */ 3965 3972 do_action( 'pre_post_update', $post_ID, $data ); 3973 3966 3974 if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { 3967 3975 if ( $wp_error ) { 3968 return new WP_Error( 'db_update_error', __( 'Could not update post in the database' ), $wpdb->last_error ); 3976 if ( 'attachment' === $post_type ) { 3977 $message = __( 'Could not update attachment in the database.' ); 3978 } else { 3979 $message = __( 'Could not update post in the database.' ); 3980 } 3981 3982 return new WP_Error( 'db_update_error', $message, $wpdb->last_error ); 3969 3983 } else { 3970 3984 return 0; … … 3975 3989 if ( ! empty( $import_id ) ) { 3976 3990 $import_id = (int) $import_id; 3991 3977 3992 if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id ) ) ) { 3978 3993 $data['ID'] = $import_id; 3979 3994 } 3980 3995 } 3996 3981 3997 if ( false === $wpdb->insert( $wpdb->posts, $data ) ) { 3982 3998 if ( $wp_error ) { 3983 return new WP_Error( 'db_insert_error', __( 'Could not insert post into the database' ), $wpdb->last_error ); 3999 if ( 'attachment' === $post_type ) { 4000 $message = __( 'Could not insert attachment into the database.' ); 4001 } else { 4002 $message = __( 'Could not insert post into the database.' ); 4003 } 4004 4005 return new WP_Error( 'db_insert_error', $message, $wpdb->last_error ); 3984 4006 } else { 3985 4007 return 0; 3986 4008 } 3987 4009 } 4010 3988 4011 $post_ID = (int) $wpdb->insert_id; 3989 4012 … … 3994 4017 if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ), true ) ) { 3995 4018 $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent ); 4019 3996 4020 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); 3997 4021 clean_post_cache( $post_ID ); … … 4010 4034 foreach ( $postarr['tax_input'] as $taxonomy => $tags ) { 4011 4035 $taxonomy_obj = get_taxonomy( $taxonomy ); 4036 4012 4037 if ( ! $taxonomy_obj ) { 4013 4038 /* translators: %s: Taxonomy name. */ … … 4020 4045 $tags = array_filter( $tags ); 4021 4046 } 4047 4022 4048 if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) { 4023 4049 wp_set_post_terms( $post_ID, $tags, $taxonomy ); … … 4052 4078 if ( isset( $postarr['_thumbnail_id'] ) ) { 4053 4079 $thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) || 'revision' === $post_type; 4080 4054 4081 if ( ! $thumbnail_support && 'attachment' === $post_type && $post_mime_type ) { 4055 4082 if ( wp_attachment_is( 'audio', $post_ID ) ) { … … 4077 4104 $post->page_template = $postarr['page_template']; 4078 4105 $page_templates = wp_get_theme()->get_page_templates( $post ); 4106 4079 4107 if ( 'default' !== $postarr['page_template'] && ! isset( $page_templates[ $postarr['page_template'] ] ) ) { 4080 4108 if ( $wp_error ) { 4081 4109 return new WP_Error( 'invalid_page_template', __( 'Invalid page template.' ) ); 4082 4110 } 4111 4083 4112 update_post_meta( $post_ID, '_wp_page_template', 'default' ); 4084 4113 } else { … … 4099 4128 */ 4100 4129 do_action( 'edit_attachment', $post_ID ); 4130 4101 4131 $post_after = get_post( $post_ID ); 4102 4132
Note: See TracChangeset
for help on using the changeset viewer.