From b7bcf1b49855760d6ada156ae4cd261ee9c12381 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 12 Apr 2011 20:21:16 +0000 Subject: [PATCH] * Made pageDataFromTitle protected (unused elsewhere) * Split out selectFields() for easier use of loadPageData() * Marked Revision::selectFields as public (was used as such) --- includes/Article.php | 36 ++++++++++++++++++++++-------------- includes/Revision.php | 2 +- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 7bacc8a778..0b459f1564 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -400,6 +400,26 @@ class Article { wfProfileOut( __METHOD__ ); } + /** + * Return the list of revision fields that should be selected to create + * a new page. + */ + public static function selectFields() { + return array( + 'page_id', + 'page_namespace', + 'page_title', + 'page_restrictions', + 'page_counter', + 'page_is_redirect', + 'page_is_new', + 'page_random', + 'page_touched', + 'page_latest', + 'page_len', + ); + } + /** * Fetch a page record with the given conditions * @param $dbr Database object @@ -407,19 +427,7 @@ class Article { * @return mixed Database result resource, or false on failure */ protected function pageData( $dbr, $conditions ) { - $fields = array( - 'page_id', - 'page_namespace', - 'page_title', - 'page_restrictions', - 'page_counter', - 'page_is_redirect', - 'page_is_new', - 'page_random', - 'page_touched', - 'page_latest', - 'page_len', - ); + $fields = self::selectFields(); wfRunHooks( 'ArticlePageDataBefore', array( &$this, &$fields ) ); @@ -438,7 +446,7 @@ class Article { * @param $title Title object * @return mixed Database result resource, or false on failure */ - public function pageDataFromTitle( $dbr, $title ) { + protected function pageDataFromTitle( $dbr, $title ) { return $this->pageData( $dbr, array( 'page_namespace' => $title->getNamespace(), 'page_title' => $title->getDBkey() ) ); diff --git a/includes/Revision.php b/includes/Revision.php index 5c2dda0ff8..0335ab1c85 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -249,7 +249,7 @@ class Revision { * Return the list of revision fields that should be selected to create * a new revision. */ - static function selectFields() { + public static function selectFields() { return array( 'rev_id', 'rev_page', -- 2.20.1