Conditions | 4 |
Paths | 8 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | 6 | protected function disableInnoDbStats() |
|
28 | { |
||
29 | 6 | $sql = "show global variables like 'innodb_stats_on_metadata'"; |
|
30 | try { |
||
31 | 6 | $results = $this->adapter->query($sql); |
|
32 | 6 | if (count($results) > 0) { |
|
33 | 6 | $row = $results->offsetGet(0); |
|
34 | |||
35 | 6 | $value = strtoupper($row['Value']); |
|
36 | // if 'on' no need to do anything |
||
37 | 6 | if ($value != 'OFF') { |
|
38 | 6 | $this->mysql_innodbstats_value = $value; |
|
39 | // disabling innodb_stats |
||
40 | 6 | $this->adapter->execute("set global innodb_stats_on_metadata='OFF'"); |
|
41 | 6 | } |
|
42 | 6 | } |
|
43 | 6 | } catch (\Exception $e) { |
|
44 | // do nothing, silently fallback |
||
45 | } |
||
46 | 6 | } |
|
47 | |||
62 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: