r98941 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98940‎ | r98941 | r98942 >
Date:22:32, 4 October 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added cv field and delete linked contest stuff
Modified paths:
  • /trunk/extensions/Contest/Contest.sql (modified) (history)
  • /trunk/extensions/Contest/includes/Contest.class.php (modified) (history)
  • /trunk/extensions/Contest/includes/ContestContestant.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/includes/ContestContestant.php
@@ -95,6 +95,7 @@
9696 'country' => 'str',
9797 'volunteer' => 'bool',
9898 'wmf' => 'bool',
 99+ 'cv' => 'str',
99100
100101 'submission' => 'str',
101102
@@ -120,6 +121,7 @@
121122 'country' => '',
122123 'volunteer' => false,
123124 'wmf' => false,
 125+ 'cv' => false,
124126
125127 'submission' => '',
126128
Index: trunk/extensions/Contest/includes/Contest.class.php
@@ -394,8 +394,27 @@
395395 * @return boolean Success indicator
396396 */
397397 public function removeAllFromDB() {
398 - // TODO
399 - return parent::removeFromDB();
 398+ $condition = array( 'contest_id' => $this->getId() );
 399+
 400+ $success = ContestChallenge::s()->delete( $condition );
 401+
 402+ if ( $success ) {
 403+ $contestantIds = array();
 404+
 405+ foreach ( ContestContestant::s()->select( 'id', $condition ) as /* ContestContestant */ $contestant ) {
 406+ $contestantIds[] = $contestant->getId();
 407+ }
 408+
 409+ $success = ContestComment::s()->delete( array( 'contestant_id' => $contestantIds ) ) && $success;
 410+ $success = ContestVote::s()->delete( array( 'contestant_id' => $contestantIds ) ) && $success;
 411+ $success = ContestContestant::s()->delete( $condition ) && $success;
 412+ }
 413+
 414+ if ( $success ) {
 415+ $success = parent::removeFromDB();
 416+ }
 417+
 418+ return $success;
400419 }
401420
402421 /**
Index: trunk/extensions/Contest/Contest.sql
@@ -33,6 +33,7 @@
3434 contestant_country VARCHAR(255) NOT NULL, -- Country code of the contestant
3535 contestant_volunteer TINYINT unsigned NOT NULL, -- If the user is interested in voluneer oportunities
3636 contestant_wmf TINYINT unsigned NOT NULL, -- If the user is interested in a WMF job
 37+ contestant_cv TINYBLOB NOT NULL, -- URL to the users CV
3738
3839 contestant_submission TINYBLOB NOT NULL, -- URL to the users submission
3940

Status & tagging log