r85913 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85912‎ | r85913 | r85914 >
Date:20:21, 12 April 2011
Author:aaron
Status:ok
Tags:
Comment:
* Made pageDataFromTitle protected (unused elsewhere)
* Split out selectFields() for easier use of loadPageData()
* Marked Revision::selectFields as public (was used as such)
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -401,25 +401,33 @@
402402 }
403403
404404 /**
 405+ * Return the list of revision fields that should be selected to create
 406+ * a new page.
 407+ */
 408+ public static function selectFields() {
 409+ return array(
 410+ 'page_id',
 411+ 'page_namespace',
 412+ 'page_title',
 413+ 'page_restrictions',
 414+ 'page_counter',
 415+ 'page_is_redirect',
 416+ 'page_is_new',
 417+ 'page_random',
 418+ 'page_touched',
 419+ 'page_latest',
 420+ 'page_len',
 421+ );
 422+ }
 423+
 424+ /**
405425 * Fetch a page record with the given conditions
406426 * @param $dbr Database object
407427 * @param $conditions Array
408428 * @return mixed Database result resource, or false on failure
409429 */
410430 protected function pageData( $dbr, $conditions ) {
411 - $fields = array(
412 - 'page_id',
413 - 'page_namespace',
414 - 'page_title',
415 - 'page_restrictions',
416 - 'page_counter',
417 - 'page_is_redirect',
418 - 'page_is_new',
419 - 'page_random',
420 - 'page_touched',
421 - 'page_latest',
422 - 'page_len',
423 - );
 431+ $fields = self::selectFields();
424432
425433 wfRunHooks( 'ArticlePageDataBefore', array( &$this, &$fields ) );
426434
@@ -438,7 +446,7 @@
439447 * @param $title Title object
440448 * @return mixed Database result resource, or false on failure
441449 */
442 - public function pageDataFromTitle( $dbr, $title ) {
 450+ protected function pageDataFromTitle( $dbr, $title ) {
443451 return $this->pageData( $dbr, array(
444452 'page_namespace' => $title->getNamespace(),
445453 'page_title' => $title->getDBkey() ) );
Index: trunk/phase3/includes/Revision.php
@@ -249,7 +249,7 @@
250250 * Return the list of revision fields that should be selected to create
251251 * a new revision.
252252 */
253 - static function selectFields() {
 253+ public static function selectFields() {
254254 return array(
255255 'rev_id',
256256 'rev_page',

Follow-up revisions

RevisionCommit summaryAuthorDate
r85955* In FlaggedRevision:...aaron16:16, 13 April 2011

Status & tagging log