diff --git a/application/controllers/Satellite.php b/application/controllers/Satellite.php index a8454045e..129669559 100644 --- a/application/controllers/Satellite.php +++ b/application/controllers/Satellite.php @@ -431,6 +431,9 @@ class Satellite extends CI_Controller { $filtered=[]; foreach ($sat_tles as $sat_tle) { + if ($sat_tle->tle == null) { + continue; + } try { $temp = preg_split('/\n/', $sat_tle->tle); diff --git a/application/libraries/Curl.php b/application/libraries/Curl.php index 35a755242..9ff8dfd5d 100644 --- a/application/libraries/Curl.php +++ b/application/libraries/Curl.php @@ -100,7 +100,6 @@ class Curl { // Add the filepath $url .= $file_path; - $this->option(CURLOPT_BINARYTRANSFER, TRUE); $this->option(CURLOPT_VERBOSE, TRUE); return $this->execute(); diff --git a/application/models/Satellite_model.php b/application/models/Satellite_model.php index 527fd700b..46a7d0784 100644 --- a/application/models/Satellite_model.php +++ b/application/models/Satellite_model.php @@ -3,7 +3,7 @@ class Satellite_model extends CI_Model { function get_all_satellites() { - $sql = "select satellite.id, satellite.name as satname, group_concat(distinct satellitemode.name separator ', ') as modename, satellite.displayname, satellite.orbit, satellite.lotw as lotw, tle.updated + $sql = "select satellite.id, satellite.name as satname, group_concat(distinct satellitemode.name separator ', ') as modename, satellite.displayname, satellite.orbit, satellite.lotw as lotw, tle.updated, tle.tle from satellite left outer join satellitemode on satellite.id = satellitemode.satelliteid left outer join tle on satellite.id = tle.satelliteid @@ -31,6 +31,7 @@ class Satellite_model extends CI_Model { $sql = "select satellite.id, satellite.name as satname, satellite.displayname as displayname, tle.tle from satellite join tle on satellite.id = tle.satelliteid + where tle is not NULL order by satellite.name "; diff --git a/application/models/Update_model.php b/application/models/Update_model.php index 1ba2016f4..be088d5e4 100644 --- a/application/models/Update_model.php +++ b/application/models/Update_model.php @@ -370,6 +370,11 @@ class Update_model extends CI_Model { $starttime = $mtime; $this->update_norad_ids(); + + // Clear all TLE so that reentered birds disappear from planner and path prediction + $sql = "UPDATE `tle` SET `tle` = NULL WHERE 1;"; + $this->db->query($sql); + $url = 'https://www.amsat.org/tle/dailytle.txt'; $curl = curl_init($url); @@ -428,7 +433,6 @@ class Update_model extends CI_Model { curl_setopt($curl, CURLOPT_FAILONERROR, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($curl, CURLOPT_BINARYTRANSFER,true); curl_setopt($curl, CURLOPT_TIMEOUT, 10); $response = curl_exec($curl); diff --git a/application/views/satellite/index.php b/application/views/satellite/index.php index 993c45e31..4167a7c7f 100644 --- a/application/views/satellite/index.php +++ b/application/views/satellite/index.php @@ -97,7 +97,7 @@ echo ''; ?> '; - if ($sat->updated != null) { + if ($sat->tle != null) { echo ''; } else { echo '';