mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-09 04:42:59 +02:00
31 lines
770 B
Swift
31 lines
770 B
Swift
//
|
||
// PhpInstallation.swift
|
||
// PHP Monitor
|
||
//
|
||
// Created by Nico Verbruggen on 28/11/2021.
|
||
// Copyright © 2021 Nico Verbruggen. All rights reserved.
|
||
//
|
||
|
||
import Foundation
|
||
|
||
class PhpInstallation {
|
||
|
||
var longVersion: String
|
||
|
||
/**
|
||
In order to determine details about a PHP installation, we’ll simply run `php-config --version`
|
||
in the relevant directory.
|
||
*/
|
||
init(_ version: String) {
|
||
let phpConfigExecutablePath = "\(Paths.optPath)/php@\(version)/bin/php-config"
|
||
self.longVersion = version
|
||
if Shell.fileExists(phpConfigExecutablePath) {
|
||
self.longVersion = Command.execute(
|
||
path: phpConfigExecutablePath,
|
||
arguments: ["--version"]
|
||
)
|
||
}
|
||
}
|
||
|
||
}
|