diff --git a/includes/classes/cronjob/CleanerCronjob.class.php b/includes/classes/cronjob/CleanerCronjob.class.php index ffa132bf6..52314be45 100644 --- a/includes/classes/cronjob/CleanerCronjob.class.php +++ b/includes/classes/cronjob/CleanerCronjob.class.php @@ -57,6 +57,11 @@ function run() $sql = 'DELETE FROM %%FLEETS_EVENT%% WHERE fleetID NOT IN (SELECT fleet_id FROM %%FLEETS%%);'; Database::get()->delete($sql); + $sql = 'DELETE FROM %%LOG_FLEETS%% WHERE `start_time` < :time;'; + Database::get()->delete($sql, array( + ':time' => $del_before + )); + $sql = 'UPDATE %%USERS%% SET `email_2` = `email` WHERE `setmail` < :time;'; Database::get()->update($sql, array( ':time' => TIMESTAMP @@ -79,27 +84,28 @@ function run() } } - foreach($unis as $uni) - { - $sql = 'SELECT units FROM %%TOPKB%% WHERE `universe` = :universe ORDER BY units DESC LIMIT 99,1;'; - - $battleHallLowest = Database::get()->selectSingle($sql, array( - ':universe' => $uni - ),'units'); - - if(!is_null($battleHallLowest)) - { - $sql = 'DELETE %%TOPKB%%, %%TOPKB_USERS%% - FROM %%TOPKB%% - INNER JOIN %%TOPKB_USERS%% USING (rid) - WHERE `universe` = :universe AND `units` < :battleHallLowest;'; - - Database::get()->delete($sql, array( - ':universe' => $uni, - ':battleHallLowest' => $battleHallLowest - )); - } - } + // do not delete hall of fame + // foreach($unis as $uni) + // { + // $sql = 'SELECT units FROM %%TOPKB%% WHERE `universe` = :universe ORDER BY units DESC LIMIT 99,1;'; + + // $battleHallLowest = Database::get()->selectSingle($sql, array( + // ':universe' => $uni + // ),'units'); + + // if(!is_null($battleHallLowest)) + // { + // $sql = 'DELETE %%TOPKB%%, %%TOPKB_USERS%% + // FROM %%TOPKB%% + // INNER JOIN %%TOPKB_USERS%% USING (rid) + // WHERE `universe` = :universe AND `units` < :battleHallLowest;'; + + // Database::get()->delete($sql, array( + // ':universe' => $uni, + // ':battleHallLowest' => $battleHallLowest + // )); + // } + // } // do not delete combat reports // $sql = 'DELETE FROM %%RW%% WHERE `time` < :time AND `rid` NOT IN (SELECT `rid` FROM %%TOPKB%%);'; diff --git a/includes/classes/missions/MissionCaseAttack.class.php b/includes/classes/missions/MissionCaseAttack.class.php index 032bac8cf..0d586d690 100644 --- a/includes/classes/missions/MissionCaseAttack.class.php +++ b/includes/classes/missions/MissionCaseAttack.class.php @@ -74,6 +74,15 @@ function TargetEvent() ':planetId' => $this->_fleet['fleet_end_id'] )); + // return fleet if target planet deleted + if($targetPlanet == false) + { + error_log('DEBUG planet does not exist!'); + $this->setState(FLEET_RETURN); + $this->SaveFleet(); + return; + } + $sql = "SELECT * FROM %%USERS%% WHERE id = :userId;"; $targetUser = $db->selectSingle($sql, array( ':userId' => $targetPlanet['id_owner']