r93064 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93063‎ | r93064 | r93065 >
Date:16:55, 25 July 2011
Author:reedy
Status:ok
Tags:
Comment:
Remove trailing whitespace

Remove unused folder

while to foreach loops
Modified paths:
  • /trunk/extensions/CollabWatchlist/CollabWatchlist.body.php (deleted) (history)
  • /trunk/extensions/CollabWatchlist/CollabWatchlist.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/CategoryTreeManip.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/CollabWatchlistChangesList.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/CollabWatchlistEditor.php (modified) (history)
  • /trunk/extensions/CollabWatchlist/includes/SpecialCollabWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CollabWatchlist/CollabWatchlist.body.php
@@ -1 +0,0 @@
2 -<?php
Index: trunk/extensions/CollabWatchlist/CollabWatchlist.php
@@ -11,8 +11,8 @@
1212
1313 $wgExtensionCredits['specialpage'][] = array(
1414 'name' => 'CollabWatchlist',
15 - 'author' =>'Florian Hackenberger',
16 - 'url' => 'http://www.mediawiki.org/wiki/User:Flohack',
 15+ 'author' =>'Florian Hackenberger',
 16+ 'url' => 'http://www.mediawiki.org/wiki/User:Flohack',
1717 'description' => 'Provides collaborative watchlists based on categories',
1818 'descriptionmsg' => 'specialcollabwatchlist-desc',
1919 'version' => '0.9.0',
@@ -25,7 +25,6 @@
2626 $wgExtensionMessagesFiles['CollabWatchlist'] = $wgDir . 'CollabWatchlist.i18n.php';
2727 $wgExtensionAliasesFiles['CollabWatchlist'] = $wgDir . 'CollabWatchlist.alias.php';
2828
29 -//$wgAutoloadClasses['CollabWatchlist'] = $wgDir . 'CollabWatchlist.body.php'; # Tell MediaWiki to load the extension body.
3029 $wgAutoloadClasses['SpecialCollabWatchlist'] = $wgCollabWatchlistIncludes . 'SpecialCollabWatchlist.php';
3130 $wgAutoloadClasses['CollabWatchlistChangesList'] = $wgCollabWatchlistIncludes . 'CollabWatchlistChangesList.php';
3231 $wgAutoloadClasses['CategoryTreeManip'] = $wgCollabWatchlistIncludes . 'CategoryTreeManip.php';
@@ -36,7 +35,7 @@
3736
3837 $wgHooks['LoadExtensionSchemaUpdates'][] = 'fnCollabWatchlistDbSchema';
3938 $wgHooks['GetPreferences'][] = 'fnCollabWatchlistPreferences';
40 -
 39+
4140 function fnCollabWatchlistDbSchema() {
4241 global $wgExtNewTables;
4342 $wgSql = dirname(__FILE__) . '/sql/';
Index: trunk/extensions/CollabWatchlist/includes/SpecialCollabWatchlist.php
@@ -3,12 +3,12 @@
44 function __construct() {
55 parent::__construct( 'CollabWatchlist' );
66 }
7 -
 7+
88 function execute( $par ) {
99 global $wgUser, $wgOut, $wgLang, $wgRequest;
10 - global $wgRCShowWatchingUsers, $wgEnotifWatchlist;
 10+ global $wgRCShowWatchingUsers;
1111 global $wgEnotifWatchlist;
12 -
 12+
1313 // Add feed links
1414 $wlToken = $wgUser->getOption( 'watchlisttoken' );
1515 if (!$wlToken) {
@@ -16,27 +16,27 @@
1717 $wgUser->setOption( 'watchlisttoken', $wlToken );
1818 $wgUser->saveSettings();
1919 }
20 -
21 - global $wgServer, $wgScriptPath, $wgFeedClasses;
 20+
 21+ global $wgFeedClasses;
2222 $apiParams = array( 'action' => 'feedwatchlist', 'allrev' => 'allrev',
2323 'wlowner' => $wgUser->getName(), 'wltoken' => $wlToken );
2424 $feedTemplate = wfScript('api').'?';
25 -
 25+
2626 foreach( $wgFeedClasses as $format => $class ) {
2727 $theseParams = $apiParams + array( 'feedformat' => $format );
2828 $url = $feedTemplate . wfArrayToCGI( $theseParams );
2929 $wgOut->addFeedLink( $format, $url );
3030 }
31 -
 31+
3232 $skin = $wgUser->getSkin();
3333 $specialTitle = SpecialPage::getTitleFor( 'CollabWatchlist' );
3434 $wgOut->setRobotPolicy( 'noindex,nofollow' );
35 -
 35+
3636 # Anons don't get a watchlist
3737 if( $wgUser->isAnon() ) {
3838 $wgOut->setPageTitle( wfMsg( 'watchnologin' ) );
3939 $llink = $skin->linkKnown(
40 - SpecialPage::getTitleFor( 'Userlogin' ),
 40+ SpecialPage::getTitleFor( 'Userlogin' ),
4141 wfMsgHtml( 'loginreqlink' ),
4242 array(),
4343 array( 'returnto' => $specialTitle->getPrefixedText() )
@@ -44,9 +44,9 @@
4545 $wgOut->addHTML( wfMsgWikiHtml( 'watchlistanontext', $llink ) );
4646 return;
4747 }
48 -
 48+
4949 $wgOut->setPageTitle( wfMsg( 'collabwatchlist' ) );
50 -
 50+
5151 $listIdsAndNames = CollabWatchlistChangesList::getCollabWatchlistIdAndName($wgUser->getId());
5252 $sub = wfMsgExt(
5353 'watchlistfor2',
@@ -56,9 +56,9 @@
5757 );
5858 $sub .= '<br />' . CollabWatchlistEditor::buildTools( $listIdsAndNames, $wgUser->getSkin() );
5959 $wgOut->setSubtitle( $sub );
60 -
 60+
6161 $uid = $wgUser->getId();
62 -
 62+
6363 // The filter form has one checkbox for each tag, build an array
6464 $postValues = $wgRequest->getValues();
6565 $tagFilter = array();
@@ -71,7 +71,7 @@
7272 if( empty($tagFilter) ) {
7373 $tagFilter = explode('|', $wgRequest->getVal('filterTags'));
7474 }
75 -
 75+
7676 $defaults = array(
7777 /* float */ 'days' => floatval( $wgUser->getOption( 'watchlistdays' ) ), /* 3.0 or 0.5, watch further below */
7878 /* bool */ 'hideMinor' => (int)$wgUser->getBoolOption( 'watchlisthideminor' ),
@@ -87,9 +87,9 @@
8888 /* ? */ 'invertTags'=> false,
8989 /* ? */ 'filterTags'=> '',
9090 );
91 -
 91+
9292 extract($defaults);
93 -
 93+
9494 # Extract variables from the request, falling back to user preferences or
9595 # other default values if these don't exist
9696 $prefs['days'] = floatval( $wgUser->getOption( 'watchlistdays' ) );
@@ -102,7 +102,7 @@
103103 $prefs['hidepatrolled' ] = $wgUser->getBoolOption( 'watchlisthidepatrolled' );
104104 $prefs['invertTags' ] = $wgUser->getBoolOption( 'collabwatchlistinverttags' );
105105 $prefs['filterTags' ] = $wgUser->getOption( 'collabwatchlistfiltertags' );
106 -
 106+
107107 # Get query variables
108108 $days = $wgRequest->getVal( 'days' , $prefs['days'] );
109109 $hideMinor = $wgRequest->getBool( 'hideMinor', $prefs['hideminor'] );
@@ -114,7 +114,7 @@
115115 $hidePatrolled = $wgRequest->getBool( 'hidePatrolled' , $prefs['hidepatrolled'] );
116116 $filterTags = implode('|', $tagFilter);
117117 $invertTags = $wgRequest->getBool( 'invertTags' , $prefs['invertTags'] );
118 -
 118+
119119 # Get collabwatchlist value, if supplied, and prepare a WHERE fragment
120120 $collabWatchlist = $wgRequest->getIntOrNull( 'collabwatchlist' );
121121 $invert = $wgRequest->getBool( 'invert' );
@@ -127,16 +127,16 @@
128128 if(array_key_exists($collabWatchlist, $listIdsAndNames)) {
129129 $wgOut->addHTML( Xml::element('h2', null, $listIdsAndNames[$collabWatchlist]) );
130130 }
131 -
 131+
132132 if( ( $mode = CollabWatchlistEditor::getMode( $wgRequest, $par ) ) !== false ) {
133133 $editor = new CollabWatchlistEditor();
134134 $editor->execute( $collabWatchlist, $listIdsAndNames, $wgOut, $wgRequest, $mode );
135135 return;
136136 }
137 -
 137+
138138 $dbr = wfGetDB( DB_SLAVE, 'watchlist' );
139139 $recentchanges = $dbr->tableName( 'recentchanges' );
140 -
 140+
141141 $nitems = $dbr->selectField( 'collabwatchlistcategory', 'COUNT(*)',
142142 $collabWatchlist == 0 ? array() : array('rl_id' => $collabWatchlist
143143 ), __METHOD__ );
@@ -144,10 +144,10 @@
145145 $wgOut->addWikiMsg( 'nowatchlist' );
146146 return;
147147 }
148 -
 148+
149149 // Dump everything here
150150 $nondefaults = array();
151 -
 151+
152152 wfAppendToArrayIfNotDefault( 'days' , $days , $defaults, $nondefaults);
153153 wfAppendToArrayIfNotDefault( 'hideMinor', (int)$hideMinor, $defaults, $nondefaults );
154154 wfAppendToArrayIfNotDefault( 'hideBots' , (int)$hideBots , $defaults, $nondefaults);
@@ -160,21 +160,21 @@
161161 wfAppendToArrayIfNotDefault( 'filterTags', $filterTags , $defaults, $nondefaults );
162162 wfAppendToArrayIfNotDefault( 'invertTags', $invertTags , $defaults, $nondefaults );
163163 wfAppendToArrayIfNotDefault( 'invert', $invert , $defaults, $nondefaults );
164 -
 164+
165165 if( $days <= 0 ) {
166166 $andcutoff = '';
167167 } else {
168168 $andcutoff = "rc_timestamp > '".$dbr->timestamp( time() - intval( $days * 86400 ) )."'";
169169 }
170 -
 170+
171171 # If the watchlist is relatively short, it's simplest to zip
172172 # down its entirety and then sort the results.
173 -
 173+
174174 # If it's relatively long, it may be worth our while to zip
175175 # through the time-sorted page list checking for watched items.
176 -
 176+
177177 # Up estimate of watched items by 15% to compensate for talk pages...
178 -
 178+
179179 # Toggles
180180 $andHideOwn = $hideOwn ? "rc_user != $uid" : '';
181181 $andHideBots = $hideBots ? "rc_bot = 0" : '';
@@ -183,7 +183,7 @@
184184 $andHideAnons = $hideAnons ? "rc_user != 0" : '';
185185 $andHideListUser = $hideListUser ? $this->wlGetFilterClauseListUser($collabWatchlist) : '';
186186 $andHidePatrolled = $wgUser->useRCPatrol() && $hidePatrolled ? "rc_patrolled != 1" : '';
187 -
 187+
188188 # Toggle watchlist content (all recent edits or just the latest)
189189 if( $wgUser->getOption( 'extendwatchlist' )) {
190190 $andLatest='';
@@ -195,22 +195,22 @@
196196 $limitWatchlist = 0;
197197 $usePage = true;
198198 }
199 -
 199+
200200 # Show a message about slave lag, if applicable
201201 if( ( $lag = $dbr->getLag() ) > 0 )
202202 $wgOut->showLagWarning( $lag );
203 -
 203+
204204 # Create output form
205205 $form = Xml::fieldset( wfMsg( 'watchlist-options' ), false, array( 'id' => 'mw-watchlist-options' ) );
206 -
 206+
207207 # Show watchlist header
208208 $form .= wfMsgExt( 'collabwatchlist-details', array( 'parseinline' ), $wgLang->formatNum( $nitems ) );
209 -
 209+
210210 if( $wgUser->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist) {
211211 $form .= wfMsgExt( 'wlheader-enotif', 'parse' ) . "\n";
212212 }
213213 $form .= '<hr />';
214 -
 214+
215215 $tables = array( 'recentchanges', 'categorylinks' );
216216 $fields = array( "{$recentchanges}.*" );
217217 $categoryClause = $this->wlGetFilterClauseForCollabWatchlistIds($collabWatchlist, 'cl_to', 'rc_cur_id');
@@ -223,7 +223,7 @@
224224 if( !empty($tagFilter) ) {
225225 // The tag filter causes a query runtime of O(MxN), where M is relative to the number
226226 // of recentchanges we select (from a table which is purged periodically, limited to 250)
227 - // and N is relative the number of change_tag entries for a recentchange. Doing it
 227+ // and N is relative the number of change_tag entries for a recentchange. Doing it
228228 // the other way around (selecting from change_tag first, is probably slower, as the
229229 // change_tag table is never purged.
230230 // Using the tag_summary table for filtering is difficult, at least I have been unable to
@@ -235,8 +235,8 @@
236236 } else {
237237 $filter = 'NOT EXISTS ';
238238 }
239 - $filter .= '(select ct_rc_id from change_tag
240 - JOIN collabwatchlistrevisiontag ON collabwatchlistrevisiontag.ct_id = change_tag.ct_id
 239+ $filter .= '(select ct_rc_id from change_tag
 240+ JOIN collabwatchlistrevisiontag ON collabwatchlistrevisiontag.ct_id = change_tag.ct_id
241241 WHERE ct_rc_id = recentchanges.rc_id AND ct_tag ';
242242 if( count($tagFilter) > 1 )
243243 $filter .= 'IN (' . $dbr->makeList($tagFilter) . '))';
@@ -257,23 +257,23 @@
258258 if( $andHideAnons ) $conds[] = $andHideAnons;
259259 if( $andHideListUser ) $conds[] = $andHideListUser;
260260 if( $andHidePatrolled ) $conds[] = $andHidePatrolled;
261 -
 261+
262262 $rollbacker = $wgUser->isAllowed('rollback');
263263 if ( $usePage || $rollbacker ) {
264264 $tables[] = 'page';
265265 $join_conds['page'] = array('LEFT JOIN','rc_cur_id=page.page_id');
266 - if ($rollbacker)
 266+ if ($rollbacker)
267267 $fields[] = 'page_latest';
268268 }
269 -
 269+
270270 ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
271271 wfRunHooks('SpecialCollabWatchlistQuery', array(&$conds,&$tables,&$join_conds,&$fields) );
272 -
 272+
273273 $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds );
274274 $numRows = $dbr->numRows( $res );
275 -
 275+
276276 /* Start bottom header */
277 -
 277+
278278 $wlInfo = '';
279279 if( $days >= 1 ) {
280280 $wlInfo = wfMsgExt( 'rcnote', 'parseinline',
@@ -289,11 +289,11 @@
290290 $wgLang->formatNum( round($days*24) )
291291 ) . '<br />';
292292 }
293 -
 293+
294294 $cutofflinks = "\n" . $this->wlCutoffLinks( $days, 'CollabWatchlist', $nondefaults ) . "<br />\n";
295 -
 295+
296296 $thisTitle = SpecialPage::getTitleFor( 'CollabWatchlist' );
297 -
 297+
298298 # Spit out some control panel links
299299 $links[] = $this->wlShowHideLink( $nondefaults, 'rcshowhideminor', 'hideMinor', $hideMinor );
300300 $links[] = $this->wlShowHideLink( $nondefaults, 'rcshowhidebots', 'hideBots', $hideBots );
@@ -301,11 +301,11 @@
302302 $links[] = $this->wlShowHideLink( $nondefaults, 'rcshowhideliu', 'hideLiu', $hideLiu );
303303 $links[] = $this->wlShowHideLink( $nondefaults, 'rcshowhidemine', 'hideOwn', $hideOwn );
304304 $links[] = $this->wlShowHideLink( $nondefaults, 'collabwatchlistshowhidelistusers', 'hideListUser', $hideListUser );
305 -
 305+
306306 if( $wgUser->useRCPatrol() ) {
307307 $links[] = $this->wlShowHideLink( $nondefaults, 'rcshowhidepatr', 'hidePatrolled', $hidePatrolled );
308308 }
309 -
 309+
310310 # Namespace filter and put the whole form together.
311311 $form .= $wlInfo;
312312 $form .= $cutofflinks;
@@ -352,35 +352,35 @@
353353 $form .= Xml::closeElement( 'form' );
354354 $form .= Xml::closeElement( 'fieldset' );
355355 $wgOut->addHTML( $form );
356 -
 356+
357357 # If there's nothing to show, stop here
358358 if( $numRows == 0 ) {
359359 $wgOut->addWikiMsg( 'watchnochange' );
360360 return;
361361 }
362 -
 362+
363363 /* End bottom header */
364 -
 364+
365365 /* Do link batch query */
366366 $linkBatch = new LinkBatch;
367 - while ( $row = $dbr->fetchObject( $res ) ) {
 367+ foreach ( $res as $row ) {
368368 $userNameUnderscored = str_replace( ' ', '_', $row->rc_user_text );
369369 if ( $row->rc_user != 0 ) {
370370 $linkBatch->add( NS_USER, $userNameUnderscored );
371371 }
372372 $linkBatch->add( NS_USER_TALK, $userNameUnderscored );
373 -
 373+
374374 $linkBatch->add( $row->rc_namespace, $row->rc_title );
375375 }
376376 $linkBatch->execute();
377377 $dbr->dataSeek( $res, 0 );
378 -
 378+
379379 $list = CollabWatchlistChangesList::newFromUser( $wgUser );
380380 $list->setWatchlistDivs();
381 -
 381+
382382 $s = $list->beginRecentChangesList();
383383 $counter = 1;
384 - while ( $obj = $dbr->fetchObject( $res ) ) {
 384+ foreach ( $res as $obj ) {
385385 # Make RC entry
386386 $rc = RecentChange::newFromRow( $obj );
387387 $rc->counter = $counter++;
@@ -396,7 +396,7 @@
397397 } else {
398398 $rc->numberofWatchingusers = 0;
399399 }
400 -
 400+
401401 $tags = $this->wlTagsForRevision($obj->rc_this_oldid, array($collabWatchlist), $invert);
402402 // if( isset($tags) ) {
403403 // // Filter recentchanges which contain unwanted tags
@@ -411,71 +411,71 @@
412412 $attrs = $rc->getAttributes();
413413 $attrs['collabwatchlist_tags'] = $tags;
414414 $rc->setAttribs($attrs);
415 -
 415+
416416 $s .= $list->recentChangesLine( $rc, false, $counter );
417417 }
418418 $s .= $list->endRecentChangesList();
419 -
 419+
420420 $dbr->freeResult( $res );
421421 $wgOut->addHTML( $s );
422422 }
423 -
 423+
424424 function wlShowHideLink( $options, $message, $name, $value ) {
425425 global $wgUser;
426 -
 426+
427427 $showLinktext = wfMsgHtml( 'show' );
428428 $hideLinktext = wfMsgHtml( 'hide' );
429429 $title = SpecialPage::getTitleFor( 'CollabWatchlist' );
430430 $skin = $wgUser->getSkin();
431 -
 431+
432432 $label = $value ? $showLinktext : $hideLinktext;
433433 $options[$name] = 1 - (int) $value;
434 -
 434+
435435 return wfMsgHtml( $message, $skin->linkKnown( $title, $label, array(), $options ) );
436436 }
437 -
438 -
 437+
 438+
439439 function wlHoursLink( $h, $page, $options = array() ) {
440440 global $wgUser, $wgLang, $wgContLang;
441 -
 441+
442442 $sk = $wgUser->getSkin();
443443 $title = Title::newFromText( $wgContLang->specialPage( $page ) );
444444 $options['days'] = ($h / 24.0);
445 -
 445+
446446 $s = $sk->linkKnown(
447447 $title,
448448 $wgLang->formatNum( $h ),
449449 array(),
450450 $options
451451 );
452 -
 452+
453453 return $s;
454454 }
455 -
 455+
456456 function wlDaysLink( $d, $page, $options = array() ) {
457457 global $wgUser, $wgLang, $wgContLang;
458 -
 458+
459459 $sk = $wgUser->getSkin();
460460 $title = Title::newFromText( $wgContLang->specialPage( $page ) );
461461 $options['days'] = $d;
462462 $message = ($d ? $wgLang->formatNum( $d ) : wfMsgHtml( 'watchlistall2' ) );
463 -
 463+
464464 $s = $sk->linkKnown(
465465 $title,
466466 $message,
467467 array(),
468468 $options
469469 );
470 -
 470+
471471 return $s;
472472 }
473 -
 473+
474474 /**
475475 * Returns html
476476 */
477477 function wlCutoffLinks( $days, $page = 'CollabWatchlist', $options = array() ) {
478478 global $wgLang;
479 -
 479+
480480 $hours = array( 1, 2, 6, 12 );
481481 $days = array( 1, 3, 7 );
482482 $i = 0;
@@ -492,7 +492,7 @@
493493 $wgLang->pipeList( $days ),
494494 $this->wlDaysLink( 0, $page, $options ) );
495495 }
496 -
 496+
497497 /**
498498 * Count the number of items on a user's watchlist
499499 *
@@ -501,21 +501,21 @@
502502 */
503503 function wlCountItems( &$user, $talk = true ) {
504504 $dbr = wfGetDB( DB_SLAVE, 'watchlist' );
505 -
 505+
506506 # Fetch the raw count
507 - $res = $dbr->select( 'watchlist', 'COUNT(*) AS count',
 507+ $res = $dbr->select( 'watchlist', 'COUNT(*) AS count',
508508 array( 'wl_user' => $user->mId ), 'wlCountItems' );
509509 $row = $dbr->fetchObject( $res );
510510 $count = $row->count;
511511 $dbr->freeResult( $res );
512 -
 512+
513513 # Halve to remove talk pages if needed
514514 if( !$talk )
515515 $count = floor( $count / 2 );
516 -
 516+
517517 return( $count );
518518 }
519 -
 519+
520520 /** Returns an array of maps representing collab watchlist tags. The following fields are present
521521 * in each map:
522522 * - rl_id Id of the collaborative watchlist
@@ -553,13 +553,12 @@
554554 )
555555 );
556556 $tags = array();
557 - while( $row = $res->fetchObject() ) {
 557+ foreach( $res as $row ) {
558558 $tags[] = get_object_vars( $row );
559559 }
560 - $dbr->freeResult( $res );
561560 return $tags;
562561 }
563 -
 562+
564563 function wlGetFilterClauseForCollabWatchlistIds($rl_ids, $catNameCol, $pageIdCol) {
565564 $excludedCatPageIds = array();
566565 $includedCatPageIds = array();
@@ -573,7 +572,7 @@
574573 array( 'collabwatchlistcategory' => array('JOIN', 'collabwatchlist.rl_id = collabwatchlistcategory.rl_id'),
575574 'page' => array('JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id') )
576575 );
577 - while( $row = $res->fetchObject() ) {
 576+ foreach( $res as $row ) {
578577 if($row->page_namespace == NS_CATEGORY) {
579578 if($row->subtract) {
580579 $excludedCatPageIds[$row->cat_page_id] = $row->page_title;
@@ -584,8 +583,7 @@
585584 $includedPageIds[$row->cat_page_id] = $row->page_title;
586585 }
587586 }
588 - $dbr->freeResult( $res );
589 -
 587+
590588 if($includedCatPageIds) {
591589 $catTree = new CategoryTreeManip();
592590 $catTree->initialiseFromCategoryNames(array_values($includedCatPageIds));
@@ -603,7 +601,7 @@
604602 }
605603 return $collabWatchlistClause;
606604 }
607 -
 605+
608606 function wlGetFilterClauseListUser($rl_id) {
609607 $excludedUserIds = array();
610608 $dbr = wfGetDB( DB_SLAVE );
@@ -612,17 +610,16 @@
613611 array('collabwatchlistuser.rl_id' => $rl_id) # Conditions
614612 );
615613 $clause = '';
616 - while( $row = $res->fetchObject() ) {
 614+ foreach( $res as $row ) {
617615 $excludedUserIds[] = $row->user_id;
618616 }
619617 if($res->numRows() > 0) {
620618 $clause = '( rc_user NOT IN (';
621619 $clause .= implode(',', $this->addQuotes($dbr, $excludedUserIds)) . ') )';
622620 }
623 - $dbr->freeResult( $res );
624621 return $clause;
625622 }
626 -
 623+
627624 public static function addQuotes($db, $strings) {
628625 $result = array();
629626 foreach($strings as $string) {
Index: trunk/extensions/CollabWatchlist/includes/CategoryTreeManip.php
@@ -10,7 +10,7 @@
1111 * @author fhackenberger
1212 */
1313 class CategoryTreeManip {
14 -
 14+
1515 var $root;
1616 var $name;
1717 var $id;
@@ -18,7 +18,7 @@
1919 var $parents = array();
2020 var $enabled = true;
2121 var $children = array();
22 -
 22+
2323 /**
2424 * Constructor
2525 */
@@ -32,7 +32,7 @@
3333 }
3434 $this->parents = $parents;
3535 }
36 -
 36+
3737 private function addChildren($children) {
3838 if(!is_array($children))
3939 throw new Exception('Argument must be an array');
@@ -40,7 +40,7 @@
4141 $this->children[$child->id] = $child;
4242 }
4343 }
44 -
 44+
4545 private function addParents($parents) {
4646 if(!is_array($parents))
4747 throw new Exception('Argument must be an array');
@@ -48,18 +48,17 @@
4949 $this->parents[$parent->id] = $parent;
5050 }
5151 }
52 -
 52+
5353 /** Disable this category node and all subcategory nodes
5454 * @return
5555 */
5656 public function disable() {
5757 $this->recursiveDisable();
5858 }
59 -
 59+
6060 /** Disable the given categories (by id) and all their subcategories
61 - *
 61+ *
6262 * @param array $catPageIds The page ids of the categories to disable
63 - * @return
6463 */
6564 public function disableCategoryIds($catPageIds) {
6665 foreach($catPageIds as $catId) {
@@ -69,7 +68,7 @@
7069 }
7170 }
7271 }
73 -
 72+
7473 private function recursiveDisable($visitedNodeIds = array()) {
7574 if(!$this->enabled || array_key_exists($this->id, $visitedNodeIds))
7675 return; # Break the recursion
@@ -77,12 +76,12 @@
7877 $visitedNodeIds[] = $this->id;
7978 foreach($this->children as $cat) {
8079 $cat->recursiveDisable($visitedNodeIds);
81 - }
 80+ }
8281 }
83 -
 82+
8483 /** Returns a list of enables category names, including
8584 * all subcategories.
86 - *
 85+ *
8786 * @return array An array of category names
8887 */
8988 public function getEnabledCategoryNames() {
@@ -93,16 +92,16 @@
9493 }
9594 return $enabledCategories;
9695 }
97 -
 96+
9897 /** Returns a map of enabled categories, including
9998 * all subcategories.
100 - *
 99+ *
101100 * @return array An array mapping from category page ids to CategoryTreeManip objects
102101 */
103102 public function getEnabledNodeMap() {
104103 return $this->root->recursiveGetEnabledNodeMap();
105104 }
106 -
 105+
107106 private function recursiveGetEnabledNodeMap(&$foundNodes = array()) {
108107 if(isset($this->id)) {
109108 if(!$this->enabled || array_key_exists($this->id, $foundNodes))
@@ -114,9 +113,9 @@
115114 }
116115 return $foundNodes;
117116 }
118 -
 117+
119118 /** Returns a CategoryTreeManip node, given a category page id
120 - *
 119+ *
121120 * @param $catPageId The page id of the category to retrieve
122121 * @return CategoryTreeManip The node
123122 */
@@ -124,14 +123,14 @@
125124 if(array_key_exists($catPageId, $this->root->catPageIdToNode))
126125 return $this->root->catPageIdToNode[$catPageId];
127126 }
128 -
 127+
129128 private function addNode($node) {
130129 $this->root->catPageIdToNode[$node->id] = $node;
131130 }
132 -
 131+
133132 /** Build the category tree, given a list of category names.
134133 * All categories and subcategories are enabled by default.
135 - *
 134+ *
136135 * @param array $catNames An array of strings representing category names
137136 * @return
138137 */
@@ -147,7 +146,7 @@
148147 );
149148 $parentList = array();
150149 $childList = array();
151 - while( $row = $res->fetchObject() ) {
 150+ foreach( $res as $row ) {
152151 $parentList[$row->parName][] = array($row->childId, $row->childName);
153152 if(array_key_exists($row->childId, $childList)) {
154153 $childEntry = $childList[$row->childId];
@@ -156,8 +155,7 @@
157156 $childList[$row->childId] = array($row->childName, array($row->parName));
158157 }
159158 }
160 - $dbr->freeResult( $res );
161 -
 159+
162160 if(!isset($parentNameToNode) && !empty($parentList)) {
163161 // Fetch the page ids of the $catNames and add the parent categories if needed
164162 $res = $dbr->select( array('page' ), # Tables
@@ -165,7 +163,7 @@
166164 array('page_title' => array_keys($parentList)) # Conditions
167165 );
168166 $parentNameToNode = array();
169 - while( $row = $res->fetchObject() ) {
 167+ foreach( $res as $row ) {
170168 $node = $this->getNodeForCatPageId($row->page_id);
171169 if(!isset($node)) {
172170 $node = new CategoryTreeManip($row->page_id, $row->page_title, $this->root);
@@ -174,9 +172,8 @@
175173 }
176174 $parentNameToNode[$row->page_title] = $node;
177175 }
178 - $dbr->freeResult( $res );
179176 }
180 -
 177+
181178 $newChildNameToNode = array();
182179 // Add the new child nodes
183180 foreach($childList as $childPageId => $childInfo) {
@@ -192,7 +189,7 @@
193190 $childNode->addParents(array($parent));
194191 }
195192 }
196 -
 193+
197194 // Prepare for the next loop
198195 $parentNameToNode = $newChildNameToNode;
199196 $catNames = array_keys($parentNameToNode);
Index: trunk/extensions/CollabWatchlist/includes/CollabWatchlistChangesList.php
@@ -5,7 +5,7 @@
66 class CollabWatchlistChangesList extends EnhancedChangesList {
77 protected $user;
88 protected $tagCheckboxIndex = 0;
9 -
 9+
1010 /**
1111 * Collaborative Watchlist contructor
1212 * @param User $user
@@ -15,7 +15,7 @@
1616 parent::__construct($skin);
1717 $this->user = $user;
1818 }
19 -
 19+
2020 /**
2121 * (non-PHPdoc)
2222 * @see includes/EnhancedChangesList#beginRecentChangesList()
@@ -25,13 +25,13 @@
2626 $gwlSpeciaPageTitle = SpecialPage::getTitleFor( 'CollabWatchlist' );
2727 $result = Xml::openElement('form', array(
2828 'class' => 'mw-collaborative-watchlist-addtag-form',
29 - 'method' => 'post',
 29+ 'method' => 'post',
3030 'action' => $gwlSpeciaPageTitle->getLocalUrl( array( 'action' => 'setTags' ))));
3131 $result .= Xml::input('redirTarget', false, $wgRequest->getFullRequestURL(), array('type' => 'hidden'));
3232 $result .= parent::beginRecentChangesList();
3333 return $result;
3434 }
35 -
 35+
3636 /**
3737 * (non-PHPdoc)
3838 * @see includes/EnhancedChangesList#endRecentChangesList()
@@ -50,7 +50,7 @@
5151 $result .= Xml::closeElement('form');
5252 return $result;
5353 }
54 -
 54+
5555 /**
5656 * (non-PHPdoc)
5757 * @see includes/EnhancedChangesList#insertBeforeRCFlags($r, $rcObj)
@@ -62,18 +62,18 @@
6363 'value' => ($rcObj->getTitle() . '|' . $rcObj->getAttribute('rc_this_oldid') . '|' . $rcObj->getAttribute('rc_id'))));
6464 $this->tagCheckboxIndex++;
6565 }
66 -
 66+
6767 /**
6868 * (non-PHPdoc)
6969 * @see includes/EnhancedChangesList#insertBeforeRCFlagsBlock($r, $block)
7070 */
7171 protected function insertBeforeRCFlagsBlock( &$r, &$block ) {
7272 $r .= Xml::element('input', array(
73 - 'name' => 'collaborative-watchlist-addtag-placeholder',
 73+ 'name' => 'collaborative-watchlist-addtag-placeholder',
7474 'type' => 'checkbox',
7575 'style' => 'visibility: hidden;'));
7676 }
77 -
 77+
7878 /**
7979 * (non-PHPdoc)
8080 * @see includes/ChangesList#insertRollback($s, $rc)
@@ -96,7 +96,7 @@
9797 }
9898 }
9999 }
100 -
 100+
101101 /**
102102 * Fetch an appropriate changes list class for the specified user
103103 * Some users might want to use an enhanced list format, for instance
@@ -113,7 +113,7 @@
114114 return $list;
115115 }
116116 }
117 -
 117+
118118 /**
119119 * (non-PHPdoc)
120120 * @see includes/ChangesList#insertTags($s, $rc, $classes)
@@ -125,7 +125,7 @@
126126 $s .= ' ' . $tagSummary;
127127 }
128128 }
129 -
 129+
130130 /**
131131 * (non-PHPdoc)
132132 * @see includes/EnhancedChangesList#insertHistLink($s, $rc, $title, $params, $sep)
@@ -133,7 +133,7 @@
134134 protected function insertHistLink( &$s, &$rc, $title, $params = array(), $sep = NULL ) {
135135 // No history
136136 }
137 -
 137+
138138 /**
139139 * (non-PHPdoc)
140140 * @see includes/EnhancedChangesList#insertCurrAndLastLinks($s, $rc)
@@ -143,7 +143,7 @@
144144 $s .= $rc->curlink;
145145 $s .= ')';
146146 }
147 -
 147+
148148 /**
149149 * (non-PHPdoc)
150150 * @see includes/EnhancedChangesList#insertUserAndTalkLinks($s, $rc)
@@ -151,16 +151,16 @@
152152 protected function insertUserAndTalkLinks( &$s, &$rc ) {
153153 $s .= $rc->userlink;
154154 }
155 -
 155+
156156 /**
157 - * Insert the tags of the given change
 157+ * Insert the tags of the given change
158158 */
159159 private function formatReviewSummaryRow( $rc, $page ) {
160160 global $wgRequest;
161161 $s = '';
162162 if( !$rc )
163163 return $s;
164 -
 164+
165165 $attr = $rc->mAttribs;
166166 $tagRows = $attr['collabwatchlist_tags'];
167167
@@ -177,7 +177,7 @@
178178 ChangeTags::tagDescription( $tag )
179179 );
180180 $classes[] = Sanitizer::escapeClass( "mw-collabwatchlist-tag-$tag" );
181 -
 181+
182182 /** Insert links to user page, user talk page and eventually a blocking link */
183183 $userLink = $this->skin->userLink( $tagRow['user_id'], $tagRow['user_name'] );
184184 $delTagTarget = CollabWatchlistEditor::getUnsetTagUrl( $wgRequest->getFullRequestURL(), $attr['rc_title'], $tagRow['rl_id'], $tag, $attr['rc_id'] );
@@ -188,10 +188,10 @@
189189 $markers = Xml::tags( 'span', array( 'class' => 'mw-collabwatchlist-tag-markers' ), $markers );
190190 return array( $markers, $classes );
191191 }
192 -
 192+
193193 /** Generate a form 'select' element for the collaborative watchlists and a 'select' element for choosing a tag.
194194 * The tag selector reacts on the watchlist selector and displays the relevant tags only, if javascript is enabled.
195 - *
 195+ *
196196 * @see #collabWatchlistSelector()
197197 * @see #tagSelector()
198198 * @param String $rlLabel The label for the collab watchlist select tag
@@ -205,7 +205,7 @@
206206 $ret = self::collabWatchlistSelector($glWlIdAndName, $selected, $all, $element_name, $rlLabel, $rlElementId, $tagElementIdBase);
207207 $ret .= '&nbsp;';
208208 $ret .= self::tagSelector(array_keys($glWlIdAndName), $tagLabel);
209 - // Make sure the correct tags for the default selection are set
 209+ // Make sure the correct tags for the default selection are set
210210 $ret .= Xml::element( 'script',
211211 array(
212212 'type' => $wgJsMimeType,
@@ -230,11 +230,11 @@
231231 * @return string
232232 */
233233 public static function collabWatchlistSelector( $glWlIdAndName, $selected = '', $all = null, $element_name = 'collabwatchlist', $label = null, $element_id = 'collabwatchlist', $tagElementIdBase = null ) {
234 - global $wgContLang, $wgScriptPath, $wgJsMimeType;
 234+ global $wgScriptPath, $wgJsMimeType;
235235 $ret = '';
236236 if(isset($tagElementIdBase)) {
237237 $jsPath = "$wgScriptPath/extensions/CollabWatchlist/js";
238 - $ret .= Xml::element( 'script',
 238+ $ret .= Xml::element( 'script',
239239 array(
240240 'type' => $wgJsMimeType,
241241 'src' => "$jsPath/CollabWatchlist.js",
@@ -260,7 +260,7 @@
261261 if( $index === 0 )
262262 $name = wfMsg( 'blankcollabwatchlist' );
263263 $options[] = Xml::option( $name, $index, $index === $selected, isset($tagElementIdBase) ?
264 - array('onclick' => 'onCollabWatchlistSelection("' . $tagElementIdBase . '", this.value)') :
 264+ array('onclick' => 'onCollabWatchlistSelection("' . $tagElementIdBase . '", this.value)') :
265265 array()
266266 );
267267 }
@@ -279,10 +279,10 @@
280280 }
281281 return $ret;
282282 }
283 -
 283+
284284 /**
285285 * Build a drop-down box for selecting a collaborative watchlist tag
286 - *
 286+ *
287287 * @param array $rlIds A list of collaborative watchlist ids
288288 * @param String $label The label for the select tag
289289 * @param String $elemId The id of the select tag
@@ -323,12 +323,12 @@
324324 'name' => 'collabwatchlisttag-rl',
325325 'class' => 'mw-collaborative-watchlist-tag-selector')) .
326326 Xml::closeElement('select');
327 -
 327+
328328 return $ret;
329329 }
330 -
 330+
331331 /** Returns an array mapping from collab watchlist tag names to information about the tag
332 - *
 332+ *
333333 * The info is an array with the following keys:
334334 * 'rt_description' The description of the tag
335335 * 'rl_ids' An array of collab watchlist ids the tag belongs to
@@ -346,17 +346,16 @@
347347 __METHOD__
348348 );
349349 $list = array();
350 - while( $row = $res->fetchObject() ) {
 350+ foreach( $res as $row ) {
351351 if(array_key_exists($row->rt_name, $list)) {
352352 $list[$row->rt_name]['rl_ids'][] = $row->rl_id;
353353 } else {
354354 $list[$row->rt_name] = array('rt_description' => $row->rt_description, 'rl_ids' => array($row->rl_id));
355355 }
356356 }
357 - $dbr->freeResult( $res );
358357 return $list;
359358 }
360 -
 359+
361360 //XXX Cache the result of this method in this class
362361 /** Get an array mapping from collab watchlist id to its name, filtering by member type
363362 * The method return only collab watchlist the given user is a member of, restricted by the allowed member types
@@ -376,13 +375,12 @@
377376 # Join conditions
378377 array( 'collabwatchlistuser' => array('JOIN', $wgDBprefix . 'collabwatchlist.rl_id = ' . $wgDBprefix . 'collabwatchlistuser.rl_id') )
379378 );
380 - while( $row = $res->fetchObject() ) {
 379+ foreach( $res as $row ) {
381380 $list[$row->rl_id] = $row->rl_name;
382381 }
383 - $dbr->freeResult( $res );
384382 return $list;
385383 }
386 -
 384+
387385 //XXX Copied from HistoryPage, we should patch HistoryPage to export that functionality
388386 // as a static function
389387 /**
@@ -393,7 +391,7 @@
394392 * @return String Undo Link
395393 */
396394 public static function generateUndoLink($skin, $title, $revision, $undoAfterRevision) {
397 - if( ! $revision instanceof Revision || ! $undoAfterRevision instanceof Revision ||
 395+ if( ! $revision instanceof Revision || ! $undoAfterRevision instanceof Revision ||
398396 ! $title instanceof Title || !$skin instanceof Skin )
399397 return null;
400398 # Create undo tooltip for the first (=latest) line only
Index: trunk/extensions/CollabWatchlist/includes/CollabWatchlistEditor.php
@@ -22,7 +22,7 @@
2323 const USERS_EDIT_RAW = 7;
2424 const NEW_LIST = 8;
2525 const DELETE_LIST = 9;
26 -
 26+
2727 /**
2828 * Main execution point
2929 *
@@ -267,14 +267,14 @@
268268 return $tokenOk;
269269 return $this->checkPermissions( $user, $rlId, $memberTypes );
270270 }
271 -
 271+
272272 private function checkPermissions( $user, $rlId, $memberTypes = array(COLLABWATCHLISTUSER_OWNER) ) {
273273 // Check permissions
274274 $dbr = wfGetDB( DB_MASTER );
275275 $res = $dbr->select( 'collabwatchlistuser',
276 - 'COUNT(*) AS count',
 276+ 'COUNT(*) AS count',
277277 array( 'rl_id' => $rlId, 'user_id' => $user->getId(), 'rlu_type' => $memberTypes ),
278 - __METHOD__
 278+ __METHOD__
279279 );
280280 $row = $dbr->fetchObject( $res );
281281 return $row->count >= 1;
@@ -311,7 +311,7 @@
312312 }
313313 return array_unique( $titles );
314314 }
315 -
 315+
316316 private function extractTypeTypeTextAndUsername( $typeAndUsernameStr ) {
317317 $type = COLLABWATCHLISTUSER_USER;
318318 $typeText = COLLABWATCHLISTUSER_USER_TEXT;
@@ -332,7 +332,7 @@
333333 }
334334 return array($type, $typeText, $titleText);
335335 }
336 -
 336+
337337 /**
338338 * Extract a list of users from a blob of text, returning
339339 * (prefixed) strings
@@ -358,7 +358,7 @@
359359 }
360360 return array_unique( $titles );
361361 }
362 -
 362+
363363 /**
364364 * Extract a list of tags from a blob of text, returning
365365 * (prefixed) strings
@@ -425,7 +425,7 @@
426426 }
427427 $output->addHTML( "</ul>\n" );
428428 }
429 -
 429+
430430 /**
431431 * Print out a list of tags with description
432432 *
@@ -458,7 +458,7 @@
459459 $row = $dbr->fetchObject( $res );
460460 return $row->count;
461461 }
462 -
 462+
463463 /**
464464 * Count the number of users on a collaborative watchlist
465465 *
@@ -471,7 +471,7 @@
472472 $row = $dbr->fetchObject( $res );
473473 return $row->count;
474474 }
475 -
 475+
476476 /**
477477 * Count the number of tags on a collaborative watchlist
478478 *
@@ -484,7 +484,7 @@
485485 $row = $dbr->fetchObject( $res );
486486 return $row->count;
487487 }
488 -
 488+
489489 /**
490490 * Count the number of set edit tags on a collaborative watchlist
491491 *
@@ -519,16 +519,15 @@
520520 array( 'page' => array('JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id') )
521521 );
522522 if( $res->numRows() > 0 ) {
523 - while( $row = $res->fetchObject() ) {
 523+ foreach( $res as $row ) {
524524 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
525525 if( $title instanceof Title && !$title->isTalkPage() )
526526 $list[] = $row->subtract ? '- ' . $title->getPrefixedText() : $title->getPrefixedText();
527527 }
528 - $res->free();
529528 }
530529 return $list;
531530 }
532 -
 531+
533532 /**
534533 * Prepare a list of users on a collaborative watchlist
535534 * and return an array of (prefixed) strings
@@ -550,15 +549,14 @@
551550 array( 'user' => array('JOIN', 'user.user_id = collabwatchlistuser.user_id') )
552551 );
553552 if( $res->numRows() > 0 ) {
554 - while( $row = $res->fetchObject() ) {
 553+ foreach( $res as $row ) {
555554 $typeText = fnCollabWatchlistUserTypeToText($row->rlu_type);
556555 $list[] = $typeText . ' ' . $row->user_name;
557556 }
558 - $res->free();
559557 }
560558 return $list;
561559 }
562 -
 560+
563561 /**
564562 * Prepare a list of tags on a collaborative watchlist
565563 * and return an array of tag names mapping to tag descriptions
@@ -577,10 +575,9 @@
578576 ), __METHOD__
579577 );
580578 if( $res->numRows() > 0 ) {
581 - while( $row = $res->fetchObject() ) {
 579+ foreach( $res as $row ) {
582580 $list[$row->rt_name] = $row->rt_description;
583581 }
584 - $res->free();
585582 }
586583 return $list;
587584 }
@@ -596,7 +593,7 @@
597594 private function getWatchlistInfo( $rlId ) {
598595 $titles = array();
599596 $dbr = wfGetDB( DB_MASTER );
600 -
 597+
601598 $res = $dbr->select(
602599 array('collabwatchlistcategory', 'page'),
603600 array('page_title', 'page_namespace', 'page_id', 'page_len', 'page_is_redirect', 'subtract'),
@@ -607,10 +604,10 @@
608605 # Join conditions
609606 array( 'page' => array('JOIN', 'page.page_id = collabwatchlistcategory.cat_page_id') )
610607 );
611 -
 608+
612609 if( $res && $dbr->numRows( $res ) > 0 ) {
613610 $cache = LinkCache::singleton();
614 - while( $row = $dbr->fetchObject( $res ) ) {
 611+ foreach( $res as $row ) {
615612 $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
616613 if( $title instanceof Title ) {
617614 // Update the link cache while we're at it
@@ -645,7 +642,7 @@
646643 }
647644 return $count;
648645 }
649 -
 646+
650647 /**
651648 * Show a message indicating the number of categories on the collaborative watchlist,
652649 * and return this count for additional checking
@@ -663,7 +660,7 @@
664661 }
665662 return $count;
666663 }
667 -
 664+
668665 /**
669666 * Show a message indicating the number of set tags for edits on the collaborative watchlist,
670667 * and return this count for additional checking
@@ -681,7 +678,7 @@
682679 }
683680 return $count;
684681 }
685 -
 682+
686683 /**
687684 * Show a message indicating the number of categories on the collaborative watchlist,
688685 * and return this count for additional checking
@@ -699,7 +696,7 @@
700697 }
701698 return $count;
702699 }
703 -
 700+
704701 /**
705702 * Remove all categories from a collaborative watchlist
706703 *
@@ -744,7 +741,7 @@
745742 $dbw->insert( 'collabwatchlistcategory', $rows, __METHOD__, 'IGNORE' );
746743 return $added;
747744 }
748 -
 745+
749746 /**
750747 * Add a list of users to a collaborative watchlist
751748 *
@@ -772,7 +769,7 @@
773770 $dbw->insert( 'collabwatchlistuser', $rows, __METHOD__, 'IGNORE' );
774771 return $added;
775772 }
776 -
 773+
777774 private function setTags( $titlesAndTagInfo, $tag, $userId, $rlId, $comment, $setPatrolled = false) {
778775 //XXX Attach a hook to delete tags from the collabwatchlistrevisiontag table as soon as the actual tags are deleted from the change_tags table
779776 $allowedTagsAndInfo = $this->getCollabWatchlistTags($rlId);
@@ -792,7 +789,7 @@
793790 }
794791 }
795792 // Add the tagged revisions to the collaborative watchlist
796 - $sql = 'INSERT IGNORE INTO collabwatchlistrevisiontag (ct_id, rl_id, user_id, rrt_comment)
 793+ $sql = 'INSERT IGNORE INTO collabwatchlistrevisiontag (ct_id, rl_id, user_id, rrt_comment)
797794 SELECT ct_id, ' . $dbw->strencode($rlId) . ',' .
798795 $dbw->strencode($userId) . ',' .
799796 $dbw->addQuotes($comment) . ' FROM change_tag WHERE ct_tag = ? AND ct_rc_id ';
@@ -809,7 +806,7 @@
810807 return true;
811808 }
812809 }
813 -
 810+
814811 private function unsetTags( $titlesAndTagInfo, $tag, $userId, $rlId ) {
815812 $dbw = wfGetDB( DB_MASTER );
816813 foreach( $titlesAndTagInfo as $title => $infos ) {
@@ -820,8 +817,8 @@
821818 $rcIds[] = $info['rc_id'];
822819 }
823820 // Remove the tag from the collaborative watchlist
824 - $sql = 'delete collabwatchlistrevisiontag from collabwatchlistrevisiontag JOIN change_tag
825 - ON change_tag.ct_id = collabwatchlistrevisiontag.ct_id
 821+ $sql = 'delete collabwatchlistrevisiontag from collabwatchlistrevisiontag JOIN change_tag
 822+ ON change_tag.ct_id = collabwatchlistrevisiontag.ct_id
826823 WHERE ct_tag = ? AND ct_rc_id ';
827824 if( count($rcIds) > 1 ) {
828825 $sql .= 'IN (' . $dbw->makeList($rcIds) . ')';
@@ -835,7 +832,7 @@
836833 $dbw->freePrepared($prepSql);
837834 }
838835 }
839 -
 836+
840837 /**
841838 * Add a list of tags to a collaborative watchlist
842839 *
@@ -893,7 +890,7 @@
894891 }
895892 }
896893 }
897 -
 894+
898895 /**
899896 * Remove a list of users from a collaborative watchlist
900897 *
@@ -922,7 +919,7 @@
923920 //XXX Check if we can simply rename the hook, or if we need to register it
924921 //wfRunHooks('UnwatchArticleComplete',array(&$user,&$article));
925922 }
926 -
 923+
927924 /**
928925 * Remove a list of tags from a collaborative watchlist
929926 *
@@ -970,7 +967,7 @@
971968 $output->addHTML( $form );
972969 }
973970 }
974 -
 971+
975972 private function showNewListForm( $output ) {
976973 global $wgUser;
977974 $self = SpecialPage::getTitleFor( 'CollabWatchlist' );
@@ -984,7 +981,7 @@
985982 $form .= '</fieldset></form>';
986983 $output->addHTML( $form );
987984 }
988 -
 985+
989986 private function showDeleteListForm( $output, $rlId ) {
990987 global $wgUser;
991988 $self = SpecialPage::getTitleFor( 'CollabWatchlist' );
@@ -1000,7 +997,7 @@
1001998 $form .= '</fieldset></form>';
1002999 $output->addHTML( $form );
10031000 }
1004 -
 1001+
10051002 private function createNewList($name) {
10061003 global $wgUser;
10071004 if( !isset($name) || empty($name) )
@@ -1014,7 +1011,7 @@
10151012 'rl_name' => $name,
10161013 'rl_start' => wfTimestamp(TS_ISO_8601),
10171014 ), __METHOD__, 'IGNORE' );
1018 -
 1015+
10191016 $affected = $dbw->affectedRows();
10201017 if( $affected ) {
10211018 $newid = $dbw->insertId();
@@ -1039,7 +1036,7 @@
10401037 $dbw->rollback();
10411038 }
10421039 }
1043 -
 1040+
10441041 private function deleteList($rlId) {
10451042 if( !isset($rlId) || empty($rlId) )
10461043 return;
@@ -1188,7 +1185,7 @@
11891186 $form .= '</fieldset></form>';
11901187 $output->addHTML( $form );
11911188 }
1192 -
 1189+
11931190 /**
11941191 * Show a form for editing the tags of a collaborative watchlist in "raw" mode
11951192 *
@@ -1218,7 +1215,7 @@
12191216 $form .= '</fieldset></form>';
12201217 $output->addHTML( $form );
12211218 }
1222 -
 1219+
12231220 /**
12241221 * Show a form for editing the users of a collaborative watchlist in "raw" mode
12251222 *
@@ -1293,7 +1290,7 @@
12941291 */
12951292 public static function buildTools( $listIdsAndNames, $skin ) {
12961293 global $wgLang, $wgUser;
1297 - $modes = array( 'view' => false, 'delete' => 'delete', 'edit' => 'edit',
 1294+ $modes = array( 'view' => false, 'delete' => 'delete', 'edit' => 'edit',
12981295 'rawCategories' => 'rawCategories', 'rawTags' => 'rawTags',
12991296 'rawUsers' => 'rawUsers' );
13001297 $r = '';
@@ -1323,9 +1320,9 @@
13241321 }
13251322 return $r;
13261323 }
1327 -
 1324+
13281325 /** Returns a URL for unsetting a specific tag on a specific edit on a given list
1329 - *
 1326+ *
13301327 * @param String $redirUrl The url to redirect after the tag was removed
13311328 * @param String $pageName The name of the page the tag is set on
13321329 * @param int $rlId The id of the collab watchlist

Status & tagging log