* Made pageDataFromTitle protected (unused elsewhere)
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 12 Apr 2011 20:21:16 +0000 (20:21 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 12 Apr 2011 20:21:16 +0000 (20:21 +0000)
* Split out selectFields() for easier use of loadPageData()
* Marked Revision::selectFields as public (was used as such)

includes/Article.php
includes/Revision.php

index 7bacc8a..0b459f1 100644 (file)
@@ -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() ) );
index 5c2dda0..0335ab1 100644 (file)
@@ -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',