summaryrefslogtreecommitdiff
path: root/lib/ohai/plugins/php.rb
diff options
context:
space:
mode:
authorDoug MacEachern <dougm@vmware.com>2009-12-14 17:04:41 -0800
committerDaniel DeLeo <dan@opscode.com>2010-05-05 10:57:25 -0700
commitc6c74267c43d59d2152ad346c8e9ae85368df59c (patch)
tree198ec11246b1e3dcdb5bb4ad975e7985c7c8511b /lib/ohai/plugins/php.rb
parent5c24d9791e7854425691a9e27e1bd04558858cf0 (diff)
downloadohai-c6c74267c43d59d2152ad346c8e9ae85368df59c.tar.gz
php plugin
Diffstat (limited to 'lib/ohai/plugins/php.rb')
-rw-r--r--lib/ohai/plugins/php.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/ohai/plugins/php.rb b/lib/ohai/plugins/php.rb
new file mode 100644
index 00000000..23dbba14
--- /dev/null
+++ b/lib/ohai/plugins/php.rb
@@ -0,0 +1,36 @@
+#
+# Author:: Doug MacEachern <dougm@vmware.com>
+# Copyright:: Copyright (c) 2009 VMware, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+provides "languages/php"
+
+require_plugin "languages"
+
+output = nil
+
+php = Mash.new
+
+status, stdout, stderr = run_command(:no_status_check => true, :command => "php -v")
+if status == 0
+ output = stdout.split
+ if output.length >= 6
+ php[:version] = output[1]
+ php[:builddate] = "%s %s %s" % [output[4],output[5],output[6]]
+ end
+ languages[:php] = php if php[:version]
+end
+