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:
@ -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")
|
||||
|
@ -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)`")
|
||||
|
Reference in New Issue
Block a user