Completed
Push — master ( d76ba7...f0f56a )
by Yannick
06:13
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") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -29,14 +31,18 @@  discard block
 block discarded – undo
29 31
 			$update_db->update_notam();
30 32
 		}
31 33
 		$update_db->insert_last_notam_update();
32
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
34
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
35
+		echo "NOTAM are only updated once a day.\n";
36
+	}
33 37
 	if ($update_db->check_last_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
34 38
 		$update_db->update_all();
35 39
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
36 40
 	//	$Spotter = new Spotter();
37 41
 	//	$Spotter->updateFieldsFromOtherTables();
38 42
 		$update_db->insert_last_update();
39
-	} 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";
43
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
44
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	}
40 46
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
41 47
 		echo "Check if new airspace version exist...";
42 48
 		echo $update_db->update_airspace_fam();
@@ -48,8 +54,10 @@  discard block
 block discarded – undo
48 54
 		$update_db->update_owner_fam();
49 55
 		$update_db->delete_duplicateowner();
50 56
 		$update_db->insert_last_owner_update();
51
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
52
-}
57
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
58
+		echo "Owner are only updated every 15 days.\n";
59
+	}
60
+	}
53 61
 
54 62
 
55 63
 if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) {
@@ -59,15 +67,19 @@  discard block
 block discarded – undo
59 67
 	if ($METAR->check_last_update()) {
60 68
 		$METAR->addMETARCycle();
61 69
 		$METAR->insert_last_update();
62
-	} else echo "METAR are only updated every 30 minutes.\n";
63
-}
70
+	} else {
71
+		echo "METAR are only updated every 30 minutes.\n";
72
+	}
73
+	}
64 74
 
65 75
 if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
66 76
 	echo "Updating schedules...";
67 77
 	//$update_db->update_oneworld();
68 78
 	$update_db->update_skyteam();
69 79
 	$update_db->insert_last_schedules_update();
70
-} 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";
80
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
81
+	echo "Schedules are only updated every 15 days.\n";
82
+}
71 83
 
72 84
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
73 85
 	echo "Updating statistics and archive old data...";
Please login to merge, or discard this patch.