Exemple #1
0
 protected function maintainReactivatedTeams()
 {
     // permanently delete new teams which did not match in last 2 months
     $two_months_in_past = strtotime('-2 months');
     $two_months_in_past = strftime('%Y-%m-%d %H:%M:%S', $two_months_in_past);
     $teamIds = team::getNewTeamIds();
     foreach ($teamIds as $teamid) {
         $team = new team($teamid);
         if (($lastMatch = $team->getNewestMatchTimestamp()) && $lastMatch < $two_months_in_past) {
             $uids = $team->getUserIds();
             foreach ($uids as $userid) {
                 $user = new user($userid);
                 $user->removeTeamMembership($teamid);
                 $user->update();
             }
             $team->delete();
         }
     }
 }