[wp-trac] Re: [WordPress Trac] #9539: Image/Page naming collisions

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 29 20:09:45 GMT 2009


#9539: Image/Page naming collisions
--------------------------+-------------------------------------------------
 Reporter:  truthmedia    |       Owner:  ryan       
     Type:  defect (bug)  |      Status:  new        
 Priority:  normal        |   Milestone:  2.8        
Component:  Permalinks    |     Version:  2.7.1      
 Severity:  major         |    Keywords:  needs-patch
--------------------------+-------------------------------------------------
Changes (by Denis-de-Bernardy):

  * keywords:  needs-patch reporter-feedback => needs-patch


Comment:

 yup.

 suggested fix, as hakre seemed interested in tackling it: in the 2.8
 upgrade functions, add a collision check query that goes something like:

 {{{
 SELECT p1.*
 FROM $wpdb->posts as p1
 JOIN $wpdb->posts as p2
 ON p1.post_name = p2.post_name
 WHERE p1.post_type = 'attachment'
 AND p2.post_type = 'page'
 AND p1.post_parent = p2.post_parent
 }}}

 this'll fetch all of the conflicting attachments using an index. we'd then
 run each one through the unique slug function, and no conflicts should
 remain.

 it'll arguably change the slug of attachments, but better that than page
 slugs.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9539#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list