diff options
author | Tim Smith <tim@cozy.co> | 2014-11-29 18:53:28 -0800 |
---|---|---|
committer | Tyler Fitch <tfitch@getchef.com> | 2015-02-11 10:43:50 -0800 |
commit | 9305f9869189aa89c0e19c0b589acc95a447f830 (patch) | |
tree | ffd18069ba0838335c3d532332b105996d5da8ac | |
parent | 4b63890b270e20b1c1cdf0aab1da305418fed516 (diff) | |
download | ohai-9305f9869189aa89c0e19c0b589acc95a447f830.tar.gz |
Add additional information on the PHP engine versions
-rw-r--r-- | lib/ohai/plugins/php.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/ohai/plugins/php.rb b/lib/ohai/plugins/php.rb index 49d8cb74..a8c31959 100644 --- a/lib/ohai/plugins/php.rb +++ b/lib/ohai/plugins/php.rb @@ -1,6 +1,8 @@ # # Author:: Doug MacEachern <dougm@vmware.com> +# Author:: Tim Smith <tim@cozy.co> # Copyright:: Copyright (c) 2009 VMware, Inc. +# Copyright:: Copyright (c) 2014 Cozy Services, Ltd. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,17 +24,22 @@ Ohai.plugin(:PHP) do depends "languages" collect_data do - output = nil - php = Mash.new so = shell_out("php -v") if so.exitstatus == 0 - output = /PHP (\S+).+built: ([^)]+)/.match(so.stdout) - if output - php[:version] = output[1] - php[:builddate] = output[2] + so.stdout.split(/\r?\n/).each do |line| + case line + when /PHP (\S+).+built: ([^)]+)/ + php[:version] = $1 + php[:builddate] = $2 + when /Zend Engine v([^\s]+),/ + php[:zend_engine_version] = $1 + when /Zend OPcache v([^\s]+),/ + php[:zend_opcache_version] = $1 + end end + languages[:php] = php if php[:version] end end |