예제 #1
0
 protected function checkForBattleCacheUpdate($systemIds, $timestampStart, $timestampEnd)
 {
     if (!config::get("fleet_battles_mod_cache")) {
         return;
     }
     $battleIdsToUpdateWithCurrentStats = array();
     include_once "include/class.battles.php";
     $affectedBattles = array();
     foreach ($systemIds as $systemId) {
         $affectedBattles = array_merge($affectedBattles, Battle::getBattlesInTimeframe($systemId, $timestampStart, $timestampEnd));
     }
     foreach ($affectedBattles as $battle) {
         //                echo "<pre>";
         //                    var_dump($timestampStart);
         //                    var_dump($timestampEnd);
         //                    var_dump($battle["start"]);
         //                    var_dump($battle["end"]);
         //                    echo "</pre>";
         // battle is in exactly the same time interval as the current displayed one -> can update with stats of current battle
         if ($timestampStart == $battle["start"] && $timestampEnd == $battle["end"]) {
             $this->statusMessages[] = "Stats for a cached Battle have been updated.";
             $battleIdsToUpdateWithCurrentStats[] = $battle["battle_id"];
         } else {
             $this->statusMessages[] = "deleting battle {$battle["battle_id"]}";
             $this->statusMessages[] = "Changes partially affect stats of a cached battle. The cache for this battle has been deleted. Please build your cache or wait for cronjob execution. </br>";
             Battle::deleteBattleFromCache($battle["battle_id"]);
         }
     }
     $this->battlesToUpdate = $battleIdsToUpdateWithCurrentStats;
 }