| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 36 | protected function isDBReady() |
||
| 37 | { |
||
| 38 | if (!DB::isActive()) { |
||
| 39 | return false; |
||
| 40 | } |
||
| 41 | |||
| 42 | // Require table |
||
| 43 | if (!DB::getConn()->hasTable('SiteConfig')) { |
||
| 44 | return false; |
||
| 45 | } |
||
| 46 | |||
| 47 | // Ensure siteconfig has all fields necessary |
||
| 48 | $dbFields = DB::fieldList('SiteConfig'); |
||
| 49 | if (empty($dbFields)) { |
||
| 50 | return false; |
||
| 51 | } |
||
| 52 | |||
| 53 | // Ensure that SiteConfig has all fields |
||
| 54 | $objFields = DataObject::database_fields('SiteConfig', false); |
||
| 55 | $missingFields = array_diff_key($objFields, $dbFields); |
||
| 56 | return empty($missingFields); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.