Le 3 janv. 2012 à 22:50, Brion Vibber a écrit :
I've reverted a number of recent commits to the
Title class which added
several more pre-cached fields to it, as I really don't think we want that
sort of data in Title objects to begin with. A Title object is meant to
represent a... well, a page title :) and as such should be roughly
equivalent to passing the string-form title around, but without having to
parse and de-parse the items all the time.
Since ancient times we've had a couple things like an article ID being
saved into local state, which is frequently useful to optimize lookups but
has its own problems (it has to be explicitly cleared or reset from time to
time). These really belong more in a 'Page' object than a 'Title'
These days we've got a WikiPage class which has been further split from
Article as well; it seems to me that these sorts of things might belong
better there than in Title. Thoughts?
I added those fields to the Title class to avoid some DB queries and avoid code
duplication. The problem is that currently the WikiPage instance created in
Wiki.php is not stored in the context object (you can grep for
to see how many times that method is called). This means that every time another
instance of that class is created there will be a new database query. I think we
need to store the WikiPage object in RequestContext to be able to share that
object and thus avoiding those database queries.
Alexandre Emsenhuber (ialex)