Completed
Push — master ( 7972c9...d56c75 )
by Yannick
29:57
created
scripts/update_db.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 
8 8
 // Check if script is not already running... (dirty)
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10
-	if(function_exists('exec')) {
10
+	if (function_exists('exec')) {
11 11
 		exec("ps ux", $output, $result);
12 12
 		$j = 0;
13
-		foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
13
+		foreach ($output as $line) if (strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
14 14
 		if ($j > 1) {
15 15
 			echo "Script is already runnning...";
16 16
 			die();
Please login to merge, or discard this patch.
Braces   +30 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 	if(function_exists('exec')) {
11 11
 		exec("ps ux", $output, $result);
12 12
 		$j = 0;
13
-		foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
13
+		foreach ($output as $line) {
14
+			if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
15
+		}
14 16
 		if ($j > 1) {
15 17
 			echo "Script is already runnning...";
16 18
 			die();
@@ -31,14 +33,18 @@  discard block
 block discarded – undo
31 33
 			$update_db->update_notam();
32 34
 		}
33 35
 		$update_db->insert_last_notam_update();
34
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
36
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
37
+		echo "NOTAM are only updated once a day.\n";
38
+	}
35 39
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
36 40
 		$update_db->update_all();
37 41
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
38 42
 	//	$Spotter = new Spotter();
39 43
 	//	$Spotter->updateFieldsFromOtherTables();
40 44
 		$update_db->insert_last_update();
41
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
46
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
47
+	}
42 48
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
43 49
 		echo "Check if new airspace version exist...";
44 50
 		echo $update_db->update_airspace_fam();
@@ -47,8 +53,11 @@  discard block
 block discarded – undo
47 53
 	if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) {
48 54
 		echo "Check if new geoid version exist...";
49 55
 		$error = $update_db->update_geoid_fam();
50
-		if ($error == '') $update_db->insert_last_geoid_update();
51
-		else echo $error;
56
+		if ($error == '') {
57
+			$update_db->insert_last_geoid_update();
58
+		} else {
59
+			echo $error;
60
+		}
52 61
 	}
53 62
 	if (isset($globalMarine) && $globalMarine && $update_db->check_last_marine_identity_update()) {
54 63
 		echo "Check if new marine identity version exist...";
@@ -66,13 +75,17 @@  discard block
 block discarded – undo
66 75
 			//echo "Done";
67 76
 		}
68 77
 		$update_db->insert_last_owner_update();
69
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
78
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
79
+		echo "Owner are only updated every 15 days.\n";
80
+	}
70 81
 
71 82
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && ($update_db->check_last_airlines_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
72 83
 		echo "Updating airlines...\n";
73 84
 		echo $update_db->update_airlines_fam();
74 85
 		$update_db->insert_last_airlines_update();
75
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Airlines are only updated every 15 days.\n";
86
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
87
+		echo "Airlines are only updated every 15 days.\n";
88
+	}
76 89
 
77 90
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
78 91
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -81,7 +94,9 @@  discard block
 block discarded – undo
81 94
 		if ($Accident->check_last_accidents_update()) {
82 95
 			$Accident->download_update();
83 96
 			$Accident->insert_last_accidents_update();
84
-		} else echo "Accidents are updated once a day.\n";
97
+		} else {
98
+			echo "Accidents are updated once a day.\n";
99
+		}
85 100
 	}
86 101
   
87 102
 }
@@ -94,7 +109,9 @@  discard block
 block discarded – undo
94 109
 		if ($METAR->check_last_update()) {
95 110
 			$METAR->addMETARCycle();
96 111
 			$METAR->insert_last_update();
97
-		} else echo "METAR are only updated every 30 minutes.\n";
112
+		} else {
113
+			echo "METAR are only updated every 30 minutes.\n";
114
+		}
98 115
 	}
99 116
 
100 117
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
@@ -102,8 +119,10 @@  discard block
 block discarded – undo
102 119
 		//$update_db->update_oneworld();
103 120
 		$update_db->update_skyteam();
104 121
 		$update_db->insert_last_schedules_update();
105
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
106
-}
122
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
123
+		echo "Schedules are only updated every 15 days.\n";
124
+	}
125
+	}
107 126
 
108 127
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
109 128
 	echo "Updating statistics and archive old data...\n";
Please login to merge, or discard this patch.