Code Duplication    Length = 16-27 lines in 4 locations

install/class.update_db.php 4 locations

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