@@ -86,19 +86,19 @@ discard block |
||
| 86 | 86 | exit; |
| 87 | 87 | } |
| 88 | 88 | if ($this->connectionAttempt >= $this->maxConnectErrors) { |
| 89 | - $this->halt("connect($host, $user, \$password) failed. ".(is_object($this->linkId) && isset( $this->linkId->connect_error) ? $this->linkId->connect_error : '')); |
|
| 89 | + $this->halt("connect($host, $user, \$password) failed. ".(is_object($this->linkId) && isset($this->linkId->connect_error) ? $this->linkId->connect_error : '')); |
|
| 90 | 90 | return 0; |
| 91 | 91 | } |
| 92 | 92 | //error_log("real_connect($host, $user, $password, $database, $port)"); |
| 93 | 93 | $this->linkId = mysqli_init(); |
| 94 | 94 | $this->linkId->options(MYSQLI_INIT_COMMAND, "SET NAMES {$this->characterSet} COLLATE {$this->collation}, COLLATION_CONNECTION = {$this->collation}, COLLATION_DATABASE = {$this->collation}"); |
| 95 | 95 | if (!$this->linkId->real_connect($host, $user, $password, $database, $port != '' ? $port : NULL)) { |
| 96 | - $this->halt("connect($host, $user, \$password) failed. ".(is_object($this->linkId) && isset( $this->linkId->connect_error) ? $this->linkId->connect_error : '')); |
|
| 96 | + $this->halt("connect($host, $user, \$password) failed. ".(is_object($this->linkId) && isset($this->linkId->connect_error) ? $this->linkId->connect_error : '')); |
|
| 97 | 97 | return 0; |
| 98 | 98 | } |
| 99 | 99 | $this->linkId->set_charset($this->characterSet); |
| 100 | 100 | if ($this->linkId->connect_errno) { |
| 101 | - $this->halt("connect($host, $user, \$password) failed. ".(is_object($this->linkId) && isset( $this->linkId->connect_error) ? $this->linkId->connect_error : '')); |
|
| 101 | + $this->halt("connect($host, $user, \$password) failed. ".(is_object($this->linkId) && isset($this->linkId->connect_error) ? $this->linkId->connect_error : '')); |
|
| 102 | 102 | return 0; |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $return = mysqli_stmt_execute($this->statement); |
| 234 | 234 | if (!isset($GLOBALS['disable_db_queries'])) { |
| 235 | 235 | $vars = $this->statement_vars; |
| 236 | - $query = $result = preg_replace_callback('/\?/', function () use (&$vars) { |
|
| 236 | + $query = $result = preg_replace_callback('/\?/', function() use (&$vars) { |
|
| 237 | 237 | return array_shift($vars); |
| 238 | 238 | }, $this->statement_query); |
| 239 | 239 | $this->addLog($query, microtime(true) - $start, $line, $file); |
@@ -295,24 +295,24 @@ discard block |
||
| 295 | 295 | $fails++; |
| 296 | 296 | try { |
| 297 | 297 | $this->queryId = @mysqli_query($this->linkId, $queryString, MYSQLI_STORE_RESULT); |
| 298 | - if (in_array((int)@mysqli_errno($this->linkId), [1213, 2006, 3101, 1180])) { |
|
| 298 | + if (in_array((int) @mysqli_errno($this->linkId), [1213, 2006, 3101, 1180])) { |
|
| 299 | 299 | //error_log("got ".@mysqli_errno($this->linkId)." sql error fails {$fails} on query {$queryString} from {$line}:{$file}"); |
| 300 | 300 | usleep(250000); // 0.25 second |
| 301 | 301 | } else { |
| 302 | 302 | $onlyRollback = false; |
| 303 | - if (in_array((int)@mysqli_errno($this->linkId), [1064])) { |
|
| 303 | + if (in_array((int) @mysqli_errno($this->linkId), [1064])) { |
|
| 304 | 304 | $tries = 0; |
| 305 | 305 | } |
| 306 | 306 | break; |
| 307 | 307 | } |
| 308 | 308 | } catch (\mysqli_sql_exception $e) { |
| 309 | - if (in_array((int)$e->getCode(), [1213, 2006, 3101, 1180])) { |
|
| 309 | + if (in_array((int) $e->getCode(), [1213, 2006, 3101, 1180])) { |
|
| 310 | 310 | //error_log("got ".$e->getCode()." sql error fails {$fails}"); |
| 311 | 311 | usleep(250000); // 0.25 second |
| 312 | 312 | } else { |
| 313 | 313 | error_log('Got mysqli_sql_exception code '.$e->getCode().' error '.$e->getMessage().' on query '.$queryString.' from '.$line.':'.$file); |
| 314 | 314 | $onlyRollback = false; |
| 315 | - if (in_array((int)@mysqli_errno($this->linkId), [1064])) { |
|
| 315 | + if (in_array((int) @mysqli_errno($this->linkId), [1064])) { |
|
| 316 | 316 | $tries = 0; |
| 317 | 317 | } |
| 318 | 318 | break; |