(string $path, string $data)
| 61 | } |
| 62 | |
| 63 | private static function writeAtomic(string $path, string $data): bool |
| 64 | { |
| 65 | $dir = dirname($path); |
| 66 | $tmp = $path . '.tmp.' . bin2hex(random_bytes(6)); |
| 67 | if (!is_dir($dir)) { |
| 68 | return false; |
| 69 | } |
| 70 | if (file_put_contents($tmp, $data, LOCK_EX) === false) { |
| 71 | if (is_file($tmp)) { |
| 72 | @unlink($tmp); |
| 73 | } |
| 74 | return false; |
| 75 | } |
| 76 | if (!@rename($tmp, $path)) { |
| 77 | @unlink($tmp); |
| 78 | return false; |
| 79 | } |
| 80 | return true; |
| 81 | } |
| 82 | |
| 83 | private static function mergePermissionsMostRestrictive($base, $incoming): array |
| 84 | { |
no outgoing calls
no test coverage detected