Give Title a decent loading mechanism:
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 3 Jan 2012 19:28:03 +0000 (19:28 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 3 Jan 2012 19:28:03 +0000 (19:28 +0000)
commit17230f6a4e351794511e946375307780052bb9fb
tree9ee15797abc69adbde000d77c71ab076c3848127
parentc447423593789920a9c77da280463e2f900e54c7
Give Title a decent loading mechanism:
* Added Title::load() to factorise common code that load member variables instead of having each accessor doing it own loading system for its related member variable
* Removed usage of LinkCache::addLinkObj() to do the database query and do this directly in Title::load(). This allows to select the complete database row and populate all member variables; previously, requesting a field not stored in LinkCache (using getCount(), getTouched() or isNewPage()) results in two database query, one to load LinkCache data and the second to load the requested field; now there'll be only one query.
* Added Title::FIELD_IN_LINKCACHE and Title::FIELD_NOT_IN_LINKCACHE to specify whether the requested field is stored in LinkCache or not. LinkCache will be used if possible (i.e. Title::FIELD_IN_LINKCACHE is passed), otherwise a DB query to select the complete row is issued.
* Made Title::loadFromRow() save the row to LinkCache if possible.
* Added $wasFromMaster parameter to Title::loadFromRow() to tell that method whether the row was loaded from the master database or not and pass it from WikiPage::loadPageData()
* Added Title::GAID_USE_MASTER in addition to Title::GAID_FOR_UPDATE to get the row from the master database without having to do a SELECT FROM UPDATE query
* Added Title::selectFields() method to return the fields to select to given Title::loadFromRow() (and methods using it such as Title::newFromRow()) a complete row
* Made Title::$mCounter private since it has only been added recently (in r105790)
* Mark the object as loaded if Title::resetArticleID() is called with as new ID as 0
includes/Title.php
includes/WikiPage.php