Code Duplication    Length = 9-12 lines in 3 locations

install/class.update_db.php 1 location

@@ 1064-1072 (lines=9) @@
1061
		global $tmp_dir, $globalDBdriver;
1062
		include_once('class.create_db.php');
1063
		$Connection = new Connection();
1064
		if ($Connection->tableExists('countries')) {
1065
			$query = 'DROP TABLE countries';
1066
			try {
1067
				$sth = $Connection->db->prepare($query);
1068
            	        	$sth->execute();
1069
	                } catch(PDOException $e) {
1070
    	                	echo "error : ".$e->getMessage();
1071
	                }
1072
		}
1073
		if ($globalDBdriver == 'mysql') {
1074
			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
1075
		} else {

install/class.update_schema.php 2 locations

@@ 179-188 (lines=10) @@
176
    		$error = '';
177
    		// Create table acars_label
178
		$error .= create_db::import_file('../db/acars_label.sql');
179
		if ($error == '') {
180
		    // Update schema_version to 5
181
		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
        	    try {
183
            		$sth = $Connection->db->prepare($query);
184
			$sth->execute();
185
    		    } catch(PDOException $e) {
186
			return "error (update schema_version) : ".$e->getMessage()."\n";
187
    		    }
188
    		}
189
		return $error;
190
	}
191
@@ 735-746 (lines=12) @@
732
    		$Connection = new Connection();
733
		$error = '';
734
		// Add table stats polar
735
		if ($globalDBdriver == 'mysql') {
736
			//$error .= create_db::import_file('../db/stats_source.sql');
737
		} else {
738
			//$error .= create_db::import_file('../db/pgsql/stats_source.sql');
739
			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
740
        		try {
741
		    		$sth = $Connection->db->prepare($query);
742
				$sth->execute();
743
			} catch(PDOException $e) {
744
				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
745
			}
746
		}
747
    		$query = "";
748
        	try {
749
			$sth = $Connection->db->prepare($query);