| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | private function isUnattendedUpgradesEnabled(): bool |
||
| 26 | { |
||
| 27 | $configFile = '/etc/apt/apt.conf.d/20auto-upgrades'; |
||
| 28 | |||
| 29 | if (!file_exists($configFile)) { |
||
| 30 | return false; |
||
| 31 | } |
||
| 32 | |||
| 33 | $content = file_get_contents($configFile); |
||
| 34 | if ($content === false) { |
||
| 35 | return false; |
||
| 36 | } |
||
| 37 | |||
| 38 | $updateListEnabled = preg_match('/APT::Periodic::Update-Package-Lists\s+"1";/', $content); |
||
| 39 | $unattendedUpgradeEnabled = preg_match('/APT::Periodic::Unattended-Upgrade\s+"1";/', $content); |
||
| 40 | |||
| 41 | return $updateListEnabled && $unattendedUpgradeEnabled; |
||
| 42 | } |
||
| 58 |