@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | public $latest_schema = 23; |
8 | 8 | |
9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
10 | - global $globalDBdriver; |
|
11 | - if ($dbc === null) { |
|
10 | + global $globalDBdriver; |
|
11 | + if ($dbc === null) { |
|
12 | 12 | if ($this->db === null && $dbname === null) { |
13 | - if ($user === null && $pass === null) { |
|
13 | + if ($user === null && $pass === null) { |
|
14 | 14 | $this->createDBConnection(); |
15 | - } else { |
|
15 | + } else { |
|
16 | 16 | $this->createDBConnection(null,$user,$pass); |
17 | - } |
|
17 | + } |
|
18 | 18 | } else { |
19 | - $this->createDBConnection($dbname); |
|
19 | + $this->createDBConnection($dbname); |
|
20 | 20 | } |
21 | - } elseif ($dbname === null || $dbname === 'default') { |
|
21 | + } elseif ($dbname === null || $dbname === 'default') { |
|
22 | 22 | $this->db = $dbc; |
23 | 23 | if ($this->connectionExists() === false) { |
24 | 24 | /* |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | */ |
29 | 29 | $this->createDBConnection(); |
30 | 30 | } |
31 | - } else { |
|
31 | + } else { |
|
32 | 32 | //$this->connectionExists(); |
33 | 33 | $this->dbs[$dbname] = $dbc; |
34 | - } |
|
34 | + } |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
39 | - * Creates the database connection |
|
40 | - * |
|
41 | - * @return Boolean of the database connection |
|
42 | - * |
|
43 | - */ |
|
39 | + * Creates the database connection |
|
40 | + * |
|
41 | + * @return Boolean of the database connection |
|
42 | + * |
|
43 | + */ |
|
44 | 44 | |
45 | 45 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
46 | 46 | { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return false; |
134 | 134 | } |
135 | 135 | if($results->rowCount()>0) { |
136 | - return true; |
|
136 | + return true; |
|
137 | 137 | } |
138 | 138 | else return false; |
139 | 139 | } |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | $sum = $sum->fetchColumn(0); |
151 | 151 | } else $sum = 0; |
152 | 152 | if (intval($sum) !== 2) { |
153 | - return false; |
|
153 | + return false; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | } catch(PDOException $e) { |
157 | 157 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
158 | - throw $e; |
|
159 | - } |
|
160 | - //echo 'error ! '.$e->getMessage(); |
|
158 | + throw $e; |
|
159 | + } |
|
160 | + //echo 'error ! '.$e->getMessage(); |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | return true; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | return false; |
182 | 182 | } |
183 | 183 | if($results->rowCount()>0) { |
184 | - return true; |
|
184 | + return true; |
|
185 | 185 | } |
186 | 186 | else return false; |
187 | 187 | } |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | $version = 0; |
236 | 236 | if ($this->tableExists('aircraft')) { |
237 | 237 | if (!$this->tableExists('config')) { |
238 | - $version = '1'; |
|
239 | - return $version; |
|
238 | + $version = '1'; |
|
239 | + return $version; |
|
240 | 240 | } else { |
241 | 241 | $Connection = new Connection(); |
242 | 242 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | * @return Boolean if latest version or not |
258 | 258 | */ |
259 | 259 | public function latest() { |
260 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
261 | - else return false; |
|
260 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
261 | + else return false; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | } |