[wp-trac] [WordPress Trac] #7286: Improve pages handling

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 11 22:34:32 GMT 2008


#7286: Improve pages handling
---------------------+------------------------------------------------------
 Reporter:  hailin   |       Owner:  anonymous
     Type:  defect   |      Status:  new      
 Priority:  normal   |   Milestone:  2.7      
Component:  General  |     Version:           
 Severity:  normal   |    Keywords:           
---------------------+------------------------------------------------------
 page_rows() and _page_rows() in wp-admin/includes/template.php
 don't perform well in the worst case, where there are a lot of children
 pages.

 He problem is that in _page_rows(), we had to traverse through the whole
 array in
 order to find out a sub-page whose parent is the given one. In the worse
 case, the  performance can degrade to O( number of children pages * number
 of top level pages).

 Besides, given current logic, it's very hard to handle orphaned pages,
 which should be displayed at the last pagenum. Displaying orphaned pages
 makes the function more robust. Ex: we've seen a bug (#7272) causing some
 orphaned pages, and because this function doesn't display them, we don't
 know what happened, and it's very costly to figure out what went wrong.

 The proposed fix has O(N) complexity in the worst, best, and average case.
 It also displays orphaned pages nicely.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7286>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list