r20291 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20290‎ | r20291 | r20292 >
Date:15:29, 9 March 2007
Author:river
Status:old
Tags:
Comment:
add Revision::selectFields(): returns a list of fields that should be SELECTed to construct a Revision from an SQL result object
Modified paths:
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/SpecialContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialContributions.php
@@ -163,9 +163,8 @@
164164 $use_index = $this->dbr->useIndexClause( $index );
165165 $sql = 'SELECT ' .
166166 'page_namespace,page_title,page_is_new,page_latest,'.
167 - 'rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_minor_edit,rev_user,rev_user_text,'.
168 - 'rev_deleted,rev_len ' .
169 - "FROM $page,$revision $use_index " .
 167+ join(',', Revision::selectFields()).
 168+ " FROM $page,$revision $use_index " .
170169 "WHERE page_id=rev_page AND $userCond $nscond $offsetQuery " .
171170 'ORDER BY rev_timestamp DESC';
172171 $sql = $this->dbr->limitResult( $sql, $this->limit, 0 );
Index: trunk/phase3/includes/Revision.php
@@ -249,6 +249,25 @@
250250 }
251251
252252 /**
 253+ * Return the list of revision fields that should be selected to create
 254+ * a new revision.
 255+ */
 256+ static function selectFields() {
 257+ return array(
 258+ 'rev_id',
 259+ 'rev_page',
 260+ 'rev_text_id',
 261+ 'rev_timestamp',
 262+ 'rev_comment',
 263+ 'rev_minor_edit',
 264+ 'rev_user',
 265+ 'rev_user_text,'.
 266+ 'rev_deleted',
 267+ 'rev_len'
 268+ );
 269+ }
 270+
 271+ /**
253272 * @param object $row
254273 * @access private
255274 */

Follow-up revisions

RevisionCommit summaryAuthorDate
r100280Code cleanups & fixed strange commaaaron21:21, 19 October 2011