From 0234640637ebc961a34dcd221b34865c69357742 Mon Sep 17 00:00:00 2001 From: Daniel Kinzler Date: Thu, 3 Sep 2009 16:15:55 +0000 Subject: [PATCH] adding public access methods for use by XMLRC extension. --- includes/RecentChange.php | 4 ++++ includes/api/ApiQueryRecentChanges.php | 32 ++++++++++++++++---------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/includes/RecentChange.php b/includes/RecentChange.php index e3b8162581..3fc8ed7735 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -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 diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 3b7ae2cede..5f7ac53771 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -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 !== '') -- 2.20.1