Add apache.get_php_version() convenience function

This commit is contained in:
Lance Edgar 2020-02-08 14:38:08 -06:00
parent 4315799e1d
commit 98a64c5024

View file

@ -67,6 +67,17 @@ def get_version(c):
return float(match.group(1))
def get_php_version(c):
"""
Fetch the version of PHP running on the target system
"""
result = c.sudo('php --version')
if not result.failed:
match = re.match(r'^PHP (\d+\.\d+)\.\d+-', result.stdout)
if match:
return float(match.group(1))
def enable_mod(c, *names):
"""
Enable the given Apache modules