[wp-hackers] Controller Implementation
wordpress at santosj.name
Fri Jul 2 21:37:38 UTC 2010
I think the problems can be listed as the following:
1. Too difficult without a lot of documentation.
2. Isn't extensible enough to automate some queries for posts.
3. Not a true controller implementation.
I think Mike's ticket (#12935), deals with the second. Mine deals with the
third and neither really deal with the first at this time.
I think the biggest problem with the routing is that it isn't dispatching to
any controller. Therefore, you can set the routing to get past the initial
404 settings in WordPress, but you'd need to handle the dispatching
yourself. It is easier, to just do the dispatching yourself and then
"correct" the 404 status and the title or hook an action that starts before
wp() function executes.
The goal of the router should be to only find the controller for dispatching
to. The querying that is part of the WP_Rewrite and WP_Query now complicates
and confuses the role of the router and doesn't satisfy the separation of
roles. Which is why rewriting the entire process would be better, but
generally off the table as backwards compatibility is required. It is also
isn't necessary to rewrite everything to implement the new controller
I propose the following:
For WordPress 3.1, include the completed controller router and dispatcher,
separate from the current WordPress front controller. Including a new action
that takes place before wp() function executes.
Some time after that, move some of the rewrites option to the new controller
and start dispatching to functions and classes for feeds and other
non-essential actions that can be tested and if there is any problem can
wait for a minor release or next release. Meaning less people will notice
after they upgrade and some edge cases weren't completely tested. During the
period between 3.1 and say for example 3.2 or 3.3, enough plugin developers
should be using the new controller as to allow for enough testing to certify
that it is stable enough to use in core.
After that, address the second in the above list while moving the rest of
the post, pages, etc to the controller. Deprecate the old way and move the
WP_Rewrite to the new system where logical.
Any suggestions on the implementation, current (in patch) or future, and
#12935 - http://core.trac.wordpress.org/ticket/12935
More information about the wp-hackers