r99579 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99578‎ | r99579 | r99580 >
Date:21:45, 11 October 2011
Author:catrope
Status:ok
Tags:
Comment:
More Contest fixes
* Add indexes for every criterion+sortColumn combination
* Make sure that only one of contest or challenge is set in the WHERE condition, not both (because that's unnecessary)
* Escape stuff in ContestantPager::formatValue()
Modified paths:
  • /trunk/extensions/Contest/Contest.sql (modified) (history)
  • /trunk/extensions/Contest/includes/ContestantPager.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/specials/SpecialContest.php
@@ -130,6 +130,7 @@
131131
132132 if ( $challenge !== false ) {
133133 $conds['contestant_challenge_id'] = $challenge->getField( 'id' );
 134+ unset( $conds['contestant_contest_id'] ); // Not needed because the challenge implies the context
134135 }
135136 }
136137
Index: trunk/extensions/Contest/includes/ContestantPager.php
@@ -190,18 +190,19 @@
191191 );
192192 break;
193193 case 'contestant_volunteer': case 'contestant_wmf':
194 - $value = wfMsg( 'contest-contestant-' . ( $value === '1' ? 'yes' : 'no' ) );
 194+ // contest-contestant-yes, contest-contestant-no
 195+ $value = htmlspecialchars( wfMsg( 'contest-contestant-' . ( $value === '1' ? 'yes' : 'no' ) ) );
195196 break;
196197 case 'contestant_comments':
197 - $value = $this->getLang()->formatNum( $value );
 198+ $value = htmlspecialchars( $this->getLang()->formatNum( $value ) );
198199 break;
199200 case 'contestant_rating':
200 - $value = wfMsgExt(
 201+ $value = htmlspecialchars( wfMsgExt(
201202 'contest-contestant-rating',
202203 'parsemag',
203204 $this->getLang()->formatNum( $value ),
204205 $this->getLang()->formatNum( $this->mCurrentRow->contestant_rating_count )
205 - );
 206+ ) );
206207 break;
207208 }
208209
Index: trunk/extensions/Contest/Contest.sql
@@ -46,8 +46,19 @@
4747 contestant_comments SMALLINT unsigned NOT NULL -- The number of comments
4848 ) /*$wgDBTableOptions*/;
4949 -- TODO: probably need to split indexes, see queries in ContestantPager
50 -CREATE INDEX /*i*/contest_contestants_interests ON /*_*/contest_contestants (contestant_challenge_id, contestant_wmf, contestant_volunteer);
51 -CREATE INDEX /*i*/contest_contestants_rating ON /*_*/contest_contestants (contestant_challenge_id, contestant_rating, contestant_rating_count);
 50+CREATE INDEX /*i*/contest_contestants_contest_id ON /*_*/contest_contestants (contestant_contest_id, contestant_id);
 51+CREATE INDEX /*i*/contest_contestants_challenge_id ON /*_*/contest_contestants (contestant_challenge_id, contestant_id);
 52+CREATE INDEX /*i*/contest_contestants_contest_challenge ON /*_*/contest_contestants (contestant_contest_id, contestant_challenge_id);
 53+CREATE INDEX /*i*/contest_contestants_contest_volunteer ON /*_*/contest_contestants (contestant_contest_id, contestant_volunteer);
 54+CREATE INDEX /*i*/contest_contestants_challenge_volunteer ON /*_*/contest_contestants (contestant_challenge_id, contestant_volunteer);
 55+CREATE INDEX /*i*/contest_contestants_contest_wmf ON /*_*/contest_contestants (contestant_contest_id, contestant_wmf);
 56+CREATE INDEX /*i*/contest_contestants_challenge_wmf ON /*_*/contest_contestants (contestant_challenge_id, contestant_wmf);
 57+CREATE INDEX /*i*/contest_contestants_contest_comments ON /*_*/contest_contestants (contestant_contest_id, contestant_comments);
 58+CREATE INDEX /*i*/contest_contestants_challenge_comments ON /*_*/contest_contestants (contestant_challenge_id, contestant_comments);
 59+CREATE INDEX /*i*/contest_contestants_contest_rating ON /*_*/contest_contestants (contestant_contest_id, contestant_rating);
 60+CREATE INDEX /*i*/contest_contestants_challenge_rating ON /*_*/contest_contestants (contestant_challenge_id, contestant_rating);
 61+CREATE INDEX /*i*/contest_contestants_contest_rating_count ON /*_*/contest_contestants (contestant_contest_id, contestant_rating_count);
 62+CREATE INDEX /*i*/contest_contestants_challenge_rating_count ON /*_*/contest_contestants (contestant_challenge_id, contestant_rating_count);
5263 CREATE UNIQUE INDEX /*i*/contest_contestants_id_user ON /*_*/contest_contestants (contestant_contest_id, contestant_user_id);
5364
5465 -- Challenges

Status & tagging log