1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

👌 Use filesystem abstraction

This commit is contained in:
2023-01-07 12:53:07 +01:00
parent 422a7738bd
commit 61ecefb6e7
2 changed files with 2 additions and 5 deletions

View File

@ -95,9 +95,7 @@ class Actions {
// MARK: - Other Actions
public static func createTempPhpInfoFile() async -> URL {
// Write a file called `phpmon_phpinfo.php` to /tmp
// TODO: Use FileSystem abstraction
try! "<?php phpinfo();".write(toFile: "/tmp/phpmon_phpinfo.php", atomically: true, encoding: .utf8)
try! FileSystem.writeAtomicallyToFile("/tmp/phpmon_phpinfo.php", content: "<?php phpinfo();")
// Tell php-cgi to run the PHP and output as an .html file
await Shell.quiet("\(Paths.binPath)/php-cgi -q /tmp/phpmon_phpinfo.php > /tmp/phpmon_phpinfo.html")

View File

@ -35,8 +35,7 @@ class PhpConfigurationFile: CreatedFromFile {
let path = filePath.replacingOccurrences(of: "~", with: Paths.homePath)
do {
// TODO: Use FileSystem abstraction
let fileContents = try String(contentsOfFile: path)
let fileContents = try FileSystem.getStringFromFile(path)
return Self.init(path: path, contents: fileContents)
} catch {
Log.warn("Could not read the PHP configuration file at: `\(filePath)`")