[wp-trac] [WordPress Trac] #17374: get_pages() with child_of forgets sort

WordPress Trac noreply at wordpress.org
Tue Apr 18 12:30:34 UTC 2023


#17374: get_pages() with child_of forgets sort
-------------------------------------------------+-------------------------
 Reporter:  janfabry                             |       Owner:
                                                 |  DrewAPicture
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:
Component:  Posts, Post Types                    |     Version:  3.1.2
 Severity:  normal                               |  Resolution:
 Keywords:  dev-feedback needs-testing needs-    |     Focuses:
  refresh                                        |
-------------------------------------------------+-------------------------

Comment (by joysons):

 Based on the provided information, it seems that the current
 implementation of the get_page_children function in MySQL search has some
 limitations that affect its sorting functionality. The proposed solution
 suggests rewriting the function to perform a bottom-up search using a
 while loop and a dictionary for O(1) lookup, which should help maintain
 the sorting order of the pages.
 However, it's important to note that this proposed solution needs further
 testing to ensure its efficiency and effectiveness. It would be best to
 create more unit tests to verify its functionality and to ensure that the
 changes made to the function do not have any unintended consequences on
 the overall performance of the system. Additionally, there may be some
 formatting issues that need to be addressed before implementing the
 proposed solution. It would be best to review the code and make any
 necessary adjustments to ensure that it is easy to read and understand.
 Here are some additional considerations:
 Performance testing: Before implementing the proposed solution, it is
 important to perform performance testing to ensure that the changes made
 to the function do not negatively impact the system's performance. This
 testing should be done on a variety of datasets to ensure that the
 function can handle a range of use cases.
 Code optimization: To ensure that the function is as efficient as
 possible, it is important to optimize the code. This can include
 minimizing the number of function calls and reducing the amount of memory
 used by the function. Error handling: The proposed solution assumes that
 the input parameters are valid and that there are no errors in the data.
 However, it is important to include error handling in the function to
 ensure that it can handle unexpected inputs or errors in the data. Code
 formatting: As noted in the original post, there are some formatting
 issues with the code[https://a-goodguidenews.blogspot.com/ .] These should
 be addressed to ensure that the code is easy to read and understand.
 Additional testing: While the unit test provided in the original post is a
 good start, it is important to perform additional testing to ensure that
 the function works as expected in a range of scenarios. This can include
 testing the function on different datasets and with different input
 parameters. Overall, it seems that the proposed solution has the potential
 to improve the functionality of the get_page_children function in MySQL
 search. However, it is important to thoroughly test the changes and ensure
 that they do not negatively impact the system's performance or
 functionality.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/17374#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list