Code Duplication    Length = 15-20 lines in 4 locations

install/class.update_schema.php 4 locations

@@ 516-530 (lines=15) @@
513
		return $error;
514
	}
515
516
	private static function update_from_14() {
517
    		$Connection = new Connection();
518
		$error = '';
519
    		// Add tables
520
		$error .= create_db::import_file('../db/stats_flight.sql');
521
		if ($error != '') return $error;
522
		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
523
        	try {
524
            	    $sth = $Connection->db->prepare($query);
525
		    $sth->execute();
526
    		} catch(PDOException $e) {
527
		    return "error (update schema_version) : ".$e->getMessage()."\n";
528
    		}
529
		return $error;
530
	}
531
532
533
	private static function update_from_15() {
@@ 555-570 (lines=16) @@
552
		return $error;
553
	}
554
555
	private static function update_from_16() {
556
    		$Connection = new Connection();
557
		$error = '';
558
    		// Add tables
559
		$error .= create_db::import_file('../db/stats_registration.sql');
560
		$error .= create_db::import_file('../db/stats_callsign.sql');
561
		if ($error != '') return $error;
562
		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
563
        	try {
564
            	    $sth = $Connection->db->prepare($query);
565
		    $sth->execute();
566
    		} catch(PDOException $e) {
567
		    return "error (update schema_version) : ".$e->getMessage()."\n";
568
    		}
569
		return $error;
570
	}
571
572
	private static function update_from_17() {
573
    		$Connection = new Connection();
@@ 572-586 (lines=15) @@
569
		return $error;
570
	}
571
572
	private static function update_from_17() {
573
    		$Connection = new Connection();
574
		$error = '';
575
    		// Add tables
576
		$error .= create_db::import_file('../db/stats_country.sql');
577
		if ($error != '') return $error;
578
		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
579
        	try {
580
            	    $sth = $Connection->db->prepare($query);
581
		    $sth->execute();
582
    		} catch(PDOException $e) {
583
		    return "error (update schema_version) : ".$e->getMessage()."\n";
584
    		}
585
		return $error;
586
	}
587
	private static function update_from_18() {
588
    		$Connection = new Connection();
589
		$error = '';
@@ 708-727 (lines=20) @@
705
		return $error;
706
	}
707
708
	private static function update_from_22() {
709
		global $globalDBdriver;
710
    		$Connection = new Connection();
711
		$error = '';
712
		// Add table stats polar
713
		if ($globalDBdriver == 'mysql') {
714
			$error .= create_db::import_file('../db/stats_source.sql');
715
		} else {
716
			$error .= create_db::import_file('../db/pgsql/stats_source.sql');
717
		}
718
		if ($error != '') return $error;
719
		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
720
        	try {
721
            	    $sth = $Connection->db->prepare($query);
722
		    $sth->execute();
723
    		} catch(PDOException $e) {
724
		    return "error (update schema_version) : ".$e->getMessage()."\n";
725
    		}
726
		return $error;
727
	}
728
729
730
	private static function update_from_23() {