Code Duplication    Length = 9-11 lines in 9 locations

require/class.ATC.php 1 location

@@ 52-61 (lines=10) @@
49
                }
50
        }
51
52
       public function deleteAll() {
53
                $query = "DELETE FROM atc";
54
                $query_values = array();
55
                 try {
56
                        $sth = $this->db->prepare($query);
57
                        $sth->execute($query_values);
58
                } catch(PDOException $e) {
59
                        return "error : ".$e->getMessage();
60
                }
61
        }
62
63
	public function deleteOldATC() {
64
                global $globalDBdriver;

require/class.METAR.php 2 locations

@@ 313-321 (lines=9) @@
310
                        return "error : ".$e->getMessage();
311
                }
312
        }
313
       public function deleteAllMETARLocation() {
314
                $query = "DELETE FROM metar";
315
                 try {
316
                        $sth = $this->db->prepare($query);
317
                        $sth->execute();
318
                } catch(PDOException $e) {
319
                        return "error : ".$e->getMessage();
320
                }
321
        }
322
        
323
        public function addMETARCycle() {
324
    		global $globalDebug, $globalIVAO;
@@ 65-75 (lines=11) @@
62
                else return true;
63
        }
64
65
        public static function insert_last_update() {
66
                $query = "DELETE FROM config WHERE name = 'last_update_metar';
67
                        INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());";
68
                try {
69
                        $Connection = new Connection();
70
                        $sth = $Connection->db->prepare($query);
71
                        $sth->execute();
72
                } catch(PDOException $e) {
73
                        return "error : ".$e->getMessage();
74
                }
75
        }
76
77
78
        

require/class.NOTAM.php 1 location

@@ 749-757 (lines=9) @@
746
			return "error : ".$e->getMessage();
747
		}
748
	}
749
	public function deleteAllNOTAMLocation() {
750
		$query = "DELETE FROM notam";
751
		try {
752
			$sth = $this->db->prepare($query);
753
			$sth->execute();
754
		} catch(PDOException $e) {
755
			return "error : ".$e->getMessage();
756
		}
757
	}
758
759
	public function updateNotam() {
760
		global $globalNOTAMAirports;

require/class.Source.php 1 location

@@ 69-77 (lines=9) @@
66
                        return "error : ".$e->getMessage();
67
                }
68
        }
69
       public function deleteAllLocation() {
70
                $query = "DELETE FROM source_location";
71
                 try {
72
                        $sth = $this->db->prepare($query);
73
                        $sth->execute();
74
                } catch(PDOException $e) {
75
                        return "error : ".$e->getMessage();
76
                }
77
        }
78
}
79
?>

install/class.update_db.php 4 locations

@@ 1674-1684 (lines=11) @@
1671
                else return true;
1672
	}
1673
1674
	public static function insert_last_update() {
1675
		$query = "DELETE FROM config WHERE name = 'last_update_db';
1676
			INSERT INTO config (name,value) VALUES ('last_update_db',NOW());";
1677
		try {
1678
			$Connection = new Connection();
1679
			$sth = $Connection->db->prepare($query);
1680
                        $sth->execute();
1681
                } catch(PDOException $e) {
1682
                        return "error : ".$e->getMessage();
1683
                }
1684
	}
1685
1686
	public static function check_last_notam_update() {
1687
		global $globalDBdriver;
@@ 1705-1715 (lines=11) @@
1702
                else return true;
1703
	}
1704
1705
	public static function insert_last_notam_update() {
1706
		$query = "DELETE FROM config WHERE name = 'last_update_notam_db';
1707
			INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
1708
		try {
1709
			$Connection = new Connection();
1710
			$sth = $Connection->db->prepare($query);
1711
                        $sth->execute();
1712
                } catch(PDOException $e) {
1713
                        return "error : ".$e->getMessage();
1714
                }
1715
	}
1716
1717
	public static function check_last_owner_update() {
1718
		global $globalDBdriver;
@@ 1736-1746 (lines=11) @@
1733
                else return true;
1734
	}
1735
1736
	public static function insert_last_owner_update() {
1737
		$query = "DELETE FROM config WHERE name = 'last_update_owner_db';
1738
			INSERT INTO config (name,value) VALUES ('last_update_owner_db',NOW());";
1739
		try {
1740
			$Connection = new Connection();
1741
			$sth = $Connection->db->prepare($query);
1742
                        $sth->execute();
1743
                } catch(PDOException $e) {
1744
                        return "error : ".$e->getMessage();
1745
                }
1746
	}
1747
	public static function check_last_schedules_update() {
1748
		global $globalDBdriver;
1749
		if ($globalDBdriver == 'mysql') {
@@ 1766-1776 (lines=11) @@
1763
                else return true;
1764
	}
1765
1766
	public static function insert_last_schedules_update() {
1767
		$query = "DELETE FROM config WHERE name = 'last_update_schedules';
1768
			INSERT INTO config (name,value) VALUES ('last_update_schedules',NOW());";
1769
		try {
1770
			$Connection = new Connection();
1771
			$sth = $Connection->db->prepare($query);
1772
                        $sth->execute();
1773
                } catch(PDOException $e) {
1774
                        return "error : ".$e->getMessage();
1775
                }
1776
	}
1777
	
1778
	public static function update_all() {
1779
		echo update_db::update_routes();