Ticket #11863: conflict.2.patch
File conflict.2.patch, 2.9 KB (added by , 15 years ago) |
---|
-
wp-admin/edit.php
205 205 206 206 if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) { 207 207 printf( _n( 'Item restored from the trash.', '%s items restored from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) ); 208 if ( isset($_GET['conflict']) && (int) $_GET['conflict']) { 209 _e( ' There was a permalink conflict with the restored post. The restored post\'s permalink was updated.' ); 210 } 208 211 unset($_GET['undeleted']); 209 212 } 210 213 -
wp-admin/post.php
237 237 if ( !current_user_can($post_type_object->delete_cap, $post_id) ) 238 238 wp_die( __('You are not allowed to move this item out of the trash.') ); 239 239 240 $orig_permalink = get_permalink($post_id); 241 240 242 if ( ! wp_untrash_post($post_id) ) 241 243 wp_die( __('Error in restoring from trash...') ); 242 244 243 wp_redirect( add_query_arg('untrashed', 1, $sendback) ); 245 if( $orig_permalink != get_permalink($post_id) ) { 246 $permalink_conflict=1; 247 } 248 249 wp_redirect( add_query_arg(array('untrashed' => 1,'conflict' => $permalink_conflict), $sendback) ); 244 250 exit(); 245 251 break; 246 252 -
wp-includes/post.php
2466 2466 } elseif ( in_array( $post_type, $hierarchical_post_types ) ) { 2467 2467 // Page slugs must be unique within their own trees. Pages are in a separate 2468 2468 // namespace than posts so page slugs are allowed to overlap post slugs. 2469 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";2469 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d AND post_status <> 'trash' LIMIT 1"; 2470 2470 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); 2471 2471 2472 2472 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( '@^(page)?\d+$@', $slug ) ) { … … 2480 2480 } 2481 2481 } else { 2482 2482 // Post slugs must be unique across all posts. 2483 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";2483 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_status <> 'trash' LIMIT 1"; 2484 2484 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); 2485 2485 2486 2486 if ( $post_name_check || in_array( $slug, $feeds ) ) {