mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-02 03:16:15 +01:00
Merge pull request #1584 from master3395/v2.5.5-dev
- Added PHP 8.6 to the list of system PHP versions and fallback versions in PHPManager. - Updated return values to include PHP 8.6 in case of errors or empty results. - Enhanced phpUtilities to recognize PHP 8.6 for CentOS and Ubuntu configurations. - Adjusted recommended PHP version order to prioritize PHP 8.6.
This commit is contained in:
@@ -58,7 +58,7 @@ class PHPManager:
|
|||||||
# Method 2: Check system-wide PHP installations
|
# Method 2: Check system-wide PHP installations
|
||||||
try:
|
try:
|
||||||
# Check for system PHP versions
|
# Check for system PHP versions
|
||||||
system_php_versions = ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
|
system_php_versions = ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']
|
||||||
for version in system_php_versions:
|
for version in system_php_versions:
|
||||||
formatted_version = f'PHP {version}'
|
formatted_version = f'PHP {version}'
|
||||||
if formatted_version not in finalPHPVersions:
|
if formatted_version not in finalPHPVersions:
|
||||||
@@ -117,7 +117,7 @@ class PHPManager:
|
|||||||
|
|
||||||
# Method 4: Fallback to checking common PHP versions
|
# Method 4: Fallback to checking common PHP versions
|
||||||
if not finalPHPVersions:
|
if not finalPHPVersions:
|
||||||
fallback_versions = ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5']
|
fallback_versions = ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6']
|
||||||
for version in fallback_versions:
|
for version in fallback_versions:
|
||||||
try:
|
try:
|
||||||
phpString = PHPManager.getPHPString(version)
|
phpString = PHPManager.getPHPString(version)
|
||||||
@@ -145,25 +145,18 @@ class PHPManager:
|
|||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
logging.writeToFile(f'Final PHP versions found: {finalPHPVersions}')
|
logging.writeToFile(f'Final PHP versions found: {finalPHPVersions}')
|
||||||
|
|
||||||
return finalPHPVersions if finalPHPVersions else ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5']
|
return finalPHPVersions if finalPHPVersions else ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6']
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
logging.writeToFile(f'Error while finding php versions on system: {str(msg)}')
|
logging.writeToFile(f'Error while finding php versions on system: {str(msg)}')
|
||||||
return ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5']
|
return ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6']
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def findApachePHPVersions():
|
def findApachePHPVersions():
|
||||||
# distro = ProcessUtilities.decideDistro()
|
"""
|
||||||
# if distro == ProcessUtilities.centos:
|
Dynamically detect available Apache PHP versions by scanning the system
|
||||||
# return ['PHP 5.3', 'PHP 5.4', 'PHP 5.5', 'PHP 5.6', 'PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
|
"""
|
||||||
# elif distro == ProcessUtilities.cent8:
|
|
||||||
# return ['PHP 7.1','PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
|
|
||||||
# elif distro == ProcessUtilities.ubuntu20:
|
|
||||||
# return ['PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1']
|
|
||||||
# else:
|
|
||||||
# return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5']
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
# Run the shell command and capture the output
|
# Run the shell command and capture the output
|
||||||
@@ -222,7 +215,7 @@ class PHPManager:
|
|||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||||
logging.writeToFile(f'Error while finding php versions on system: {str(msg)}')
|
logging.writeToFile(f'Error while finding php versions on system: {str(msg)}')
|
||||||
return ['PHP 7.0', 'PHP 7.1', 'PHP 7.2', 'PHP 7.3', 'PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5']
|
return ['PHP 7.4', 'PHP 8.0', 'PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6']
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getPHPString(phpVersion):
|
def getPHPString(phpVersion):
|
||||||
@@ -338,7 +331,7 @@ class PHPManager:
|
|||||||
return 'PHP 8.3' # Default recommendation
|
return 'PHP 8.3' # Default recommendation
|
||||||
|
|
||||||
# Priority order for recommendations
|
# Priority order for recommendations
|
||||||
recommended_order = ['PHP 8.3', 'PHP 8.2', 'PHP 8.4', 'PHP 8.5', 'PHP 8.1', 'PHP 8.0', 'PHP 7.4']
|
recommended_order = ['PHP 8.3', 'PHP 8.2', 'PHP 8.4', 'PHP 8.5', 'PHP 8.6', 'PHP 8.1', 'PHP 8.0', 'PHP 7.4']
|
||||||
|
|
||||||
for recommended in recommended_order:
|
for recommended in recommended_order:
|
||||||
if recommended in all_versions:
|
if recommended in all_versions:
|
||||||
|
|||||||
@@ -372,7 +372,10 @@ class phpUtilities:
|
|||||||
centOSPHP = 'php85'
|
centOSPHP = 'php85'
|
||||||
ubuntuPHP = 'php8.5'
|
ubuntuPHP = 'php8.5'
|
||||||
|
|
||||||
|
phpPath = ApacheVhost.DecidePHPPath('86', virtualHostName)
|
||||||
|
if os.path.exists(phpPath):
|
||||||
|
centOSPHP = 'php86'
|
||||||
|
ubuntuPHP = 'php8.6'
|
||||||
|
|
||||||
######
|
######
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user