|
@@ 1009-1027 (lines=19) @@
|
| 1006 |
|
$this->addStat('owner_byyear',$this->getStatsOwnerTotal(),$previous_year.'-01-01 00:00:00'); |
| 1007 |
|
$this->addStat('pilot_byyear',$this->getStatsPilotTotal(),$previous_year.'-01-01 00:00:00'); |
| 1008 |
|
|
| 1009 |
|
if (isset($globalArchiveYear) && $globalArchiveYear) { |
| 1010 |
|
if ($globalArchive) { |
| 1011 |
|
$query = "INSERT INTO spotter_archive_output SELECT * FROM spotter_output WHERE spotter_output.date < '".date('Y')."-01-01 00:00:00'"; |
| 1012 |
|
//echo $query; |
| 1013 |
|
try { |
| 1014 |
|
$sth = $this->db->prepare($query); |
| 1015 |
|
$sth->execute(); |
| 1016 |
|
} catch(PDOException $e) { |
| 1017 |
|
return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 1018 |
|
} |
| 1019 |
|
} |
| 1020 |
|
$query = "DELETE FROM spotter_output WHERE spotter_output.date < '".date('Y')."-01-01 00:00:00'"; |
| 1021 |
|
try { |
| 1022 |
|
$sth = $this->db->prepare($query); |
| 1023 |
|
$sth->execute(); |
| 1024 |
|
} catch(PDOException $e) { |
| 1025 |
|
return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 1026 |
|
} |
| 1027 |
|
} |
| 1028 |
|
} |
| 1029 |
|
if (!isset($globalArchiveMonths) || $globalArchiveMonths == '') $globalArchiveMonths = 2; |
| 1030 |
|
if ($globalArchiveMonths > 0) { |
|
@@ 1339-1357 (lines=19) @@
|
| 1336 |
|
$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
| 1337 |
|
$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
| 1338 |
|
|
| 1339 |
|
if (isset($globalArchiveYear) && $globalArchiveYear) { |
| 1340 |
|
if ($globalArchive) { |
| 1341 |
|
$query = "INSERT INTO spotter_archive_output SELECT * FROM spotter_output WHERE spotter_output.date < '".date('Y')."-01-01 00:00:00'"; |
| 1342 |
|
try { |
| 1343 |
|
$sth = $this->db->prepare($query); |
| 1344 |
|
$sth->execute(); |
| 1345 |
|
} catch(PDOException $e) { |
| 1346 |
|
return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 1347 |
|
} |
| 1348 |
|
} |
| 1349 |
|
echo 'Delete old data'."\n"; |
| 1350 |
|
$query = "DELETE FROM spotter_output WHERE spotter_output.date < '".date('Y')."-01-01 00:00:00'"; |
| 1351 |
|
try { |
| 1352 |
|
$sth = $this->db->prepare($query); |
| 1353 |
|
$sth->execute(); |
| 1354 |
|
} catch(PDOException $e) { |
| 1355 |
|
return "error : ".$e->getMessage().' - query : '.$query."\n"; |
| 1356 |
|
} |
| 1357 |
|
} |
| 1358 |
|
} |
| 1359 |
|
if ($globalArchiveMonths > 0) { |
| 1360 |
|
if ($globalArchive) { |