Code Duplication    Length = 18-18 lines in 3 locations

install/class.update_db.php 3 locations

@@ 1548-1565 (lines=18) @@
1545
		return '';
1546
	}
1547
	
1548
	public static function check_last_update() {
1549
		global $globalDBdriver;
1550
		if ($globalDBdriver == 'mysql') {
1551
			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_db' AND value > DATE_SUB(DATE(NOW()), INTERVAL 15 DAY)";
1552
		} else {
1553
			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_db' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '15 DAYS'";
1554
		}
1555
		try {
1556
			$Connection = new Connection();
1557
			$sth = $Connection->db->prepare($query);
1558
                        $sth->execute();
1559
                } catch(PDOException $e) {
1560
                        return "error : ".$e->getMessage();
1561
                }
1562
                $row = $sth->fetch(PDO::FETCH_ASSOC);
1563
                if ($row['nb'] > 0) return false;
1564
                else return true;
1565
	}
1566
1567
	public static function insert_last_update() {
1568
		$query = "DELETE FROM config WHERE name = 'last_update_db';
@@ 1579-1596 (lines=18) @@
1576
                }
1577
	}
1578
1579
	public static function check_last_notam_update() {
1580
		global $globalDBdriver;
1581
		if ($globalDBdriver == 'mysql') {
1582
			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_notam_db' AND value > DATE_SUB(DATE(NOW()), INTERVAL 1 DAY)";
1583
		} else {
1584
			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_notam_db' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '1 DAYS'";
1585
		}
1586
		try {
1587
			$Connection = new Connection();
1588
			$sth = $Connection->db->prepare($query);
1589
                        $sth->execute();
1590
                } catch(PDOException $e) {
1591
                        return "error : ".$e->getMessage();
1592
                }
1593
                $row = $sth->fetch(PDO::FETCH_ASSOC);
1594
                if ($row['nb'] > 0) return false;
1595
                else return true;
1596
	}
1597
1598
	public static function insert_last_notam_update() {
1599
		$query = "DELETE FROM config WHERE name = 'last_update_notam_db';
@@ 1610-1627 (lines=18) @@
1607
                }
1608
	}
1609
1610
	public static function check_last_owner_update() {
1611
		global $globalDBdriver;
1612
		if ($globalDBdriver == 'mysql') {
1613
			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_owner_db' AND value > DATE_SUB(DATE(NOW()), INTERVAL 15 DAY)";
1614
		} else {
1615
			$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_owner_db' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '15 DAYS'";
1616
		}
1617
		try {
1618
			$Connection = new Connection();
1619
			$sth = $Connection->db->prepare($query);
1620
                        $sth->execute();
1621
                } catch(PDOException $e) {
1622
                        return "error : ".$e->getMessage();
1623
                }
1624
                $row = $sth->fetch(PDO::FETCH_ASSOC);
1625
                if ($row['nb'] > 0) return false;
1626
                else return true;
1627
	}
1628
1629
	public static function insert_last_owner_update() {
1630
		$query = "DELETE FROM config WHERE name = 'last_update_owner_db';