[buddypress-trac] [BuddyPress] #4140: The BP-Media Team has built you a new page router!

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Apr 10 23:39:03 UTC 2012


#4140: The BP-Media Team has built you a new page router!
-------------------------+-----------------------------
 Reporter:  foxly        |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Core         |    Version:
 Severity:  major        |   Keywords:
-------------------------+-----------------------------
 A page router is a set of classes that analyzes a URI supplied by the web
 server, and determines what (if any) page to return to a user. It's the
 heart of any web application and one of the most difficult parts to build
 ...because it must be reliable, secure, and extremely fast.

 In BuddyPress, the functions in the /bp-core/bp-core-catchuri.php file
 (combined with various code strewn about the plugin) serve as the page
 router.

 As part of building BP-Media, our team performed a detailed audit on BP's
 page router code. Although when *tested by humans* the code appears to
 work properly, when we instrumented and traced it, we found some serious
 problems:

 1) It can't handle URI's with repeated tokens "example.com/foo/bar/foo"
 2) It runs excessive numbers of queries
 3) It's very CPU intensive
 4) It has no caching
 5) Its impossible to unit test
 6) Nobody understands how it works

 So we've written you a new router class, with the following benefits:

 1) It correctly handles any URI
 2) It uses 1 query per page load instead of 5 (best case) or 20 (typical)
 or hundreds (site with dense page hierarchy and lots of blogs)
 3) Uses 40% less CPU cycles per run
 4) Includes full unit tests (once you add the Unit Test suite we've built
 for you, attached in another SVN ticket)
 5) It supports caching (once we discuss how you'd like to implement it)
 6) It includes an advanced error handling system that fully integrates
 with the unit tests (we'll post the utilities libraries to let you print
 the error traces to your browser in another ticket)
 7) It has great documentation.

 This patch is current as of an hour ago, and cleanly applies to the 1.6
 trunk.

 Enjoy!

 /^F^

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4140>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list