r68591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68590‎ | r68591 | r68592 >
Date:23:39, 25 June 2010
Author:werdna
Status:deferred
Tags:
Comment:
Commit live hacked fixes
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
@@ -140,7 +140,7 @@
141141 }
142142
143143 static function getTaskForcePageConditions( $taskForces, &$tables, &$fields, &$conds,
144 - &$join_conds, &$lookup ) {
 144+ &$joinConds, &$lookup ) {
145145 $categories = array();
146146 foreach( $taskForces as $row ) {
147147 $text = self::getTaskForceName( $row->tf_name );
@@ -159,19 +159,16 @@
160160 $lookup = $categories;
161161 }
162162
163 - static function getProposalPageConditions( $proposals, &$tables, &$fields, &$conds,
 163+ static function getProposalPageConditions( &$tables, &$fields, &$conds,
164164 &$join_conds, &$lookup ) {
165165 $fields[] = 'page.page_title AS keyfield';
166166 $conds['page_namespace'] = 106;
167 - $titles = array();
168 - foreach( $proposals as $row ) {
169 - $title = Title::makeTitle( $row->page_namespace, $row->page_title );
170 - $titles[$row->page_title] = $title->getPrefixedText();
171 - }
172167
173 - $conds['page_title'] = array_keys($titles);
174 -
175 - $lookup = $titles;
 168+ $tables[] = 'categorylinks as finishedcategory';
 169+ $conds[] = 'finishedcategory.cl_from IS NULL';
 170+ $join_conds['categorylinks as finishedcategory'] =
 171+ array( 'left join', array( 'cl_from=page_id',
 172+ 'cl_to' => 'Archived_Done' ) );
176173 }
177174
178175 static function getOutput( $args ) {
@@ -194,7 +191,7 @@
195192 if ( $args['type'] == 'taskforces' ) {
196193 $masterPages = self::getTaskForces();
197194 } elseif ( $args['type'] == 'proposal' ) {
198 - $masterPages = self::getProposals();
 195+// $masterPages = self::getProposals();
199196 }
200197
201198 // Sorting by number of members doesn't require any
@@ -205,15 +202,16 @@
206203 $tables = array( );
207204 $fields = array( );
208205 $conds = array();
 206+ $joinConds = array();
209207 $options = array( 'GROUP BY' => 'keyfield', 'ORDER BY' => 'value DESC' );
210 - $lookup = array();
 208+ $lookup = NULL;
211209
212210 if ( $args['type'] == 'taskforces' ) {
213211 self::getTaskForcePageConditions( $masterPages, $tables, $fields,
214 - $conds, $join_conds, $lookup );
 212+ $conds, $joinConds, $lookup );
215213 } elseif( $args['type'] == 'proposal' ) {
216 - self::getProposalPageConditions( $masterPages, $tables, $fields,
217 - $conds, $join_conds, $lookup );
 214+ self::getProposalPageConditions( $tables, $fields,
 215+ $conds, $joinConds, $lookup );
218216 }
219217
220218 $tables[] = 'page';
@@ -228,6 +226,11 @@
229227 "rev_timestamp > $cutoff",
230228 "rev_page IS NOT NULL" ) );
231229 $fields[] = 'count(distinct rev_id) + count(distinct thread_id) as value';
 230+ $tables[] = 'user_groups';
 231+ $joinConds['user_groups'] = array( 'left join',
 232+ array( 'ug_user != 0', 'ug_user=rev_user',
 233+ 'ug_group' => 'bot' ) );
 234+ $conds[] = 'ug_user IS NULL';
232235
233236 // Include LQT posts
234237 $tables[] = 'thread';
@@ -243,6 +246,8 @@
244247 $fields[] = 'count(distinct pl_from) as value';
245248 }
246249
 250+// die( $db->selectSQLText( $tables, $fields, $conds, __METHOD__, $options, $joinConds ) );
 251+
247252 $result = $db->select( $tables, $fields, $conds,
248253 __METHOD__, $options, $joinConds );
249254
@@ -250,8 +255,13 @@
251256
252257 foreach( $result as $row ) {
253258 $number = $row->value;
254 - $taskForce = $lookup[$row->keyfield];
 259+ $taskForce = $lookup ? $lookup[$row->keyfield] : $row->keyfield;
255260
 261+ if (!$lookup && $args['type'] == 'proposal') {
 262+ $title = Title::makeTitleSafe( 106, $taskForce );
 263+ $taskForce = $title->getPrefixedText();
 264+ }
 265+
256266 if ( isset( $count[$taskForce] ) ) {
257267 $count[$taskForce] += $number;
258268 } else if ( $number > 0 ) {

Status & tagging log