@@ -2094,7 +2094,8 @@ function getopensslversion($get_minor = false) {
20942094 $ app ->log ("Could not check OpenSSL version, openssl not found. " , LOGLEVEL_DEBUG );
20952095 return '1.0.1 ' ;
20962096 }
2097- exec ($ cmd , $ output , $ return_var );
2097+
2098+ exec ($ cmd , $ output , $ return_var );
20982099 if ($ return_var != 0 || !$ output [0 ]) {
20992100 $ app ->log ("Could not check OpenSSL version, openssl did not return any data. " , LOGLEVEL_WARN );
21002101 return '1.0.1 ' ;
@@ -2106,7 +2107,31 @@ function getopensslversion($get_minor = false) {
21062107 return '1.0.1 ' ;
21072108 }
21082109
2109- }
2110+ }
2111+
2112+ function getnginxversion ($ get_minor = false ) {
2113+ global $ app ;
2114+
2115+ if ($ this ->is_installed ('nginx ' )) $ cmd = 'nginx -v 2>&1 ' ;
2116+ else {
2117+ $ app ->log ("Could not check Nginx version, nginx not found. " , LOGLEVEL_DEBUG );
2118+ return false ;
2119+ }
2120+
2121+ exec ($ cmd , $ output , $ return_var );
2122+
2123+ if ($ return_var != 0 || !$ output [0 ]) {
2124+ $ app ->log ("Could not check Nginx version, nginx did not return any data. " , LOGLEVEL_WARN );
2125+ return false ;
2126+ }
2127+
2128+ if (preg_match ('/nginx version: nginx\/\s*(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i ' , $ output [0 ], $ matches )) {
2129+ return $ matches [1 ] . (isset ($ matches [3 ]) ? '. ' . $ matches [3 ] : '' ) . (isset ($ matches [5 ]) && $ get_minor == true ? '. ' . $ matches [5 ] : '' );
2130+ } else {
2131+ $ app ->log ("Could not check Nginx version, did not find version string in nginx output. " , LOGLEVEL_WARN );
2132+ return false ;
2133+ }
2134+ }
21102135
21112136 function getapacheversion ($ get_minor = false ) {
21122137 global $ app ;
0 commit comments