Completed
Push — master ( 6dfca2...1ea9e3 )
by Yannick
21:01 queued 08:32
created
install/class.update_schema.php 2 patches
Indentation   +562 added lines, -562 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
 class update_schema {
9 9
 
10 10
 	public static function update_schedule() {
11
-	    $Connection = new Connection();
12
-	    $Schedule = new Schedule();
13
-	    $query = "SELECT * FROM schedule";
14
-            try {
15
-            	$sth = $Connection->db->prepare($query);
11
+		$Connection = new Connection();
12
+		$Schedule = new Schedule();
13
+		$query = "SELECT * FROM schedule";
14
+			try {
15
+				$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+			} catch(PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19
-    	    }
20
-    	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
-    	    }
19
+			}
20
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
+			$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
+			}
23 23
 	
24 24
 	}
25 25
 /*
@@ -43,198 +43,198 @@  discard block
 block discarded – undo
43 43
     	}
44 44
 */	
45 45
 	private static function update_from_1() {
46
-    		$Connection = new Connection();
47
-    		// Add new column to routes table
48
-    		//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
46
+			$Connection = new Connection();
47
+			// Add new column to routes table
48
+			//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
49 49
 		$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL";
50
-        	try {
51
-            	    $sth = $Connection->db->prepare($query);
52
-		    $sth->execute();
53
-    		} catch(PDOException $e) {
54
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
-    		}
56
-    		// Copy schedules data to routes table
57
-    		self::update_schedule();
58
-    		// Delete schedule table
50
+			try {
51
+					$sth = $Connection->db->prepare($query);
52
+			$sth->execute();
53
+			} catch(PDOException $e) {
54
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
+			}
56
+			// Copy schedules data to routes table
57
+			self::update_schedule();
58
+			// Delete schedule table
59 59
 		$query = "DROP TABLE `schedule`";
60
-        	try {
61
-            	    $sth = $Connection->db->prepare($query);
62
-		    $sth->execute();
63
-    		} catch(PDOException $e) {
64
-		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65
-    		}
66
-    		// Add source column
67
-    		$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
-    		try {
69
-            	    $sth = $Connection->db->prepare($query);
70
-		    $sth->execute();
71
-    		} catch(PDOException $e) {
72
-		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
-    		}
60
+			try {
61
+					$sth = $Connection->db->prepare($query);
62
+			$sth->execute();
63
+			} catch(PDOException $e) {
64
+			return "error (delete schedule table) : ".$e->getMessage()."\n";
65
+			}
66
+			// Add source column
67
+			$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
+			try {
69
+					$sth = $Connection->db->prepare($query);
70
+			$sth->execute();
71
+			} catch(PDOException $e) {
72
+			return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
+			}
74 74
 		// Delete unused column
75 75
 		$query = "ALTER TABLE `aircraft_modes`  DROP `SerialNo`,  DROP `OperatorFlagCode`,  DROP `Manufacturer`,  DROP `Type`,  DROP `FirstRegDate`,  DROP `CurrentRegDate`,  DROP `Country`,  DROP `PreviousID`,  DROP `DeRegDate`,  DROP `Status`,  DROP `PopularName`,  DROP `GenericName`,  DROP `AircraftClass`,  DROP `Engines`,  DROP `OwnershipStatus`,  DROP `RegisteredOwners`,  DROP `MTOW`,  DROP `TotalHours`,  DROP `YearBuilt`,  DROP `CofACategory`,  DROP `CofAExpiry`,  DROP `UserNotes`,  DROP `Interested`,  DROP `UserTag`,  DROP `InfoUrl`,  DROP `PictureUrl1`,  DROP `PictureUrl2`,  DROP `PictureUrl3`,  DROP `UserBool1`,  DROP `UserBool2`,  DROP `UserBool3`,  DROP `UserBool4`,  DROP `UserBool5`,  DROP `UserString1`,  DROP `UserString2`,  DROP `UserString3`,  DROP `UserString4`,  DROP `UserString5`,  DROP `UserInt1`,  DROP `UserInt2`,  DROP `UserInt3`,  DROP `UserInt4`,  DROP `UserInt5`";
76
-    		try {
77
-            	    $sth = $Connection->db->prepare($query);
78
-		    $sth->execute();
79
-    		} catch(PDOException $e) {
80
-		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
-    		}
76
+			try {
77
+					$sth = $Connection->db->prepare($query);
78
+			$sth->execute();
79
+			} catch(PDOException $e) {
80
+			return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
+			}
82 82
 		// Add ModeS column
83 83
 		$query = "ALTER TABLE `spotter_output`  ADD `ModeS` VARCHAR(255) NULL";
84
-    		try {
85
-            	    $sth = $Connection->db->prepare($query);
86
-		    $sth->execute();
87
-    		} catch(PDOException $e) {
88
-		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
-    		}
84
+			try {
85
+					$sth = $Connection->db->prepare($query);
86
+			$sth->execute();
87
+			} catch(PDOException $e) {
88
+			return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
+			}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91
-    		try {
92
-            	    $sth = $Connection->db->prepare($query);
93
-		    $sth->execute();
94
-    		} catch(PDOException $e) {
95
-		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
-    		}
97
-    		// Add auto_increment for aircraft_modes
98
-    		$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
-    		try {
100
-            	    $sth = $Connection->db->prepare($query);
101
-		    $sth->execute();
102
-    		} catch(PDOException $e) {
103
-		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
-    		}
105
-    		$error = '';
91
+			try {
92
+					$sth = $Connection->db->prepare($query);
93
+			$sth->execute();
94
+			} catch(PDOException $e) {
95
+			return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
+			}
97
+			// Add auto_increment for aircraft_modes
98
+			$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
+			try {
100
+					$sth = $Connection->db->prepare($query);
101
+			$sth->execute();
102
+			} catch(PDOException $e) {
103
+			return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
+			}
105
+			$error = '';
106 106
 		$error .= create_db::import_file('../db/acars_live.sql');
107 107
 		$error .= create_db::import_file('../db/config.sql');
108 108
 		// Update schema_version to 2
109 109
 		$query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'";
110
-        	try {
111
-            	    $sth = $Connection->db->prepare($query);
112
-		    $sth->execute();
113
-    		} catch(PDOException $e) {
114
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
115
-    		}
110
+			try {
111
+					$sth = $Connection->db->prepare($query);
112
+			$sth->execute();
113
+			} catch(PDOException $e) {
114
+			return "error (update schema_version) : ".$e->getMessage()."\n";
115
+			}
116 116
 		return $error;
117
-        }
117
+		}
118 118
 
119 119
 	private static function update_from_2() {
120
-    		$Connection = new Connection();
121
-    		// Add new column decode to acars_live table
120
+			$Connection = new Connection();
121
+			// Add new column decode to acars_live table
122 122
 		$query = "ALTER TABLE `acars_live` ADD `decode` TEXT";
123
-        	try {
124
-            	    $sth = $Connection->db->prepare($query);
125
-		    $sth->execute();
126
-    		} catch(PDOException $e) {
127
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
-    		}
129
-    		$error = '';
130
-    		// Create table acars_archive
123
+			try {
124
+					$sth = $Connection->db->prepare($query);
125
+			$sth->execute();
126
+			} catch(PDOException $e) {
127
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
+			}
129
+			$error = '';
130
+			// Create table acars_archive
131 131
 		$error .= create_db::import_file('../db/acars_archive.sql');
132 132
 		// Update schema_version to 3
133 133
 		$query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'";
134
-        	try {
135
-            	    $sth = $Connection->db->prepare($query);
136
-		    $sth->execute();
137
-    		} catch(PDOException $e) {
138
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
139
-    		}
134
+			try {
135
+					$sth = $Connection->db->prepare($query);
136
+			$sth->execute();
137
+			} catch(PDOException $e) {
138
+			return "error (update schema_version) : ".$e->getMessage()."\n";
139
+			}
140 140
 		return $error;
141 141
 	}
142 142
 
143 143
 	private static function update_from_3() {
144
-    		$Connection = new Connection();
145
-    		// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
144
+			$Connection = new Connection();
145
+			// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
146 146
 		$query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP";
147
-        	try {
148
-            	    $sth = $Connection->db->prepare($query);
149
-		    $sth->execute();
150
-    		} catch(PDOException $e) {
151
-		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
-    		}
153
-    		// Add image_source_website column to spotter_image
147
+			try {
148
+					$sth = $Connection->db->prepare($query);
149
+			$sth->execute();
150
+			} catch(PDOException $e) {
151
+			return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
+			}
153
+			// Add image_source_website column to spotter_image
154 154
 		$query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL";
155
-        	try {
156
-            	    $sth = $Connection->db->prepare($query);
157
-		    $sth->execute();
158
-    		} catch(PDOException $e) {
159
-		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
-    		}
161
-    		$error = '';
155
+			try {
156
+					$sth = $Connection->db->prepare($query);
157
+			$sth->execute();
158
+			} catch(PDOException $e) {
159
+			return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
+			}
161
+			$error = '';
162 162
 		// Update schema_version to 4
163 163
 		$query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'";
164
-        	try {
165
-            	    $sth = $Connection->db->prepare($query);
166
-		    $sth->execute();
167
-    		} catch(PDOException $e) {
168
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
169
-    		}
164
+			try {
165
+					$sth = $Connection->db->prepare($query);
166
+			$sth->execute();
167
+			} catch(PDOException $e) {
168
+			return "error (update schema_version) : ".$e->getMessage()."\n";
169
+			}
170 170
 		return $error;
171 171
 	}
172 172
 	
173 173
 	private static function update_from_4() {
174
-    		$Connection = new Connection();
174
+			$Connection = new Connection();
175 175
 	
176
-    		$error = '';
177
-    		// Create table acars_label
176
+			$error = '';
177
+			// Create table acars_label
178 178
 		$error .= create_db::import_file('../db/acars_label.sql');
179 179
 		if ($error == '') {
180
-		    // Update schema_version to 5
181
-		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
-        	    try {
183
-            		$sth = $Connection->db->prepare($query);
180
+			// Update schema_version to 5
181
+			$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
+				try {
183
+					$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+				} catch(PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187
-    		    }
188
-    		}
187
+				}
188
+			}
189 189
 		return $error;
190 190
 	}
191 191
 
192 192
 	private static function update_from_5() {
193
-    		$Connection = new Connection();
194
-    		// Add columns to translation
193
+			$Connection = new Connection();
194
+			// Add columns to translation
195 195
 		$query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;";
196
-        	try {
197
-            	    $sth = $Connection->db->prepare($query);
198
-		    $sth->execute();
199
-    		} catch(PDOException $e) {
200
-		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
-    		}
202
-    		// Add aircraft_shadow column to aircraft
203
-    		$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
-        	try {
205
-            	    $sth = $Connection->db->prepare($query);
206
-		    $sth->execute();
207
-    		} catch(PDOException $e) {
208
-		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
-    		}
210
-    		// Add aircraft_shadow column to spotter_live
211
-    		$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
-        	try {
213
-            	    $sth = $Connection->db->prepare($query);
214
-		    $sth->execute();
215
-    		} catch(PDOException $e) {
216
-		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
-    		}
218
-    		$error = '';
219
-    		// Update table aircraft
196
+			try {
197
+					$sth = $Connection->db->prepare($query);
198
+			$sth->execute();
199
+			} catch(PDOException $e) {
200
+			return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
+			}
202
+			// Add aircraft_shadow column to aircraft
203
+			$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
+			try {
205
+					$sth = $Connection->db->prepare($query);
206
+			$sth->execute();
207
+			} catch(PDOException $e) {
208
+			return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
+			}
210
+			// Add aircraft_shadow column to spotter_live
211
+			$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
+			try {
213
+					$sth = $Connection->db->prepare($query);
214
+			$sth->execute();
215
+			} catch(PDOException $e) {
216
+			return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
+			}
218
+			$error = '';
219
+			// Update table aircraft
220 220
 		$error .= create_db::import_file('../db/aircraft.sql');
221 221
 		$error .= create_db::import_file('../db/spotter_archive.sql');
222 222
 
223 223
 		// Update schema_version to 6
224 224
 		$query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'";
225
-        	try {
226
-            	    $sth = $Connection->db->prepare($query);
227
-		    $sth->execute();
228
-    		} catch(PDOException $e) {
229
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
230
-    		}
225
+			try {
226
+					$sth = $Connection->db->prepare($query);
227
+			$sth->execute();
228
+			} catch(PDOException $e) {
229
+			return "error (update schema_version) : ".$e->getMessage()."\n";
230
+			}
231 231
 		return $error;
232 232
 	}
233 233
 
234 234
 	private static function update_from_6() {
235
-    		$Connection = new Connection();
236
-    		if (!$Connection−>indexExists('spotter_output','flightaware_id')) {
237
-    		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
235
+			$Connection = new Connection();
236
+			if (!$Connection−>indexExists('spotter_output','flightaware_id')) {
237
+				$query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
240 240
 			ALTER TABLE spotter_live ADD INDEX(flightaware_id);
@@ -247,147 +247,147 @@  discard block
 block discarded – undo
247 247
 			ALTER TABLE aircraft ADD INDEX(icao);
248 248
 			ALTER TABLE airport ADD INDEX(icao);
249 249
 			ALTER TABLE translation ADD INDEX(Operator);";
250
-        	    try {
251
-            		$sth = $Connection->db->prepare($query);
250
+				try {
251
+					$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+				} catch(PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255
-    		    }
256
-    		}
257
-    		$error = '';
258
-    		// Update table countries
259
-    		if ($Connection->tableExists('airspace')) {
260
-    		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
255
+				}
256
+			}
257
+			$error = '';
258
+			// Update table countries
259
+			if ($Connection->tableExists('airspace')) {
260
+				$error .= update_db::update_countries();
261
+			if ($error != '') return $error;
262 262
 		}
263 263
 		// Update schema_version to 7
264 264
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
265
-        	try {
266
-            	    $sth = $Connection->db->prepare($query);
267
-		    $sth->execute();
268
-    		} catch(PDOException $e) {
269
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
270
-    		}
265
+			try {
266
+					$sth = $Connection->db->prepare($query);
267
+			$sth->execute();
268
+			} catch(PDOException $e) {
269
+			return "error (update schema_version) : ".$e->getMessage()."\n";
270
+			}
271 271
 		return $error;
272
-    	}
272
+		}
273 273
 
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276
-    		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
276
+			$Connection = new Connection();
277
+			$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279
-        	try {
280
-            	    $sth = $Connection->db->prepare($query);
281
-		    $sth->execute();
282
-    		} catch(PDOException $e) {
283
-		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
-    		}
285
-    		if ($globalDBdriver == 'mysql') {
286
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
-		    try {
288
-            		$sth = $Connection->db->prepare($query);
289
-			$sth->execute();
290
-    		    } catch(PDOException $e) {
279
+			try {
280
+					$sth = $Connection->db->prepare($query);
281
+			$sth->execute();
282
+			} catch(PDOException $e) {
283
+			return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
+			}
285
+			if ($globalDBdriver == 'mysql') {
286
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
+			try {
288
+					$sth = $Connection->db->prepare($query);
289
+			$sth->execute();
290
+				} catch(PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292
-    		    }
293
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
294
-    		    if ($row['engine'] == 'ARCHIVE') {
292
+				}
293
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
294
+				if ($row['engine'] == 'ARCHIVE') {
295 295
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
296 296
 				ALTER TABLE copy ENGINE=ARCHIVE;
297 297
 				ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
298 298
 				INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`;
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301
-            	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
-            	    }
304
-                } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
-                }
307
-        	try {
308
-            	    $sth = $Connection->db->prepare($query);
309
-		    $sth->execute();
310
-    		} catch(PDOException $e) {
311
-		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
-    		}
301
+					} else {
302
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
+					}
304
+				} else {
305
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
+				}
307
+			try {
308
+					$sth = $Connection->db->prepare($query);
309
+			$sth->execute();
310
+			} catch(PDOException $e) {
311
+			return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
+			}
313 313
 
314
-    		$error = '';
315
-    		// Update table aircraft
314
+			$error = '';
315
+			// Update table aircraft
316 316
 		$error .= create_db::import_file('../db/source_location.sql');
317 317
 		if ($error != '') return $error;
318 318
 		// Update schema_version to 6
319 319
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320
-        	try {
321
-            	    $sth = $Connection->db->prepare($query);
322
-		    $sth->execute();
323
-    		} catch(PDOException $e) {
324
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
325
-    		}
320
+			try {
321
+					$sth = $Connection->db->prepare($query);
322
+			$sth->execute();
323
+			} catch(PDOException $e) {
324
+			return "error (update schema_version) : ".$e->getMessage()."\n";
325
+			}
326 326
 		return $error;
327 327
 	}
328 328
 
329 329
 	private static function update_from_8() {
330
-    		$Connection = new Connection();
331
-    		$error = '';
332
-    		// Update table aircraft
330
+			$Connection = new Connection();
331
+			$error = '';
332
+			// Update table aircraft
333 333
 		$error .= create_db::import_file('../db/notam.sql');
334 334
 		if ($error != '') return $error;
335 335
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 336
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 337
                         DELETE FROM config WHERE name = 'last_update_notam_db';
338 338
                         INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
339
-        	try {
340
-            	    $sth = $Connection->db->prepare($query);
341
-		    $sth->execute();
342
-    		} catch(PDOException $e) {
343
-		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344
-    		}
339
+			try {
340
+					$sth = $Connection->db->prepare($query);
341
+			$sth->execute();
342
+			} catch(PDOException $e) {
343
+			return "error (insert last_update values) : ".$e->getMessage()."\n";
344
+			}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346
-        	try {
347
-            	    $sth = $Connection->db->prepare($query);
348
-		    $sth->execute();
349
-    		} catch(PDOException $e) {
350
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
351
-    		}
346
+			try {
347
+					$sth = $Connection->db->prepare($query);
348
+			$sth->execute();
349
+			} catch(PDOException $e) {
350
+			return "error (update schema_version) : ".$e->getMessage()."\n";
351
+			}
352 352
 		return $error;
353 353
 	}
354 354
 
355 355
 	private static function update_from_9() {
356
-    		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
356
+			$Connection = new Connection();
357
+			$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359
-        	try {
360
-            	    $sth = $Connection->db->prepare($query);
361
-		    $sth->execute();
362
-    		} catch(PDOException $e) {
363
-		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
-    		}
359
+			try {
360
+					$sth = $Connection->db->prepare($query);
361
+			$sth->execute();
362
+			} catch(PDOException $e) {
363
+			return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
+			}
365 365
 		$error = '';
366
-    		// Update table atc
366
+			// Update table atc
367 367
 		$error .= create_db::import_file('../db/atc.sql');
368 368
 		if ($error != '') return $error;
369 369
 		
370 370
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371
-        	try {
372
-            	    $sth = $Connection->db->prepare($query);
373
-		    $sth->execute();
374
-    		} catch(PDOException $e) {
375
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
376
-    		}
371
+			try {
372
+					$sth = $Connection->db->prepare($query);
373
+			$sth->execute();
374
+			} catch(PDOException $e) {
375
+			return "error (update schema_version) : ".$e->getMessage()."\n";
376
+			}
377 377
 		return $error;
378 378
 	}
379 379
 
380 380
 	private static function update_from_10() {
381
-    		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
-        	try {
384
-            	    $sth = $Connection->db->prepare($query);
385
-		    $sth->execute();
386
-    		} catch(PDOException $e) {
387
-		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
-    		}
381
+			$Connection = new Connection();
382
+			$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
+			try {
384
+					$sth = $Connection->db->prepare($query);
385
+			$sth->execute();
386
+			} catch(PDOException $e) {
387
+			return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
+			}
389 389
 		$error = '';
390
-    		// Add tables
390
+			// Add tables
391 391
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392 392
 		if ($error != '') return $error;
393 393
 		$error .= create_db::import_file('../db/metar.sql');
@@ -398,75 +398,75 @@  discard block
 block discarded – undo
398 398
 		if ($error != '') return $error;
399 399
 		
400 400
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401
-        	try {
402
-            	    $sth = $Connection->db->prepare($query);
403
-		    $sth->execute();
404
-    		} catch(PDOException $e) {
405
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
406
-    		}
401
+			try {
402
+					$sth = $Connection->db->prepare($query);
403
+			$sth->execute();
404
+			} catch(PDOException $e) {
405
+			return "error (update schema_version) : ".$e->getMessage()."\n";
406
+			}
407 407
 		return $error;
408 408
 	}
409 409
 
410 410
 	private static function update_from_11() {
411
-    		$Connection = new Connection();
412
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
-        	try {
414
-            	    $sth = $Connection->db->prepare($query);
415
-		    $sth->execute();
416
-    		} catch(PDOException $e) {
417
-		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
418
-    		}
419
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
-        	try {
421
-            	    $sth = $Connection->db->prepare($query);
422
-		    $sth->execute();
423
-    		} catch(PDOException $e) {
424
-		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
425
-    		}
426
-    		if ($globalDBdriver == 'mysql') {
427
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
428
-		    try {
429
-            		$sth = $Connection->db->prepare($query);
430
-			$sth->execute();
431
-    		    } catch(PDOException $e) {
411
+			$Connection = new Connection();
412
+			$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+			try {
414
+					$sth = $Connection->db->prepare($query);
415
+			$sth->execute();
416
+			} catch(PDOException $e) {
417
+			return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
418
+			}
419
+			$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+			try {
421
+					$sth = $Connection->db->prepare($query);
422
+			$sth->execute();
423
+			} catch(PDOException $e) {
424
+			return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
425
+			}
426
+			if ($globalDBdriver == 'mysql') {
427
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
428
+			try {
429
+					$sth = $Connection->db->prepare($query);
430
+			$sth->execute();
431
+				} catch(PDOException $e) {
432 432
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
433
-    		    }
434
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
435
-    		    if ($row['engine'] == 'ARCHIVE') {
433
+				}
434
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
435
+				if ($row['engine'] == 'ARCHIVE') {
436 436
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
437 437
 				ALTER TABLE copy ENGINE=ARCHIVE;
438 438
 				ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE;
439 439
 				INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`;
440 440
 				DROP TABLE spotter_archive;
441 441
 				RENAME TABLE copy TO spotter_archive;";
442
-            	    } else {
443
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
-            	    }
445
-                } else {
446
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
-                }
448
-        	try {
449
-            	    $sth = $Connection->db->prepare($query);
450
-		    $sth->execute();
451
-    		} catch(PDOException $e) {
452
-		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
453
-    		}
442
+					} else {
443
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+					}
445
+				} else {
446
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+				}
448
+			try {
449
+					$sth = $Connection->db->prepare($query);
450
+			$sth->execute();
451
+			} catch(PDOException $e) {
452
+			return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
453
+			}
454 454
 
455 455
 		$error = '';
456 456
 		
457 457
 		$query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'";
458
-        	try {
459
-            	    $sth = $Connection->db->prepare($query);
460
-		    $sth->execute();
461
-    		} catch(PDOException $e) {
462
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
463
-    		}
458
+			try {
459
+					$sth = $Connection->db->prepare($query);
460
+			$sth->execute();
461
+			} catch(PDOException $e) {
462
+			return "error (update schema_version) : ".$e->getMessage()."\n";
463
+			}
464 464
 		return $error;
465 465
 	}
466 466
 	private static function update_from_12() {
467
-    		$Connection = new Connection();
467
+			$Connection = new Connection();
468 468
 		$error = '';
469
-    		// Add tables
469
+			// Add tables
470 470
 		$error .= create_db::import_file('../db/stats.sql');
471 471
 		if ($error != '') return $error;
472 472
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
@@ -483,195 +483,195 @@  discard block
 block discarded – undo
483 483
 		if ($error != '') return $error;
484 484
 		
485 485
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
486
-        	try {
487
-            	    $sth = $Connection->db->prepare($query);
488
-		    $sth->execute();
489
-    		} catch(PDOException $e) {
490
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
491
-    		}
486
+			try {
487
+					$sth = $Connection->db->prepare($query);
488
+			$sth->execute();
489
+			} catch(PDOException $e) {
490
+			return "error (update schema_version) : ".$e->getMessage()."\n";
491
+			}
492 492
 		return $error;
493 493
 	}
494 494
 
495 495
 	private static function update_from_13() {
496
-    		$Connection = new Connection();
497
-    		$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
-        	try {
499
-            	    $sth = $Connection->db->prepare($query);
500
-		    $sth->execute();
501
-    		} catch(PDOException $e) {
502
-		    return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
503
-    		}
496
+			$Connection = new Connection();
497
+			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+			try {
499
+					$sth = $Connection->db->prepare($query);
500
+			$sth->execute();
501
+			} catch(PDOException $e) {
502
+			return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
503
+			}
504 504
 	
505
-    		$error = '';
505
+			$error = '';
506 506
 		$query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'";
507
-        	try {
508
-            	    $sth = $Connection->db->prepare($query);
509
-		    $sth->execute();
510
-    		} catch(PDOException $e) {
511
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
512
-    		}
507
+			try {
508
+					$sth = $Connection->db->prepare($query);
509
+			$sth->execute();
510
+			} catch(PDOException $e) {
511
+			return "error (update schema_version) : ".$e->getMessage()."\n";
512
+			}
513 513
 		return $error;
514 514
 	}
515 515
 
516 516
 	private static function update_from_14() {
517
-    		$Connection = new Connection();
517
+			$Connection = new Connection();
518 518
 		$error = '';
519
-    		// Add tables
519
+			// Add tables
520 520
 		$error .= create_db::import_file('../db/stats_flight.sql');
521 521
 		if ($error != '') return $error;
522 522
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
523
-        	try {
524
-            	    $sth = $Connection->db->prepare($query);
525
-		    $sth->execute();
526
-    		} catch(PDOException $e) {
527
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
528
-    		}
523
+			try {
524
+					$sth = $Connection->db->prepare($query);
525
+			$sth->execute();
526
+			} catch(PDOException $e) {
527
+			return "error (update schema_version) : ".$e->getMessage()."\n";
528
+			}
529 529
 		return $error;
530 530
 	}
531 531
 
532 532
 
533 533
 	private static function update_from_15() {
534
-    		$Connection = new Connection();
534
+			$Connection = new Connection();
535 535
 		$error = '';
536
-    		// Add tables
537
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
538
-        	try {
539
-            	    $sth = $Connection->db->prepare($query);
540
-		    $sth->execute();
541
-    		} catch(PDOException $e) {
542
-		    return "error (update stats) : ".$e->getMessage()."\n";
543
-    		}
536
+			// Add tables
537
+			$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
538
+			try {
539
+					$sth = $Connection->db->prepare($query);
540
+			$sth->execute();
541
+			} catch(PDOException $e) {
542
+			return "error (update stats) : ".$e->getMessage()."\n";
543
+			}
544 544
 		if ($error != '') return $error;
545 545
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
546
-        	try {
547
-            	    $sth = $Connection->db->prepare($query);
548
-		    $sth->execute();
549
-    		} catch(PDOException $e) {
550
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
551
-    		}
546
+			try {
547
+					$sth = $Connection->db->prepare($query);
548
+			$sth->execute();
549
+			} catch(PDOException $e) {
550
+			return "error (update schema_version) : ".$e->getMessage()."\n";
551
+			}
552 552
 		return $error;
553 553
 	}
554 554
 
555 555
 	private static function update_from_16() {
556
-    		$Connection = new Connection();
556
+			$Connection = new Connection();
557 557
 		$error = '';
558
-    		// Add tables
558
+			// Add tables
559 559
 		$error .= create_db::import_file('../db/stats_registration.sql');
560 560
 		$error .= create_db::import_file('../db/stats_callsign.sql');
561 561
 		if ($error != '') return $error;
562 562
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
563
-        	try {
564
-            	    $sth = $Connection->db->prepare($query);
565
-		    $sth->execute();
566
-    		} catch(PDOException $e) {
567
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
568
-    		}
563
+			try {
564
+					$sth = $Connection->db->prepare($query);
565
+			$sth->execute();
566
+			} catch(PDOException $e) {
567
+			return "error (update schema_version) : ".$e->getMessage()."\n";
568
+			}
569 569
 		return $error;
570 570
 	}
571 571
 
572 572
 	private static function update_from_17() {
573
-    		$Connection = new Connection();
573
+			$Connection = new Connection();
574 574
 		$error = '';
575
-    		// Add tables
575
+			// Add tables
576 576
 		$error .= create_db::import_file('../db/stats_country.sql');
577 577
 		if ($error != '') return $error;
578 578
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
579
-        	try {
580
-            	    $sth = $Connection->db->prepare($query);
581
-		    $sth->execute();
582
-    		} catch(PDOException $e) {
583
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
584
-    		}
579
+			try {
580
+					$sth = $Connection->db->prepare($query);
581
+			$sth->execute();
582
+			} catch(PDOException $e) {
583
+			return "error (update schema_version) : ".$e->getMessage()."\n";
584
+			}
585 585
 		return $error;
586 586
 	}
587 587
 	private static function update_from_18() {
588
-    		$Connection = new Connection();
588
+			$Connection = new Connection();
589 589
 		$error = '';
590
-    		// Modify stats_airport table
591
-    		$query = "ALTER TABLE `stats_airport` ADD `type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
592
-        	try {
593
-            	    $sth = $Connection->db->prepare($query);
594
-		    $sth->execute();
595
-    		} catch(PDOException $e) {
596
-		    return "error (update stats) : ".$e->getMessage()."\n";
597
-    		}
590
+			// Modify stats_airport table
591
+			$query = "ALTER TABLE `stats_airport` ADD `type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
592
+			try {
593
+					$sth = $Connection->db->prepare($query);
594
+			$sth->execute();
595
+			} catch(PDOException $e) {
596
+			return "error (update stats) : ".$e->getMessage()."\n";
597
+			}
598 598
 		if ($error != '') return $error;
599 599
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
600
-        	try {
601
-            	    $sth = $Connection->db->prepare($query);
602
-		    $sth->execute();
603
-    		} catch(PDOException $e) {
604
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
605
-    		}
600
+			try {
601
+					$sth = $Connection->db->prepare($query);
602
+			$sth->execute();
603
+			} catch(PDOException $e) {
604
+			return "error (update schema_version) : ".$e->getMessage()."\n";
605
+			}
606 606
 		return $error;
607 607
 	}
608 608
 
609 609
 	private static function update_from_19() {
610
-    		$Connection = new Connection();
610
+			$Connection = new Connection();
611 611
 		$error = '';
612
-    		// Update airport table
612
+			// Update airport table
613 613
 		$error .= create_db::import_file('../db/airport.sql');
614 614
 		if ($error != '') return 'Import airport.sql : '.$error;
615 615
 		// Remove primary key on Spotter_Archive
616 616
 		$query = "alter table spotter_archive drop spotter_archive_id";
617
-        	try {
618
-            	    $sth = $Connection->db->prepare($query);
619
-		    $sth->execute();
620
-    		} catch(PDOException $e) {
621
-		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
622
-    		}
617
+			try {
618
+					$sth = $Connection->db->prepare($query);
619
+			$sth->execute();
620
+			} catch(PDOException $e) {
621
+			return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
622
+			}
623 623
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
624
-        	try {
625
-            	    $sth = $Connection->db->prepare($query);
626
-		    $sth->execute();
627
-    		} catch(PDOException $e) {
628
-		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
629
-    		}
624
+			try {
625
+					$sth = $Connection->db->prepare($query);
626
+			$sth->execute();
627
+			} catch(PDOException $e) {
628
+			return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
629
+			}
630 630
 
631
-    		// Add column over_country
632
-    		$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL;ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL;";
633
-        	try {
634
-            	    $sth = $Connection->db->prepare($query);
635
-		    $sth->execute();
636
-    		} catch(PDOException $e) {
637
-		    return "error (add over_country) : ".$e->getMessage()."\n";
638
-    		}
639
-    		// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
640
-    		$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
641
-        	try {
642
-            	    $sth = $Connection->db->prepare($query);
643
-		    $sth->execute();
644
-    		} catch(PDOException $e) {
645
-		    return "error (add source_name column) : ".$e->getMessage()."\n";
646
-    		}
631
+			// Add column over_country
632
+			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL;ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL;";
633
+			try {
634
+					$sth = $Connection->db->prepare($query);
635
+			$sth->execute();
636
+			} catch(PDOException $e) {
637
+			return "error (add over_country) : ".$e->getMessage()."\n";
638
+			}
639
+			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
640
+			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
641
+			try {
642
+					$sth = $Connection->db->prepare($query);
643
+			$sth->execute();
644
+			} catch(PDOException $e) {
645
+			return "error (add source_name column) : ".$e->getMessage()."\n";
646
+			}
647 647
 		if ($error != '') return $error;
648 648
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
649
-        	try {
650
-            	    $sth = $Connection->db->prepare($query);
651
-		    $sth->execute();
652
-    		} catch(PDOException $e) {
653
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
654
-    		}
649
+			try {
650
+					$sth = $Connection->db->prepare($query);
651
+			$sth->execute();
652
+			} catch(PDOException $e) {
653
+			return "error (update schema_version) : ".$e->getMessage()."\n";
654
+			}
655 655
 		return $error;
656 656
 	}
657 657
 
658 658
 	private static function update_from_20() {
659 659
 		global $globalIVAO, $globalVATSIM, $globalphpVMS;
660
-    		$Connection = new Connection();
660
+			$Connection = new Connection();
661 661
 		$error = '';
662
-    		// Update airline table
663
-    		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
662
+			// Update airline table
663
+			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
664 664
 			$error .= create_db::import_file('../db/airlines.sql');
665 665
 			if ($error != '') return 'Import airlinesport.sql : '.$error;
666 666
 		}
667
-    		// Add column over_country
668
-    		$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
669
-        	try {
670
-            	    $sth = $Connection->db->prepare($query);
671
-		    $sth->execute();
672
-    		} catch(PDOException $e) {
673
-		    return "error (add over_country) : ".$e->getMessage()."\n";
674
-    		}
667
+			// Add column over_country
668
+			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
669
+			try {
670
+					$sth = $Connection->db->prepare($query);
671
+			$sth->execute();
672
+			} catch(PDOException $e) {
673
+			return "error (add over_country) : ".$e->getMessage()."\n";
674
+			}
675 675
 		if ($error != '') return $error;
676 676
 		/*
677 677
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
@@ -681,40 +681,40 @@  discard block
 block discarded – undo
681 681
 		}
682 682
 		*/
683 683
 		$query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'";
684
-        	try {
685
-            	    $sth = $Connection->db->prepare($query);
686
-		    $sth->execute();
687
-    		} catch(PDOException $e) {
688
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
689
-    		}
684
+			try {
685
+					$sth = $Connection->db->prepare($query);
686
+			$sth->execute();
687
+			} catch(PDOException $e) {
688
+			return "error (update schema_version) : ".$e->getMessage()."\n";
689
+			}
690 690
 		return $error;
691 691
 	}
692 692
 
693 693
 	private static function update_from_21() {
694
-    		$Connection = new Connection();
694
+			$Connection = new Connection();
695 695
 		$error = '';
696 696
 		// Rename type to stats_type
697 697
 		$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
698
-        	try {
699
-            	    $sth = $Connection->db->prepare($query);
700
-		    $sth->execute();
701
-    		} catch(PDOException $e) {
702
-		    return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
703
-    		}
698
+			try {
699
+					$sth = $Connection->db->prepare($query);
700
+			$sth->execute();
701
+			} catch(PDOException $e) {
702
+			return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
703
+			}
704 704
 		if ($error != '') return $error;
705 705
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
706
-        	try {
707
-            	    $sth = $Connection->db->prepare($query);
708
-		    $sth->execute();
709
-    		} catch(PDOException $e) {
710
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
711
-    		}
706
+			try {
707
+					$sth = $Connection->db->prepare($query);
708
+			$sth->execute();
709
+			} catch(PDOException $e) {
710
+			return "error (update schema_version) : ".$e->getMessage()."\n";
711
+			}
712 712
 		return $error;
713 713
 	}
714 714
 
715 715
 	private static function update_from_22() {
716 716
 		global $globalDBdriver;
717
-    		$Connection = new Connection();
717
+			$Connection = new Connection();
718 718
 		$error = '';
719 719
 		// Add table stats polar
720 720
 		if ($globalDBdriver == 'mysql') {
@@ -724,19 +724,19 @@  discard block
 block discarded – undo
724 724
 		}
725 725
 		if ($error != '') return $error;
726 726
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
727
-        	try {
728
-            	    $sth = $Connection->db->prepare($query);
729
-		    $sth->execute();
730
-    		} catch(PDOException $e) {
731
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
732
-    		}
727
+			try {
728
+					$sth = $Connection->db->prepare($query);
729
+			$sth->execute();
730
+			} catch(PDOException $e) {
731
+			return "error (update schema_version) : ".$e->getMessage()."\n";
732
+			}
733 733
 		return $error;
734 734
 	}
735 735
 
736 736
 
737 737
 	private static function update_from_23() {
738 738
 		global $globalDBdriver;
739
-    		$Connection = new Connection();
739
+			$Connection = new Connection();
740 740
 		$error = '';
741 741
 		// Add table stats polar
742 742
 		if ($globalDBdriver == 'mysql') {
@@ -744,15 +744,15 @@  discard block
 block discarded – undo
744 744
 		} else {
745 745
 			//$error .= create_db::import_file('../db/pgsql/stats_source.sql');
746 746
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
747
-        		try {
748
-		    		$sth = $Connection->db->prepare($query);
747
+				try {
748
+					$sth = $Connection->db->prepare($query);
749 749
 				$sth->execute();
750 750
 			} catch(PDOException $e) {
751 751
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
752 752
 			}
753 753
 		}
754
-    		$query = "";
755
-        	try {
754
+			$query = "";
755
+			try {
756 756
 			$sth = $Connection->db->prepare($query);
757 757
 			$sth->execute();
758 758
 		} catch(PDOException $e) {
@@ -761,128 +761,128 @@  discard block
 block discarded – undo
761 761
 
762 762
 		if ($error != '') return $error;
763 763
 		$query = "UPDATE config SET value = '24' WHERE name = 'schema_version'";
764
-        	try {
765
-            	    $sth = $Connection->db->prepare($query);
766
-		    $sth->execute();
767
-    		} catch(PDOException $e) {
768
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
769
-    		}
764
+			try {
765
+					$sth = $Connection->db->prepare($query);
766
+			$sth->execute();
767
+			} catch(PDOException $e) {
768
+			return "error (update schema_version) : ".$e->getMessage()."\n";
769
+			}
770 770
 		return $error;
771 771
 	}
772 772
 
773 773
 
774 774
 
775
-    	public static function check_version($update = false) {
776
-    	    global $globalDBname;
777
-    	    $version = 0;
778
-    	    $Connection = new Connection();
779
-    	    if ($Connection->tableExists('aircraft')) {
780
-    		if (!$Connection->tableExists('config')) {
781
-    		    $version = '1';
782
-    		    if ($update) return self::update_from_1();
783
-    		    else return $version;
775
+		public static function check_version($update = false) {
776
+			global $globalDBname;
777
+			$version = 0;
778
+			$Connection = new Connection();
779
+			if ($Connection->tableExists('aircraft')) {
780
+			if (!$Connection->tableExists('config')) {
781
+				$version = '1';
782
+				if ($update) return self::update_from_1();
783
+				else return $version;
784 784
 		} else {
785
-    		    $Connection = new Connection();
786
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
787
-		    try {
788
-            		$sth = $Connection->db->prepare($query);
789
-		        $sth->execute();
790
-		    } catch(PDOException $e) {
785
+				$Connection = new Connection();
786
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
787
+			try {
788
+					$sth = $Connection->db->prepare($query);
789
+				$sth->execute();
790
+			} catch(PDOException $e) {
791 791
 			return "error : ".$e->getMessage()."\n";
792
-    		    }
793
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
794
-    		    if ($update) {
795
-    			if ($result['value'] == '2') {
796
-    			    $error = self::update_from_2();
797
-    			    if ($error != '') return $error;
798
-    			    else return self::check_version(true);
799
-    			} elseif ($result['value'] == '3') {
800
-    			    $error = self::update_from_3();
801
-    			    if ($error != '') return $error;
802
-    			    else return self::check_version(true);
803
-    			} elseif ($result['value'] == '4') {
804
-    			    $error = self::update_from_4();
805
-    			    if ($error != '') return $error;
806
-    			    else return self::check_version(true);
807
-    			} elseif ($result['value'] == '5') {
808
-    			    $error = self::update_from_5();
809
-    			    if ($error != '') return $error;
810
-    			    else return self::check_version(true);
811
-    			} elseif ($result['value'] == '6') {
812
-    			    $error = self::update_from_6();
813
-    			    if ($error != '') return $error;
814
-    			    else return self::check_version(true);
815
-    			} elseif ($result['value'] == '7') {
816
-    			    $error = self::update_from_7();
817
-    			    if ($error != '') return $error;
818
-    			    else return self::check_version(true);
819
-    			} elseif ($result['value'] == '8') {
820
-    			    $error = self::update_from_8();
821
-    			    if ($error != '') return $error;
822
-    			    else return self::check_version(true);
823
-    			} elseif ($result['value'] == '9') {
824
-    			    $error = self::update_from_9();
825
-    			    if ($error != '') return $error;
826
-    			    else return self::check_version(true);
827
-    			} elseif ($result['value'] == '10') {
828
-    			    $error = self::update_from_10();
829
-    			    if ($error != '') return $error;
830
-    			    else return self::check_version(true);
831
-    			} elseif ($result['value'] == '11') {
832
-    			    $error = self::update_from_11();
833
-    			    if ($error != '') return $error;
834
-    			    else return self::check_version(true);
835
-    			} elseif ($result['value'] == '12') {
836
-    			    $error = self::update_from_12();
837
-    			    if ($error != '') return $error;
838
-    			    else return self::check_version(true);
839
-    			} elseif ($result['value'] == '13') {
840
-    			    $error = self::update_from_13();
841
-    			    if ($error != '') return $error;
842
-    			    else return self::check_version(true);
843
-    			} elseif ($result['value'] == '14') {
844
-    			    $error = self::update_from_14();
845
-    			    if ($error != '') return $error;
846
-    			    else return self::check_version(true);
847
-    			} elseif ($result['value'] == '15') {
848
-    			    $error = self::update_from_15();
849
-    			    if ($error != '') return $error;
850
-    			    else return self::check_version(true);
851
-    			} elseif ($result['value'] == '16') {
852
-    			    $error = self::update_from_16();
853
-    			    if ($error != '') return $error;
854
-    			    else return self::check_version(true);
855
-    			} elseif ($result['value'] == '17') {
856
-    			    $error = self::update_from_17();
857
-    			    if ($error != '') return $error;
858
-    			    else return self::check_version(true);
859
-    			} elseif ($result['value'] == '18') {
860
-    			    $error = self::update_from_18();
861
-    			    if ($error != '') return $error;
862
-    			    else return self::check_version(true);
863
-    			} elseif ($result['value'] == '19') {
864
-    			    $error = self::update_from_19();
865
-    			    if ($error != '') return $error;
866
-    			    else return self::check_version(true);
867
-    			} elseif ($result['value'] == '20') {
868
-    			    $error = self::update_from_20();
869
-    			    if ($error != '') return $error;
870
-    			    else return self::check_version(true);
871
-    			} elseif ($result['value'] == '21') {
872
-    			    $error = self::update_from_21();
873
-    			    if ($error != '') return $error;
874
-    			    else return self::check_version(true);
875
-    			} elseif ($result['value'] == '22') {
876
-    			    $error = self::update_from_22();
877
-    			    if ($error != '') return $error;
878
-    			    else return self::check_version(true);
879
-    			} else return '';
880
-    		    }
881
-    		    else return $result['value'];
792
+				}
793
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
794
+				if ($update) {
795
+				if ($result['value'] == '2') {
796
+					$error = self::update_from_2();
797
+					if ($error != '') return $error;
798
+					else return self::check_version(true);
799
+				} elseif ($result['value'] == '3') {
800
+					$error = self::update_from_3();
801
+					if ($error != '') return $error;
802
+					else return self::check_version(true);
803
+				} elseif ($result['value'] == '4') {
804
+					$error = self::update_from_4();
805
+					if ($error != '') return $error;
806
+					else return self::check_version(true);
807
+				} elseif ($result['value'] == '5') {
808
+					$error = self::update_from_5();
809
+					if ($error != '') return $error;
810
+					else return self::check_version(true);
811
+				} elseif ($result['value'] == '6') {
812
+					$error = self::update_from_6();
813
+					if ($error != '') return $error;
814
+					else return self::check_version(true);
815
+				} elseif ($result['value'] == '7') {
816
+					$error = self::update_from_7();
817
+					if ($error != '') return $error;
818
+					else return self::check_version(true);
819
+				} elseif ($result['value'] == '8') {
820
+					$error = self::update_from_8();
821
+					if ($error != '') return $error;
822
+					else return self::check_version(true);
823
+				} elseif ($result['value'] == '9') {
824
+					$error = self::update_from_9();
825
+					if ($error != '') return $error;
826
+					else return self::check_version(true);
827
+				} elseif ($result['value'] == '10') {
828
+					$error = self::update_from_10();
829
+					if ($error != '') return $error;
830
+					else return self::check_version(true);
831
+				} elseif ($result['value'] == '11') {
832
+					$error = self::update_from_11();
833
+					if ($error != '') return $error;
834
+					else return self::check_version(true);
835
+				} elseif ($result['value'] == '12') {
836
+					$error = self::update_from_12();
837
+					if ($error != '') return $error;
838
+					else return self::check_version(true);
839
+				} elseif ($result['value'] == '13') {
840
+					$error = self::update_from_13();
841
+					if ($error != '') return $error;
842
+					else return self::check_version(true);
843
+				} elseif ($result['value'] == '14') {
844
+					$error = self::update_from_14();
845
+					if ($error != '') return $error;
846
+					else return self::check_version(true);
847
+				} elseif ($result['value'] == '15') {
848
+					$error = self::update_from_15();
849
+					if ($error != '') return $error;
850
+					else return self::check_version(true);
851
+				} elseif ($result['value'] == '16') {
852
+					$error = self::update_from_16();
853
+					if ($error != '') return $error;
854
+					else return self::check_version(true);
855
+				} elseif ($result['value'] == '17') {
856
+					$error = self::update_from_17();
857
+					if ($error != '') return $error;
858
+					else return self::check_version(true);
859
+				} elseif ($result['value'] == '18') {
860
+					$error = self::update_from_18();
861
+					if ($error != '') return $error;
862
+					else return self::check_version(true);
863
+				} elseif ($result['value'] == '19') {
864
+					$error = self::update_from_19();
865
+					if ($error != '') return $error;
866
+					else return self::check_version(true);
867
+				} elseif ($result['value'] == '20') {
868
+					$error = self::update_from_20();
869
+					if ($error != '') return $error;
870
+					else return self::check_version(true);
871
+				} elseif ($result['value'] == '21') {
872
+					$error = self::update_from_21();
873
+					if ($error != '') return $error;
874
+					else return self::check_version(true);
875
+				} elseif ($result['value'] == '22') {
876
+					$error = self::update_from_22();
877
+					if ($error != '') return $error;
878
+					else return self::check_version(true);
879
+				} else return '';
880
+				}
881
+				else return $result['value'];
882 882
 		}
883 883
 		
884
-	    } else return $version;
885
-    	}
884
+		} else return $version;
885
+		}
886 886
     	
887 887
 }
888 888
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection−>indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection− > indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -409,18 +409,18 @@  discard block
 block discarded – undo
409 409
 
410 410
 	private static function update_from_11() {
411 411
     		$Connection = new Connection();
412
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
412
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413 413
         	try {
414 414
             	    $sth = $Connection->db->prepare($query);
415 415
 		    $sth->execute();
416
-    		} catch(PDOException $e) {
416
+    		} catch (PDOException $e) {
417 417
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
418 418
     		}
419
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
419
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420 420
         	try {
421 421
             	    $sth = $Connection->db->prepare($query);
422 422
 		    $sth->execute();
423
-    		} catch(PDOException $e) {
423
+    		} catch (PDOException $e) {
424 424
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
425 425
     		}
426 426
     		if ($globalDBdriver == 'mysql') {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 		    try {
429 429
             		$sth = $Connection->db->prepare($query);
430 430
 			$sth->execute();
431
-    		    } catch(PDOException $e) {
431
+    		    } catch (PDOException $e) {
432 432
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
433 433
     		    }
434 434
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
 				DROP TABLE spotter_archive;
441 441
 				RENAME TABLE copy TO spotter_archive;";
442 442
             	    } else {
443
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
443
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444 444
             	    }
445 445
                 } else {
446
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
446
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447 447
                 }
448 448
         	try {
449 449
             	    $sth = $Connection->db->prepare($query);
450 450
 		    $sth->execute();
451
-    		} catch(PDOException $e) {
451
+    		} catch (PDOException $e) {
452 452
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
453 453
     		}
454 454
 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         	try {
459 459
             	    $sth = $Connection->db->prepare($query);
460 460
 		    $sth->execute();
461
-    		} catch(PDOException $e) {
461
+    		} catch (PDOException $e) {
462 462
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
463 463
     		}
464 464
 		return $error;
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         	try {
487 487
             	    $sth = $Connection->db->prepare($query);
488 488
 		    $sth->execute();
489
-    		} catch(PDOException $e) {
489
+    		} catch (PDOException $e) {
490 490
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
491 491
     		}
492 492
 		return $error;
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
 
495 495
 	private static function update_from_13() {
496 496
     		$Connection = new Connection();
497
-    		$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
497
+    		$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498 498
         	try {
499 499
             	    $sth = $Connection->db->prepare($query);
500 500
 		    $sth->execute();
501
-    		} catch(PDOException $e) {
501
+    		} catch (PDOException $e) {
502 502
 		    return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
503 503
     		}
504 504
 	
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
         	try {
508 508
             	    $sth = $Connection->db->prepare($query);
509 509
 		    $sth->execute();
510
-    		} catch(PDOException $e) {
510
+    		} catch (PDOException $e) {
511 511
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
512 512
     		}
513 513
 		return $error;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
         	try {
524 524
             	    $sth = $Connection->db->prepare($query);
525 525
 		    $sth->execute();
526
-    		} catch(PDOException $e) {
526
+    		} catch (PDOException $e) {
527 527
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
528 528
     		}
529 529
 		return $error;
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
     		$Connection = new Connection();
535 535
 		$error = '';
536 536
     		// Add tables
537
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
537
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
538 538
         	try {
539 539
             	    $sth = $Connection->db->prepare($query);
540 540
 		    $sth->execute();
541
-    		} catch(PDOException $e) {
541
+    		} catch (PDOException $e) {
542 542
 		    return "error (update stats) : ".$e->getMessage()."\n";
543 543
     		}
544 544
 		if ($error != '') return $error;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
         	try {
547 547
             	    $sth = $Connection->db->prepare($query);
548 548
 		    $sth->execute();
549
-    		} catch(PDOException $e) {
549
+    		} catch (PDOException $e) {
550 550
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
551 551
     		}
552 552
 		return $error;
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
         	try {
564 564
             	    $sth = $Connection->db->prepare($query);
565 565
 		    $sth->execute();
566
-    		} catch(PDOException $e) {
566
+    		} catch (PDOException $e) {
567 567
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
568 568
     		}
569 569
 		return $error;
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
         	try {
580 580
             	    $sth = $Connection->db->prepare($query);
581 581
 		    $sth->execute();
582
-    		} catch(PDOException $e) {
582
+    		} catch (PDOException $e) {
583 583
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
584 584
     		}
585 585
 		return $error;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
         	try {
593 593
             	    $sth = $Connection->db->prepare($query);
594 594
 		    $sth->execute();
595
-    		} catch(PDOException $e) {
595
+    		} catch (PDOException $e) {
596 596
 		    return "error (update stats) : ".$e->getMessage()."\n";
597 597
     		}
598 598
 		if ($error != '') return $error;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         	try {
601 601
             	    $sth = $Connection->db->prepare($query);
602 602
 		    $sth->execute();
603
-    		} catch(PDOException $e) {
603
+    		} catch (PDOException $e) {
604 604
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
605 605
     		}
606 606
 		return $error;
@@ -617,14 +617,14 @@  discard block
 block discarded – undo
617 617
         	try {
618 618
             	    $sth = $Connection->db->prepare($query);
619 619
 		    $sth->execute();
620
-    		} catch(PDOException $e) {
620
+    		} catch (PDOException $e) {
621 621
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
622 622
     		}
623 623
 		$query = "alter table spotter_archive add spotter_archive_id INT(11)";
624 624
         	try {
625 625
             	    $sth = $Connection->db->prepare($query);
626 626
 		    $sth->execute();
627
-    		} catch(PDOException $e) {
627
+    		} catch (PDOException $e) {
628 628
 		    return "error (add id again on spotter_archive) : ".$e->getMessage()."\n";
629 629
     		}
630 630
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
         	try {
634 634
             	    $sth = $Connection->db->prepare($query);
635 635
 		    $sth->execute();
636
-    		} catch(PDOException $e) {
636
+    		} catch (PDOException $e) {
637 637
 		    return "error (add over_country) : ".$e->getMessage()."\n";
638 638
     		}
639 639
     		// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
         	try {
642 642
             	    $sth = $Connection->db->prepare($query);
643 643
 		    $sth->execute();
644
-    		} catch(PDOException $e) {
644
+    		} catch (PDOException $e) {
645 645
 		    return "error (add source_name column) : ".$e->getMessage()."\n";
646 646
     		}
647 647
 		if ($error != '') return $error;
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
         	try {
650 650
             	    $sth = $Connection->db->prepare($query);
651 651
 		    $sth->execute();
652
-    		} catch(PDOException $e) {
652
+    		} catch (PDOException $e) {
653 653
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
654 654
     		}
655 655
 		return $error;
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
         	try {
670 670
             	    $sth = $Connection->db->prepare($query);
671 671
 		    $sth->execute();
672
-    		} catch(PDOException $e) {
672
+    		} catch (PDOException $e) {
673 673
 		    return "error (add over_country) : ".$e->getMessage()."\n";
674 674
     		}
675 675
 		if ($error != '') return $error;
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
         	try {
685 685
             	    $sth = $Connection->db->prepare($query);
686 686
 		    $sth->execute();
687
-    		} catch(PDOException $e) {
687
+    		} catch (PDOException $e) {
688 688
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
689 689
     		}
690 690
 		return $error;
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
         	try {
699 699
             	    $sth = $Connection->db->prepare($query);
700 700
 		    $sth->execute();
701
-    		} catch(PDOException $e) {
701
+    		} catch (PDOException $e) {
702 702
 		    return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
703 703
     		}
704 704
 		if ($error != '') return $error;
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
         	try {
707 707
             	    $sth = $Connection->db->prepare($query);
708 708
 		    $sth->execute();
709
-    		} catch(PDOException $e) {
709
+    		} catch (PDOException $e) {
710 710
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
711 711
     		}
712 712
 		return $error;
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
         	try {
728 728
             	    $sth = $Connection->db->prepare($query);
729 729
 		    $sth->execute();
730
-    		} catch(PDOException $e) {
730
+    		} catch (PDOException $e) {
731 731
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
732 732
     		}
733 733
 		return $error;
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
         		try {
748 748
 		    		$sth = $Connection->db->prepare($query);
749 749
 				$sth->execute();
750
-			} catch(PDOException $e) {
750
+			} catch (PDOException $e) {
751 751
 				return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
752 752
 			}
753 753
 		}
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         	try {
756 756
 			$sth = $Connection->db->prepare($query);
757 757
 			$sth->execute();
758
-		} catch(PDOException $e) {
758
+		} catch (PDOException $e) {
759 759
 			return "error (create index on spotter_archive) : ".$e->getMessage()."\n";
760 760
 		}
761 761
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
         	try {
765 765
             	    $sth = $Connection->db->prepare($query);
766 766
 		    $sth->execute();
767
-    		} catch(PDOException $e) {
767
+    		} catch (PDOException $e) {
768 768
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
769 769
     		}
770 770
 		return $error;
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 		    try {
788 788
             		$sth = $Connection->db->prepare($query);
789 789
 		        $sth->execute();
790
-		    } catch(PDOException $e) {
790
+		    } catch (PDOException $e) {
791 791
 			return "error : ".$e->getMessage()."\n";
792 792
     		    }
793 793
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.