Skip to content

Commit

Permalink
Merge branch 'OHAI-358'
Browse files Browse the repository at this point in the history
  • Loading branch information
btm committed Nov 25, 2013
2 parents bed2a6a + abcaf72 commit bcc1557
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ohai/plugins/php.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@

so = shell_out("php -v")
if so.exitstatus == 0
output = so.stdout.split
if output.length >= 6
output = /PHP (\S+).+built: ([^)]+)/.match(so.stdout)
if output
php[:version] = output[1]
php[:builddate] = "%s %s %s" % [output[4],output[5],output[6]]
php[:builddate] = output[2]
end
languages[:php] = php if php[:version]
end
Expand Down
7 changes: 7 additions & 0 deletions spec/unit/plugins/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
@plugin.languages.should_not have_key(:php)
end

it "should parse builddate even if it's suhosin patched" do
@stdout = "PHP 5.3.27 with Suhosin-Patch (cli) (built: Aug 30 2013 04:30:30) \nCopyright (c) 1997-2013 The PHP Group\nZend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies"
@plugin.stub(:shell_out).with("php -v").and_return(mock_shell_out(0, @stdout, ""))
@plugin.run
@plugin.languages[:php][:builddate].should eql("Aug 30 2013 04:30:30")
end

#########

test_plugin([ "languages", "php" ], [ "php" ]) do | p |
Expand Down

0 comments on commit bcc1557

Please sign in to comment.