|
@@ -7,16 +7,16 @@ discard block |
|
|
block discarded – undo |
|
7
|
7
|
require_once(dirname(__FILE__).'/class.Source.php'); |
|
8
|
8
|
|
|
9
|
9
|
class TrackerImport { |
|
10
|
|
- private $all_tracked = array(); |
|
11
|
|
- private $last_delete_hourly = 0; |
|
12
|
|
- private $last_delete = 0; |
|
13
|
|
- private $stats = array(); |
|
14
|
|
- private $tmd = 0; |
|
15
|
|
- private $source_location = array(); |
|
16
|
|
- public $db = null; |
|
17
|
|
- public $nb = 0; |
|
|
10
|
+ private $all_tracked = array(); |
|
|
11
|
+ private $last_delete_hourly = 0; |
|
|
12
|
+ private $last_delete = 0; |
|
|
13
|
+ private $stats = array(); |
|
|
14
|
+ private $tmd = 0; |
|
|
15
|
+ private $source_location = array(); |
|
|
16
|
+ public $db = null; |
|
|
17
|
+ public $nb = 0; |
|
18
|
18
|
|
|
19
|
|
- public function __construct($dbc = null) { |
|
|
19
|
+ public function __construct($dbc = null) { |
|
20
|
20
|
global $globalBeta; |
|
21
|
21
|
$Connection = new Connection($dbc); |
|
22
|
22
|
$this->db = $Connection->db(); |
|
@@ -38,50 +38,50 @@ discard block |
|
|
block discarded – undo |
|
38
|
38
|
} |
|
39
|
39
|
} |
|
40
|
40
|
*/ |
|
41
|
|
- } |
|
|
41
|
+ } |
|
42
|
42
|
|
|
43
|
|
- public function checkAll() { |
|
|
43
|
+ public function checkAll() { |
|
44
|
44
|
global $globalDebug; |
|
45
|
45
|
if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
46
|
46
|
foreach ($this->all_tracked as $key => $flight) { |
|
47
|
|
- if (isset($this->all_tracked[$key]['id'])) { |
|
|
47
|
+ if (isset($this->all_tracked[$key]['id'])) { |
|
48
|
48
|
//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
49
|
|
- $Tracker = new Tracker($this->db); |
|
50
|
|
- $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
51
|
|
- } |
|
|
49
|
+ $Tracker = new Tracker($this->db); |
|
|
50
|
+ $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
|
51
|
+ } |
|
|
52
|
+ } |
|
52
|
53
|
} |
|
53
|
|
- } |
|
54
|
54
|
|
|
55
|
|
- public function del() { |
|
|
55
|
+ public function del() { |
|
56
|
56
|
global $globalDebug; |
|
57
|
57
|
// Delete old infos |
|
58
|
58
|
if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
59
|
59
|
foreach ($this->all_tracked as $key => $flight) { |
|
60
|
|
- if (isset($flight['lastupdate'])) { |
|
61
|
|
- if ($flight['lastupdate'] < (time()-3000)) { |
|
62
|
|
- if (isset($this->all_tracked[$key]['id'])) { |
|
63
|
|
- if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
|
60
|
+ if (isset($flight['lastupdate'])) { |
|
|
61
|
+ if ($flight['lastupdate'] < (time()-3000)) { |
|
|
62
|
+ if (isset($this->all_tracked[$key]['id'])) { |
|
|
63
|
+ if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
64
|
64
|
/* |
|
65
|
65
|
$TrackerLive = new TrackerLive(); |
|
66
|
66
|
$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
|
67
|
67
|
$TrackerLive->db = null; |
|
68
|
68
|
*/ |
|
69
|
|
- //$real_arrival = $this->arrival($key); |
|
70
|
|
- $Tracker = new Tracker($this->db); |
|
71
|
|
- if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
|
69
|
+ //$real_arrival = $this->arrival($key); |
|
|
70
|
+ $Tracker = new Tracker($this->db); |
|
|
71
|
+ if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
72
|
72
|
$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
|
73
|
73
|
if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
74
|
74
|
} |
|
75
|
75
|
// Put in archive |
|
76
|
76
|
// $Tracker->db = null; |
|
77
|
|
- } |
|
78
|
|
- unset($this->all_tracked[$key]); |
|
79
|
|
- } |
|
80
|
|
- } |
|
81
|
|
- } |
|
82
|
|
- } |
|
|
77
|
+ } |
|
|
78
|
+ unset($this->all_tracked[$key]); |
|
|
79
|
+ } |
|
|
80
|
+ } |
|
|
81
|
+ } |
|
|
82
|
+ } |
|
83
|
83
|
|
|
84
|
|
- public function add($line) { |
|
|
84
|
+ public function add($line) { |
|
85
|
85
|
global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
|
86
|
86
|
if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
87
|
87
|
date_default_timezone_set('UTC'); |
|
@@ -90,47 +90,47 @@ discard block |
|
|
block discarded – undo |
|
90
|
90
|
|
|
91
|
91
|
// SBS format is CSV format |
|
92
|
92
|
if(is_array($line) && isset($line['ident'])) { |
|
93
|
|
- //print_r($line); |
|
94
|
|
- if (isset($line['ident'])) { |
|
|
93
|
+ //print_r($line); |
|
|
94
|
+ if (isset($line['ident'])) { |
|
95
|
95
|
|
|
96
|
96
|
|
|
97
|
97
|
// Increment message number |
|
98
|
98
|
if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
|
99
|
|
- $current_date = date('Y-m-d'); |
|
100
|
|
- if (isset($line['source_name'])) $source = $line['source_name']; |
|
101
|
|
- else $source = ''; |
|
102
|
|
- if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
103
|
|
- if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104
|
|
- $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105
|
|
- $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106
|
|
- } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
|
99
|
+ $current_date = date('Y-m-d'); |
|
|
100
|
+ if (isset($line['source_name'])) $source = $line['source_name']; |
|
|
101
|
+ else $source = ''; |
|
|
102
|
+ if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
|
103
|
+ if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
|
104
|
+ $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
|
105
|
+ $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
|
106
|
+ } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
107
|
107
|
} |
|
108
|
108
|
|
|
109
|
109
|
|
|
110
|
110
|
$Common = new Common(); |
|
111
|
|
- if (!isset($line['id'])) $id = trim($line['ident']); |
|
112
|
|
- else $id = trim($line['id']); |
|
|
111
|
+ if (!isset($line['id'])) $id = trim($line['ident']); |
|
|
112
|
+ else $id = trim($line['id']); |
|
113
|
113
|
|
|
114
|
114
|
if (!isset($this->all_tracked[$id])) { |
|
115
|
|
- $this->all_tracked[$id] = array(); |
|
116
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
119
|
|
- if (!isset($line['id'])) { |
|
|
115
|
+ $this->all_tracked[$id] = array(); |
|
|
116
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
|
117
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
|
118
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
|
119
|
+ if (!isset($line['id'])) { |
|
120
|
120
|
if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
121
|
121
|
$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
122
|
|
- } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123
|
|
- if ($globalAllTracked !== FALSE) $dataFound = true; |
|
|
122
|
+ } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
|
123
|
+ if ($globalAllTracked !== FALSE) $dataFound = true; |
|
124
|
124
|
} |
|
125
|
125
|
|
|
126
|
126
|
if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
127
|
|
- if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
|
127
|
+ if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
128
|
128
|
$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
129
|
|
- } else { |
|
|
129
|
+ } else { |
|
130
|
130
|
if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
131
|
131
|
elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
|
132
|
132
|
return ''; |
|
133
|
|
- } |
|
|
133
|
+ } |
|
134
|
134
|
} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
135
|
135
|
if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!"; |
|
136
|
136
|
return ''; |
|
@@ -147,38 +147,38 @@ discard block |
|
|
block discarded – undo |
|
147
|
147
|
|
|
148
|
148
|
//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
|
149
|
149
|
if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
|
150
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151
|
|
- if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
|
150
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
|
151
|
+ if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
152
|
152
|
$timeelapsed = microtime(true); |
|
153
|
|
- $Tracker = new Tracker($this->db); |
|
154
|
|
- $fromsource = NULL; |
|
155
|
|
- $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
|
153
|
+ $Tracker = new Tracker($this->db); |
|
|
154
|
+ $fromsource = NULL; |
|
|
155
|
+ $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
156
|
156
|
if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
157
|
157
|
$Tracker->db = null; |
|
158
|
158
|
if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
159
|
|
- } |
|
160
|
|
- if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
|
159
|
+ } |
|
|
160
|
+ if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
161
|
161
|
} |
|
162
|
162
|
|
|
163
|
163
|
if (isset($line['speed']) && $line['speed'] != '') { |
|
164
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
|
164
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
|
165
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
166
|
166
|
} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
|
167
|
|
- $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
168
|
|
- if ($distance > 100 && $distance < 10000) { |
|
|
167
|
+ $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
|
168
|
+ if ($distance > 100 && $distance < 10000) { |
|
169
|
169
|
$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
|
170
|
170
|
$speed = $speed*3.6; |
|
171
|
171
|
if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
172
|
172
|
if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
|
173
|
|
- } |
|
|
173
|
+ } |
|
174
|
174
|
} |
|
175
|
175
|
|
|
176
|
|
- if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
177
|
|
- if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178
|
|
- else unset($timediff); |
|
179
|
|
- if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
|
176
|
+ if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
|
177
|
+ if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
|
178
|
+ else unset($timediff); |
|
|
179
|
+ if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
180
|
180
|
if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
|
181
|
|
- if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
|
181
|
+ if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
182
|
182
|
$this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
183
|
183
|
$this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
184
|
184
|
$this->all_tracked[$id]['putinarchive'] = true; |
|
@@ -192,160 +192,160 @@ discard block |
|
|
block discarded – undo |
|
192
|
192
|
if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
193
|
193
|
$this->tmd = 0; |
|
194
|
194
|
if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
195
|
|
- } |
|
|
195
|
+ } |
|
196
|
196
|
} |
|
197
|
197
|
|
|
198
|
198
|
if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
|
199
|
199
|
if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
200
|
200
|
if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
201
|
|
- $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202
|
|
- $dataFound = true; |
|
203
|
|
- $this->all_tracked[$id]['time_last_coord'] = time(); |
|
|
201
|
+ $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
|
202
|
+ $dataFound = true; |
|
|
203
|
+ $this->all_tracked[$id]['time_last_coord'] = time(); |
|
204
|
204
|
} |
|
205
|
205
|
$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
206
|
206
|
} |
|
207
|
207
|
if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
|
208
|
|
- if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
|
208
|
+ if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
209
|
209
|
if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
210
|
210
|
if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
211
|
|
- $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212
|
|
- $dataFound = true; |
|
213
|
|
- $this->all_tracked[$id]['time_last_coord'] = time(); |
|
|
211
|
+ $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
|
212
|
+ $dataFound = true; |
|
|
213
|
+ $this->all_tracked[$id]['time_last_coord'] = time(); |
|
214
|
214
|
} |
|
215
|
215
|
$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
216
|
216
|
} |
|
217
|
217
|
|
|
218
|
|
- } else if ($globalDebug && $timediff > 20) { |
|
|
218
|
+ } else if ($globalDebug && $timediff > 20) { |
|
219
|
219
|
$this->tmd = $this->tmd + 1; |
|
220
|
220
|
echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
|
221
|
221
|
echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
222
|
222
|
echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
223
|
223
|
echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
|
224
|
|
- } |
|
|
224
|
+ } |
|
225
|
225
|
} |
|
226
|
226
|
if (isset($line['last_update']) && $line['last_update'] != '') { |
|
227
|
|
- if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
228
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
|
227
|
+ if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
|
228
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
229
|
229
|
} |
|
230
|
230
|
if (isset($line['format_source']) && $line['format_source'] != '') { |
|
231
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
|
231
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
232
|
232
|
} |
|
233
|
233
|
if (isset($line['source_name']) && $line['source_name'] != '') { |
|
234
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
|
234
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
235
|
235
|
} |
|
236
|
236
|
if (isset($line['comment']) && $line['comment'] != '') { |
|
237
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
238
|
|
- //$dataFound = true; |
|
|
237
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
|
238
|
+ //$dataFound = true; |
|
239
|
239
|
} |
|
240
|
240
|
if (isset($line['type']) && $line['type'] != '') { |
|
241
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
242
|
|
- //$dataFound = true; |
|
|
241
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
|
242
|
+ //$dataFound = true; |
|
243
|
243
|
} |
|
244
|
244
|
|
|
245
|
245
|
if (isset($line['altitude']) && $line['altitude'] != '') { |
|
246
|
|
- //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
|
246
|
+ //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
247
|
247
|
if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
248
|
248
|
$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100))); |
|
249
|
249
|
$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
250
|
250
|
//$dataFound = true; |
|
251
|
|
- //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
|
251
|
+ //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
252
|
252
|
} |
|
253
|
253
|
|
|
254
|
254
|
if (isset($line['noarchive']) && $line['noarchive'] === true) { |
|
255
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
|
255
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
256
|
256
|
} |
|
257
|
257
|
|
|
258
|
258
|
if (isset($line['heading']) && $line['heading'] != '') { |
|
259
|
|
- if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
260
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
261
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
262
|
|
- //$dataFound = true; |
|
|
259
|
+ if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
|
260
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
|
261
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
|
262
|
+ //$dataFound = true; |
|
263
|
263
|
} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
|
264
|
|
- $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
265
|
|
- $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
266
|
|
- if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
267
|
|
- if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
|
264
|
+ $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
|
265
|
+ $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
|
266
|
+ if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
|
267
|
+ if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
268
|
268
|
} |
|
269
|
269
|
//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
270
|
270
|
|
|
271
|
271
|
if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
|
272
|
|
- $this->all_tracked[$id]['lastupdate'] = time(); |
|
273
|
|
- if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
274
|
|
- if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
275
|
|
- if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
|
272
|
+ $this->all_tracked[$id]['lastupdate'] = time(); |
|
|
273
|
+ if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
|
274
|
+ if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
|
275
|
+ if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
276
|
276
|
if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
277
|
277
|
$timeelapsed = microtime(true); |
|
278
|
278
|
$TrackerLive = new TrackerLive($this->db); |
|
279
|
279
|
if (isset($line['id'])) { |
|
280
|
|
- $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
281
|
|
- if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
|
280
|
+ $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
|
281
|
+ if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
282
|
282
|
} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
283
|
|
- $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
284
|
|
- if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
|
283
|
+ $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
|
284
|
+ if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
285
|
285
|
} else $recent_ident = ''; |
|
286
|
286
|
$TrackerLive->db=null; |
|
287
|
287
|
|
|
288
|
288
|
if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
289
|
289
|
elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
290
|
|
- } else { |
|
|
290
|
+ } else { |
|
291
|
291
|
$recent_ident = ''; |
|
292
|
292
|
$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
293
|
|
- } |
|
294
|
|
- //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
295
|
|
- if($recent_ident == "") |
|
296
|
|
- { |
|
|
293
|
+ } |
|
|
294
|
+ //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
|
295
|
+ if($recent_ident == "") |
|
|
296
|
+ { |
|
297
|
297
|
if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
298
|
298
|
//adds the spotter data for the archive |
|
299
|
|
- $highlight = ''; |
|
300
|
|
- if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
301
|
|
- $timeelapsed = microtime(true); |
|
302
|
|
- $Tracker = new Tracker($this->db); |
|
303
|
|
- $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
304
|
|
- $Tracker->db = null; |
|
305
|
|
- if ($globalDebug && isset($result)) echo $result."\n"; |
|
306
|
|
- if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
|
299
|
+ $highlight = ''; |
|
|
300
|
+ if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
|
301
|
+ $timeelapsed = microtime(true); |
|
|
302
|
+ $Tracker = new Tracker($this->db); |
|
|
303
|
+ $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
|
304
|
+ $Tracker->db = null; |
|
|
305
|
+ if ($globalDebug && isset($result)) echo $result."\n"; |
|
|
306
|
+ if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
307
|
307
|
|
|
308
|
308
|
|
|
309
|
|
- // Add source stat in DB |
|
310
|
|
- $Stats = new Stats($this->db); |
|
311
|
|
- if (!empty($this->stats)) { |
|
|
309
|
+ // Add source stat in DB |
|
|
310
|
+ $Stats = new Stats($this->db); |
|
|
311
|
+ if (!empty($this->stats)) { |
|
312
|
312
|
if ($globalDebug) echo 'Add source stats : '; |
|
313
|
|
- foreach($this->stats as $date => $data) { |
|
314
|
|
- foreach($data as $source => $sourced) { |
|
315
|
|
- //print_r($sourced); |
|
316
|
|
- if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
317
|
|
- if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
318
|
|
- if (isset($sourced['msg'])) { |
|
319
|
|
- if (time() - $sourced['msg']['date'] > 10) { |
|
320
|
|
- $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
321
|
|
- echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
322
|
|
- unset($this->stats[$date][$source]['msg']); |
|
323
|
|
- } |
|
324
|
|
- } |
|
325
|
|
- } |
|
326
|
|
- if ($date != date('Y-m-d')) { |
|
327
|
|
- unset($this->stats[$date]); |
|
328
|
|
- } |
|
329
|
|
- } |
|
330
|
|
- if ($globalDebug) echo 'Done'."\n"; |
|
|
313
|
+ foreach($this->stats as $date => $data) { |
|
|
314
|
+ foreach($data as $source => $sourced) { |
|
|
315
|
+ //print_r($sourced); |
|
|
316
|
+ if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
|
317
|
+ if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
|
318
|
+ if (isset($sourced['msg'])) { |
|
|
319
|
+ if (time() - $sourced['msg']['date'] > 10) { |
|
|
320
|
+ $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
|
321
|
+ echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
|
322
|
+ unset($this->stats[$date][$source]['msg']); |
|
|
323
|
+ } |
|
|
324
|
+ } |
|
|
325
|
+ } |
|
|
326
|
+ if ($date != date('Y-m-d')) { |
|
|
327
|
+ unset($this->stats[$date]); |
|
|
328
|
+ } |
|
|
329
|
+ } |
|
|
330
|
+ if ($globalDebug) echo 'Done'."\n"; |
|
331
|
331
|
|
|
332
|
|
- } |
|
333
|
|
- $Stats->db = null; |
|
|
332
|
+ } |
|
|
333
|
+ $Stats->db = null; |
|
334
|
334
|
|
|
335
|
|
- $this->del(); |
|
|
335
|
+ $this->del(); |
|
336
|
336
|
//$ignoreImport = false; |
|
337
|
337
|
$this->all_tracked[$id]['addedTracker'] = 1; |
|
338
|
338
|
//print_r($this->all_tracked[$id]); |
|
339
|
339
|
if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
|
340
|
|
- if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
341
|
|
- //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
342
|
|
- $TrackerLive = new TrackerLive($this->db); |
|
343
|
|
- $TrackerLive->deleteLiveTrackerData(); |
|
344
|
|
- $TrackerLive->db=null; |
|
345
|
|
- if ($globalDebug) echo " Done\n"; |
|
346
|
|
- $this->last_delete = time(); |
|
|
340
|
+ if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
|
341
|
+ //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
|
342
|
+ $TrackerLive = new TrackerLive($this->db); |
|
|
343
|
+ $TrackerLive->deleteLiveTrackerData(); |
|
|
344
|
+ $TrackerLive->db=null; |
|
|
345
|
+ if ($globalDebug) echo " Done\n"; |
|
|
346
|
+ $this->last_delete = time(); |
|
347
|
347
|
} |
|
348
|
|
- } else { |
|
|
348
|
+ } else { |
|
349
|
349
|
$this->all_tracked[$id]['id'] = $recent_ident; |
|
350
|
350
|
$this->all_tracked[$id]['addedTracker'] = 1; |
|
351
|
351
|
if (isset($globalDaemon) && !$globalDaemon) { |
|
@@ -354,16 +354,16 @@ discard block |
|
|
block discarded – undo |
|
354
|
354
|
$Tracker->db = null; |
|
355
|
355
|
} |
|
356
|
356
|
|
|
357
|
|
- } |
|
|
357
|
+ } |
|
358
|
358
|
} |
|
359
|
|
- } |
|
360
|
|
- //adds the spotter LIVE data |
|
361
|
|
- if ($globalDebug) { |
|
|
359
|
+ } |
|
|
360
|
+ //adds the spotter LIVE data |
|
|
361
|
+ if ($globalDebug) { |
|
362
|
362
|
echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
|
363
|
|
- } |
|
364
|
|
- $ignoreImport = false; |
|
|
363
|
+ } |
|
|
364
|
+ $ignoreImport = false; |
|
365
|
365
|
|
|
366
|
|
- if (!$ignoreImport) { |
|
|
366
|
+ if (!$ignoreImport) { |
|
367
|
367
|
if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
368
|
368
|
if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
369
|
369
|
$timeelapsed = microtime(true); |
|
@@ -401,7 +401,7 @@ discard block |
|
|
block discarded – undo |
|
401
|
401
|
if ($stats_heading == 16) $stats_heading = 0; |
|
402
|
402
|
if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
|
403
|
403
|
for ($i=0;$i<=15;$i++) { |
|
404
|
|
- $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
|
404
|
+ $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
405
|
405
|
} |
|
406
|
406
|
$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
|
407
|
407
|
} else { |
|
@@ -414,11 +414,11 @@ discard block |
|
|
block discarded – undo |
|
414
|
414
|
//var_dump($this->stats); |
|
415
|
415
|
if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
|
416
|
416
|
if (isset($this->stats[$current_date][$source]['hist'][0])) { |
|
417
|
|
- end($this->stats[$current_date][$source]['hist']); |
|
418
|
|
- $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
|
417
|
+ end($this->stats[$current_date][$source]['hist']); |
|
|
418
|
+ $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
419
|
419
|
} else $mini = 0; |
|
420
|
420
|
for ($i=$mini;$i<=$distance;$i+=10) { |
|
421
|
|
- $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
|
421
|
+ $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
422
|
422
|
} |
|
423
|
423
|
$this->stats[$current_date][$source]['hist'][$distance] = 1; |
|
424
|
424
|
} else { |
|
@@ -434,22 +434,22 @@ discard block |
|
|
block discarded – undo |
|
434
|
434
|
|
|
435
|
435
|
|
|
436
|
436
|
if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
|
437
|
|
- if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
438
|
|
- $TrackerLive = new TrackerLive($this->db); |
|
439
|
|
- $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
440
|
|
- $TrackerLive->db = null; |
|
441
|
|
- //TrackerLive->deleteLiveTrackerData(); |
|
442
|
|
- if ($globalDebug) echo " Done\n"; |
|
443
|
|
- $this->last_delete_hourly = time(); |
|
|
437
|
+ if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
|
438
|
+ $TrackerLive = new TrackerLive($this->db); |
|
|
439
|
+ $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
|
440
|
+ $TrackerLive->db = null; |
|
|
441
|
+ //TrackerLive->deleteLiveTrackerData(); |
|
|
442
|
+ if ($globalDebug) echo " Done\n"; |
|
|
443
|
+ $this->last_delete_hourly = time(); |
|
444
|
444
|
} |
|
445
|
445
|
|
|
446
|
|
- } |
|
447
|
|
- //$ignoreImport = false; |
|
|
446
|
+ } |
|
|
447
|
+ //$ignoreImport = false; |
|
448
|
448
|
} |
|
449
|
449
|
//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
|
450
|
450
|
if ($send) return $this->all_tracked[$id]; |
|
451
|
|
- } |
|
|
451
|
+ } |
|
|
452
|
+ } |
|
452
|
453
|
} |
|
453
|
|
- } |
|
454
|
454
|
} |
|
455
|
455
|
?> |