From b64c37d038ace31afd45c48c089c738d164ea4cc Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Fri, 9 Mar 2007 15:29:18 +0000 Subject: [PATCH] add Revision::selectFields(): returns a list of fields that should be SELECTed to construct a Revision from an SQL result object --- includes/Revision.php | 19 +++++++++++++++++++ includes/SpecialContributions.php | 5 ++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/includes/Revision.php b/includes/Revision.php index 0758d3f67b..357a8568ea 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -248,6 +248,25 @@ class Revision { return $ret; } + /** + * Return the list of revision fields that should be selected to create + * a new revision. + */ + static function selectFields() { + return array( + 'rev_id', + 'rev_page', + 'rev_text_id', + 'rev_timestamp', + 'rev_comment', + 'rev_minor_edit', + 'rev_user', + 'rev_user_text,'. + 'rev_deleted', + 'rev_len' + ); + } + /** * @param object $row * @access private diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index e4430b4a70..f1da5d5dec 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -163,9 +163,8 @@ class ContribsFinder { $use_index = $this->dbr->useIndexClause( $index ); $sql = 'SELECT ' . 'page_namespace,page_title,page_is_new,page_latest,'. - 'rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_minor_edit,rev_user,rev_user_text,'. - 'rev_deleted,rev_len ' . - "FROM $page,$revision $use_index " . + join(',', Revision::selectFields()). + " FROM $page,$revision $use_index " . "WHERE page_id=rev_page AND $userCond $nscond $offsetQuery " . 'ORDER BY rev_timestamp DESC'; $sql = $this->dbr->limitResult( $sql, $this->limit, 0 ); -- 2.20.1