Completed
Push — master ( f95d61...d4f463 )
by Yannick
05:25
created
scripts/update_db.php 1 patch
Braces   +20 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, "update_db.php")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, "update_db.php")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -28,8 +30,10 @@  discard block
 block discarded – undo
28 30
 			$update_db->update_notam();
29 31
 		}
30 32
 		$update_db->insert_last_notam_update();
31
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
32
-}
33
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
34
+		echo "NOTAM are only updated once a day.\n";
35
+	}
36
+	}
33 37
 
34 38
 if ($update_db->check_last_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
35 39
 	$update_db->update_all();
@@ -37,7 +41,9 @@  discard block
 block discarded – undo
37 41
 //	$Spotter = new Spotter();
38 42
 //	$Spotter->updateFieldsFromOtherTables();
39 43
 	$update_db->insert_last_update();
40
-} elseif (isset($globalDebug) && $globalDebug && (!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";
44
+} elseif (isset($globalDebug) && $globalDebug && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
45
+	echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
46
+}
41 47
 
42 48
 
43 49
 if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) {
@@ -47,22 +53,28 @@  discard block
 block discarded – undo
47 53
 	if ($METAR->check_last_update()) {
48 54
 		$METAR->addMETARCycle();
49 55
 		$METAR->insert_last_update();
50
-	} else echo "METAR are only updated every 30 minutes.\n";
51
-}
56
+	} else {
57
+		echo "METAR are only updated every 30 minutes.\n";
58
+	}
59
+	}
52 60
 
53 61
 
54 62
 if (isset($globalOwner) && $globalOwner && $update_db->check_last_owner_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
55 63
 	echo "Updating private aircraft's owners...";
56 64
 	$update_db->update_owner();
57 65
 	$update_db->insert_last_owner_update();
58
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
66
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
67
+	echo "Owner are only updated every 15 days.\n";
68
+}
59 69
 
60 70
 if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
61 71
 	echo "Updating schedules...";
62 72
 	$update_db->update_oneworld();
63 73
 	$update_db->update_skyteam();
64 74
 	$update_db->insert_last_schedules_update();
65
-} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
75
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
76
+	echo "Schedules are only updated every 15 days.\n";
77
+}
66 78
 
67 79
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
68 80
 	echo "Updating statistics and archive old data...";
Please login to merge, or discard this patch.