Code Duplication    Length = 16-17 lines in 2 locations

require/class.ACARS.php 1 location

@@ 68-84 (lines=17) @@
65
	* @return String success or false
66
	*
67
	*/
68
	public function deleteArchiveAcarsData()
69
	{
70
		global $globalACARSArchiveKeepMonths, $globalDBdriver;
71
		if ($globalDBdriver == 'mysql') {
72
			$query  = "DELETE FROM acars_archive WHERE acars_archive.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalACARSArchiveKeepMonths." MONTH)";
73
		} else {
74
			$query  = "DELETE FROM acars_archive WHERE acars_archive.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalACARSArchiveKeepMonths." MONTHS'";
75
		}
76
		try {
77
78
			$sth = $this->db->prepare($query);
79
			$sth->execute();
80
		} catch(PDOException $e) {
81
			return "error";
82
		}
83
		return "success";
84
	}
85
86
87
	/**

require/class.SpotterArchive.php 1 location

@@ 783-798 (lines=16) @@
780
	return $spotter_array;
781
    }
782
783
    public function deleteSpotterArchiveData()
784
    {
785
		global $globalArchiveKeepMonths, $globalDBdriver;
786
                date_default_timezone_set('UTC');
787
                if ($globalDBdriver == 'mysql') {
788
			$query = 'DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
789
		} else {
790
			$query = "DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
791
		}
792
                try {
793
                        $sth = $this->db->prepare($query);
794
                        $sth->execute();
795
                } catch(PDOException $e) {
796
                        return "error";
797
                }
798
	}
799
800
    /**
801
    * Gets all the spotter information based on the callsign