| Conditions | 3 |
| Paths | 3 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | private function _sanitizeVersionsInTable(string $table): int |
||
| 32 | { |
||
| 33 | $sql = 'SELECT `id`, `pma_version` FROM `' . $table . '`'; |
||
| 34 | $count = 0; |
||
| 35 | $incidentsTable = TableRegistry::getTableLocator()->get('Incidents'); |
||
| 36 | $result = $this->query($sql); |
||
| 37 | |||
| 38 | while ($row = $result->fetch()) { |
||
| 39 | $strippedVersionString |
||
| 40 | = IncidentsTable::getStrippedPmaVersion( |
||
| 41 | $row['pma_version'] |
||
| 42 | ); |
||
| 43 | |||
| 44 | if ($strippedVersionString === $row['pma_version']) { |
||
| 45 | continue; |
||
| 46 | } |
||
| 47 | |||
| 48 | $this->execute('UPDATE ' . $table . ' SET `pma_version` = \'' |
||
| 49 | . $strippedVersionString . '\' WHERE `id` = \'' |
||
| 50 | . $row['id'] . '\''); |
||
| 51 | |||
| 52 | ++$count; |
||
| 53 | } |
||
| 54 | |||
| 55 | return $count; |
||
| 56 | } |
||
| 58 |