r67536 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67535‎ | r67536 | r67537 >
Date:14:17, 7 June 2010
Author:werdna
Status:deferred
Tags:
Comment:
Commit some live-hacked bugfixes
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy_body.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/extensions/StrategyWiki/ActiveStrategy/ActiveStrategy_body.php
@@ -22,6 +22,11 @@
2323 static function formatResult( $skin, $taskForce, $number, $type ) {
2424 global $wgContLang, $wgLang, $wgActiveStrategyColors;
2525
 26+ if ( ! $taskForce ) {
 27+ // Fail.
 28+ return;
 29+ }
 30+
2631 $title = Title::newFromText( $taskForce );
2732 $text = $wgContLang->convert( $title->getPrefixedText() );
2833 $text = self::getTaskForceName( $text );
@@ -94,7 +99,7 @@
95100 $tables = array( 'page', 'categorylinks' );
96101 $fields = array( 'categorylinks.cl_to' );
97102 $conds = array( 'categorylinks.cl_to' => $categories );
98 - $options = array( 'GROUP BY' => 'categorylinks.cl_to' );
 103+ $options = array( 'GROUP BY' => 'categorylinks.cl_to', 'ORDER BY' => 'value DESC' );
99104 $joinConds = array( 'categorylinks' =>
100105 array( 'left join', 'categorylinks.cl_from=page.page_id' ) );
101106
@@ -121,12 +126,13 @@
122127 $conds[] = 'finishedcategory.cl_from IS NULL';
123128
124129 if ( $sortField == 'edits' ) {
 130+ $cutoff = $db->timestamp( time() - $wgActiveStrategyPeriod );
 131+ $cutoff = $db->addQuotes( $cutoff );
125132 $tables[] = 'revision';
126133 $joinConds['revision'] =
127 - array( 'left join', 'rev_page=page_id' );
 134+ array( 'left join',
 135+ array( 'rev_page=page_id', "rev_timestamp > $cutoff" ) );
128136 $fields[] = 'count(distinct rev_id) as value';
129 - $cutoff = $db->timestamp( time() - $wgActiveStrategyPeriod );
130 - $conds[] = "rev_timestamp > $cutoff";
131137 } elseif ( $sortField == 'ranking' ) {
132138 $tables[] = 'pagelinks';
133139 $joinConds['pagelinks'] = array( 'left join',
@@ -137,6 +143,7 @@
138144 $result = $db->select( $tables, $fields, $conds,
139145 __METHOD__, $options, $joinConds );
140146
 147+
141148 $categoryToTaskForce = array_flip( $categories );
142149
143150 foreach( $result as $row ) {
@@ -147,6 +154,8 @@
148155 }
149156
150157 $html = Xml::tags( 'ul', null, $html );
 158+ $html .= "<!-- " . $db->selectSQLText( $tables, $fields, $conds, __METHOD__,
 159+ $options, $joinConds ) . '-->';
151160
152161 return $html;
153162 }

Status & tagging log