r54605 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54604‎ | r54605 | r54606 >
Date:21:12, 7 August 2009
Author:mrzman
Status:reverted (Comments)
Tags:
Comment:
Copy DatabaseBase::unionQueries() from trunk for BC
Modified paths:
  • /trunk/extensions/IndexFunction/SpecialIndex.php (modified) (history)

Diff [purge]

Index: trunk/extensions/IndexFunction/SpecialIndex.php
@@ -133,13 +133,20 @@
134134 array( 'page' => array('JOIN','page_id=in_from') )
135135 );
136136
137 - $union = $this->mDb->unionQueries( array( $pagequery, $indexquery ), false );
 137+ $union = $this->unionQueries( array( $pagequery, $indexquery ), false );
138138 $union .= $order . $limit;
139139
140140 $res = $this->mDb->query( $union, __METHOD__ );
141141 return new ResultWrapper( $this->mDb, $res );
142142 }
 143+
 144+ // Copied from Database.php on MW trunk
 145+ function unionQueries($sqls, $all) {
 146+ $glue = $all ? ') UNION ALL (' : ') UNION (';
 147+ return '('.implode( $glue, $sqls ) . ')';
 148+ }
143149
 150+
144151 }
145152
146153 class SpecialIndex extends SpecialPage {

Follow-up revisions

RevisionCommit summaryAuthorDate
r54694revert r54605 per comments on CodeReviewmrzman01:54, 10 August 2009

Comments

#Comment by Simetrical (talk | contribs)   01:23, 10 August 2009

This defeats the whole point of unionQueries() -- which is to allow different database engines to work properly when they require different syntax. DatabaseOracle.php overrides this method with something entirely different, and this change breaks IndexFunction for Oracle. We shouldn't be concerned with backward compatibility in trunk/extensions/, at least not to the point of breaking functionality for users of trunk; that's the whole reason we branch extensions.

#Comment by Mr.Z-man (talk | contribs)   01:34, 10 August 2009

Unfortunately I'm developing this for a wiki running 1.15. I'll generate a patch for them to add it to Database.php. This will be reverted shortly.

#Comment by Nikerabbit (talk | contribs)   10:30, 10 August 2009

I would check if the functions exists and use it in that case, or have the current way as a fallback.

Status & tagging log