adding public access methods for use by XMLRC extension.
authorDaniel Kinzler <daniel@users.mediawiki.org>
Thu, 3 Sep 2009 16:15:55 +0000 (16:15 +0000)
committerDaniel Kinzler <daniel@users.mediawiki.org>
Thu, 3 Sep 2009 16:15:55 +0000 (16:15 +0000)
includes/RecentChange.php
includes/api/ApiQueryRecentChanges.php

index e3b8162..3fc8ed7 100644 (file)
@@ -585,6 +585,10 @@ class RecentChange
                return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : NULL;
        }
 
+       public function getAttributes() {
+               return $this->mAttribs;
+       }
+
        /**
         * Gets the end part of the diff URL associated with this object
         * Blank if no diff link should be displayed
index 3b7ae2c..5f7ac53 100644 (file)
@@ -81,6 +81,23 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                return $cachedPatrolToken;
        }
 
+       /**
+        * Sets internal state to include the desired properties in the output.
+        * @param $prop associative array of properties, only keys are used here
+        */
+       public function initProperties( $prop ) {
+               $this->fld_comment = isset ($prop['comment']);
+               $this->fld_user = isset ($prop['user']);
+               $this->fld_flags = isset ($prop['flags']);
+               $this->fld_timestamp = isset ($prop['timestamp']);
+               $this->fld_title = isset ($prop['title']);
+               $this->fld_ids = isset ($prop['ids']);
+               $this->fld_sizes = isset ($prop['sizes']);
+               $this->fld_redirect = isset($prop['redirect']);
+               $this->fld_patrolled = isset($prop['patrolled']);
+               $this->fld_loginfo = isset($prop['loginfo']);
+       }
+
        /**
         * Generates and outputs the result of this query based upon the provided parameters.
         */
@@ -164,16 +181,7 @@ class ApiQueryRecentChanges extends ApiQueryBase {
                        $prop = array_flip($params['prop']);
 
                        /* Set up internal members based upon params. */
-                       $this->fld_comment = isset ($prop['comment']);
-                       $this->fld_user = isset ($prop['user']);
-                       $this->fld_flags = isset ($prop['flags']);
-                       $this->fld_timestamp = isset ($prop['timestamp']);
-                       $this->fld_title = isset ($prop['title']);
-                       $this->fld_ids = isset ($prop['ids']);
-                       $this->fld_sizes = isset ($prop['sizes']);
-                       $this->fld_redirect = isset($prop['redirect']);
-                       $this->fld_patrolled = isset($prop['patrolled']);
-                       $this->fld_loginfo = isset($prop['loginfo']);
+                       $this->initProperties( $prop );
 
                        global $wgUser;
                        if($this->fld_patrolled && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol())
@@ -245,9 +253,9 @@ class ApiQueryRecentChanges extends ApiQueryBase {
         *
         * @param $row The row from which to extract the data.
         * @return An array mapping strings (descriptors) to their respective string values.
-        * @access private
+        * @access public
         */
-       private function extractRowInfo($row) {
+       public function extractRowInfo($row) {
                /* If page was moved somewhere, get the title of the move target. */
                $movedToTitle = false;
                if (isset($row->rc_moved_to_title) && $row->rc_moved_to_title !== '')