mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 20:33:01 +02:00
- Prevent crashes with incorrectly loading modules - Prevent crashes when dyld libraries are missing - Indicate when the PHP installation is broken - New warning added at boot (multiple services) - Added "Force load latest PHP version" option It is known that PHP 5.6, 7.0 and 7.1 are causing issues with the newer versions of certain libraries ("dyld library" warning). It is recommended to only use PHP 7.2, PHP 7.3 and PHP 7.4 for a minimal amount of issues. Otherwise, there are certain fixes that are possible but they are not supported via PHP Monitor since they require manual formula changes. For more information, see: https://github.com/eXolnet/homebrew-deprecated/issues/23#issuecomment-619976586
49 lines
1.2 KiB
Swift
49 lines
1.2 KiB
Swift
//
|
|
// PhpVersionExtractor.swift
|
|
// PHP Monitor
|
|
//
|
|
// Created by Nico Verbruggen on 11/06/2019.
|
|
// Copyright © 2019 Nico Verbruggen. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
class PhpVersion {
|
|
|
|
var short : String = "???"
|
|
var long : String = "???"
|
|
|
|
var xdebugFound: Bool = false
|
|
var xdebugEnabled : Bool = false
|
|
|
|
var error : Bool = false
|
|
|
|
init() {
|
|
let version = Command.execute(path: "/usr/local/bin/php", arguments: ["-r", "print phpversion();"])
|
|
|
|
if (version == "" || version.contains("Warning")) {
|
|
self.short = "💩 BROKEN"
|
|
self.long = "";
|
|
self.error = true
|
|
return;
|
|
}
|
|
|
|
// That's the long version
|
|
self.long = version
|
|
|
|
// Next up, let's strip away the minor version number
|
|
let segments = long.components(separatedBy: ".")
|
|
|
|
// Get the first two elements
|
|
self.short = segments[0...1].joined(separator: ".")
|
|
|
|
// Load xdebug support
|
|
self.xdebugFound = Actions.XdebugFound(self.short)
|
|
if (self.xdebugFound) {
|
|
self.xdebugEnabled = Actions.XdebugEnabled(self.short)
|
|
}
|
|
|
|
self.error = false;
|
|
}
|
|
}
|