Changeset 1136 for trunk


Ignore:
Timestamp:
04/25/10 16:25:18 (2 years ago)
Author:
wefgef
Message:

Updated "db-strip" script.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/db-strip

    r1110 r1136  
    33 
    44require_once(dirname($argv[0]) . "/utilities.php"); 
     5require_once(dirname($argv[0]) . "/../common/db/round_task.php"); 
     6 
    57db_connect(); 
    68$smfprefix = IA_SMF_DB_PREFIX; 
     
    8587    WHERE (ia_task.id IS NULL) OR (ia_round.id IS NULL)"); 
    8688 
     89// Recompute round task order 
     90$rounds = db_fetch_all("SELECT DISTINCT `round_id` AS `id` FROM ia_round_task"); 
     91foreach ($rounds as $round) { 
     92    round_task_recompute_order($round['id']); 
     93} 
     94 
     95// Delete orphan task ratings. 
     96log_print("Deleting orphan task_ratings"); 
     97db_query("DELETE ia_task_ratings FROM ia_task_ratings 
     98    LEFT JOIN ia_task ON ia_task_ratings.task_id = ia_task.id 
     99    LEFT JOIN ia_user on ia_task_ratings.user_id = ia_user.id 
     100    WHERE (ia_user.id IS NULL) OR (ia_task.id IS NULL)"); 
     101 
    87102// Delete orphan scores. 
    88103log_print("Deleting orphan scores."); 
     
    108123 
    109124foreach ($rounds as $round) { 
    110     round_recompute_score($round['round_id']); 
     125    round_recompute_score($round['id']); 
    111126} 
    112127 
Note: See TracChangeset for help on using the changeset viewer.