@@ -2142,6 +2142,52 @@ function getinitcommand($servicename, $action, $init_script_directory = '', $che
21422142 }
21432143 }
21442144
2145+ function getopensslversion ($ get_minor = false ) {
2146+ global $ app ;
2147+ if ($ this ->is_installed ('openssl ' )) $ cmd = 'openssl version ' ;
2148+ else {
2149+ $ app ->log ("Could not check OpenSSL version, openssl not found. " , LOGLEVEL_DEBUG );
2150+ return '1.0.1 ' ;
2151+ }
2152+
2153+ exec ($ cmd , $ output , $ return_var );
2154+ if ($ return_var != 0 || !$ output [0 ]) {
2155+ $ app ->log ("Could not check OpenSSL version, openssl did not return any data. " , LOGLEVEL_WARN );
2156+ return '1.0.1 ' ;
2157+ }
2158+ if (preg_match ('/OpenSSL\s*(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i ' , $ output [0 ], $ matches )) {
2159+ return $ matches [1 ] . (isset ($ matches [3 ]) ? '. ' . $ matches [3 ] : '' ) . (isset ($ matches [5 ]) && $ get_minor == true ? '. ' . $ matches [5 ] : '' );
2160+ } else {
2161+ $ app ->log ("Could not check OpenSSL version, did not find version string in openssl output. " , LOGLEVEL_WARN );
2162+ return '1.0.1 ' ;
2163+ }
2164+
2165+ }
2166+
2167+ function getnginxversion ($ get_minor = false ) {
2168+ global $ app ;
2169+
2170+ if ($ this ->is_installed ('nginx ' )) $ cmd = 'nginx -v 2>&1 ' ;
2171+ else {
2172+ $ app ->log ("Could not check Nginx version, nginx not found. " , LOGLEVEL_DEBUG );
2173+ return false ;
2174+ }
2175+
2176+ exec ($ cmd , $ output , $ return_var );
2177+
2178+ if ($ return_var != 0 || !$ output [0 ]) {
2179+ $ app ->log ("Could not check Nginx version, nginx did not return any data. " , LOGLEVEL_WARN );
2180+ return false ;
2181+ }
2182+
2183+ if (preg_match ('/nginx version: nginx\/\s*(\d+)(\.(\d+)(\.(\d+))*)?(\D|$)/i ' , $ output [0 ], $ matches )) {
2184+ return $ matches [1 ] . (isset ($ matches [3 ]) ? '. ' . $ matches [3 ] : '' ) . (isset ($ matches [5 ]) && $ get_minor == true ? '. ' . $ matches [5 ] : '' );
2185+ } else {
2186+ $ app ->log ("Could not check Nginx version, did not find version string in nginx output. " , LOGLEVEL_WARN );
2187+ return false ;
2188+ }
2189+ }
2190+
21452191 function getapacheversion ($ get_minor = false ) {
21462192 global $ app ;
21472193
0 commit comments