From 821ff3b8f60e5f4d648ac9efdbae26c95c0a741b Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Fri, 21 Dec 2018 14:53:49 +0000 Subject: [PATCH] rolled back change as it broke other stuff --- application/controllers/Update.php | 62 +++++++----------------------- 1 file changed, 14 insertions(+), 48 deletions(-) diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 545ed667..e24f10ff 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -31,22 +31,11 @@ class Update extends CI_Controller { $count = 0; foreach ($xml_data->entities->entity as $entity) { - - if(isset($record->start)) { - $startinfo = strtotime($record->start); - $start_date = ($startinfo) ? date('Y-m-d H:i:s',$startinfo) : ""; - } else { - $start_date = NULL; - } - - if (isset($record->end)) { - $endinfo = strtotime($record->end); - $end_date = ($endinfo) ? date('Y-m-d H:i:s',$endinfo) : ""; - } else { - $end_date = NULL; - } - + $startinfo = strtotime($record->start); + $endinfo = strtotime($record->end); + $start_date = ($startinfo) ? date('Y-m-d H:i:s',$startinfo) : ""; + $end_date = ($endinfo) ? date('Y-m-d H:i:s',$endinfo) : ""; if(!$entity->cqz) { $data = array( @@ -88,19 +77,11 @@ class Update extends CI_Controller { $count = 0; foreach ($xml_data->exceptions->exception as $record) { - if(isset($record->start)) { - $startinfo = strtotime($record->start); - $start_date = date('Y-m-d H:i:s',$startinfo); - } else { - $start_date = NULL; - } - - if (isset($record->end)) { - $endinfo = strtotime($record->end); - $end_date = date('Y-m-d H:i:s',$endinfo); - } else { - $end_date = NULL; - } + $startinfo = strtotime($record->start); + $endinfo = strtotime($record->end); + + $start_date = ($startinfo) ? date('Y-m-d H:i:s',$startinfo) : ""; + $end_date = ($endinfo) ? date('Y-m-d H:i:s',$endinfo) : ""; $data = array( 'record' => (int) $record->attributes()->record, @@ -116,7 +97,6 @@ class Update extends CI_Controller { ); $this->db->insert('dxcc_exceptions', $data); - $count += 1; if ($count % 10 == 0) $this->update_status(); @@ -137,20 +117,11 @@ class Update extends CI_Controller { $count = 0; foreach ($xml_data->prefixes->prefix as $record) { - if(isset($record->start)) { - $startinfo = strtotime($record->start); - $start_date = date('Y-m-d H:i:s',$startinfo); - } else { - $start_date = NULL; - } - - if (isset($record->end)) { - $endinfo = strtotime($record->end); - $end_date = date('Y-m-d H:i:s',$endinfo); - } else { - $end_date = NULL; - } - + $startinfo = strtotime($record->start); + $endinfo = strtotime($record->end); + + $start_date = ($startinfo) ? date('Y-m-d H:i:s',$startinfo) : ""; + $end_date = ($endinfo) ? date('Y-m-d H:i:s',$endinfo) : ""; $data = array( 'record' => (int) $record->attributes()->record, @@ -198,11 +169,6 @@ class Update extends CI_Controller { } gzclose($gz); - if (!file_exists("./updates/")) - { - mkdir("./updates"); - } - file_put_contents('./updates/cty.xml', $data); // Clear the tables, ready for new data