Code Duplication    Length = 16-27 lines in 4 locations

install/class.update_db.php 4 locations

@@ 1119-1134 (lines=16) @@
1116
		return '';
1117
	}
1118
1119
	public static function update_routes() {
1120
		global $tmp_dir, $globalDebug;
1121
		$error = '';
1122
		if ($globalDebug) echo "Routes : Download...";
1123
		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
1124
		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
1125
			if ($globalDebug) echo "Gunzip...";
1126
			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
1127
			if ($globalDebug) echo "Add to DB...";
1128
			$error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb');
1129
		} else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
1130
		if ($error != '') {
1131
			return $error;
1132
		} elseif ($globalDebug) echo "Done\n";
1133
		return '';
1134
	}
1135
	public static function update_ModeS() {
1136
		global $tmp_dir, $globalDebug;
1137
/*
@@ 1135-1161 (lines=27) @@
1132
		} elseif ($globalDebug) echo "Done\n";
1133
		return '';
1134
	}
1135
	public static function update_ModeS() {
1136
		global $tmp_dir, $globalDebug;
1137
/*
1138
		if ($globalDebug) echo "Modes : Download...";
1139
		update_db::download('http://pp-sqb.mantma.co.uk/basestation_latest.zip',$tmp_dir.'basestation_latest.zip');
1140
		if ($globalDebug) echo "Unzip...";
1141
		update_db::unzip($tmp_dir.'basestation_latest.zip');
1142
		if ($globalDebug) echo "Add to DB...";
1143
		$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'/basestation_latest/basestation.sqb');
1144
		if ($error != true) {
1145
			echo $error;
1146
			exit;
1147
		} elseif ($globalDebug) echo "Done\n";
1148
*/
1149
		if ($globalDebug) echo "Modes : Download...";
1150
		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
1151
		if (file_exists($tmp_dir.'basestation_latest.zip')) {
1152
			if ($globalDebug) echo "Unzip...";
1153
			update_db::unzip($tmp_dir.'basestation_latest.zip');
1154
			if ($globalDebug) echo "Add to DB...";
1155
			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb');
1156
		} else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
1157
		if ($error != '') {
1158
			return $error;
1159
		} elseif ($globalDebug) echo "Done\n";
1160
		return '';
1161
	}
1162
1163
	public static function update_ModeS_flarm() {
1164
		global $tmp_dir, $globalDebug;
@@ 1369-1384 (lines=16) @@
1366
		return '';
1367
	}
1368
1369
	public static function update_translation() {
1370
		global $tmp_dir, $globalDebug;
1371
		$error = '';
1372
		if ($globalDebug) echo "Translation : Download...";
1373
		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
1374
		if (file_exists($tmp_dir.'translation.zip')) {
1375
			if ($globalDebug) echo "Unzip...";
1376
			update_db::unzip($tmp_dir.'translation.zip');
1377
			if ($globalDebug) echo "Add to DB...";
1378
			$error = update_db::translation();
1379
		} else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
1380
		if ($error != '') {
1381
			return $error;
1382
		} elseif ($globalDebug) echo "Done\n";
1383
		return '';
1384
	}
1385
1386
	public static function update_translation_fam() {
1387
		global $tmp_dir, $globalDebug;
@@ 1386-1401 (lines=16) @@
1383
		return '';
1384
	}
1385
1386
	public static function update_translation_fam() {
1387
		global $tmp_dir, $globalDebug;
1388
		$error = '';
1389
		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
1390
		update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
1391
		if (file_exists($tmp_dir.'translation.tsv.gz')) {
1392
			if ($globalDebug) echo "Gunzip...";
1393
			update_db::gunzip($tmp_dir.'translation.tsv.gz');
1394
			if ($globalDebug) echo "Add to DB...";
1395
			$error = update_db::translation_fam();
1396
		} else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
1397
		if ($error != '') {
1398
			return $error;
1399
		} elseif ($globalDebug) echo "Done\n";
1400
		return '';
1401
	}
1402
1403
	public static function update_models() {
1404
		global $tmp_dir, $globalDebug;