From 6d9fe04aa875baedb1370f72d05145518afd0fba Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 4 Dec 2016 15:19:58 -0800 Subject: setup changes to check for shell_exec and exec functions --- Zotlabs/Module/Setup.php | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'Zotlabs/Module/Setup.php') diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php index fde9fe823..7de67e85c 100644 --- a/Zotlabs/Module/Setup.php +++ b/Zotlabs/Module/Setup.php @@ -161,13 +161,6 @@ class Setup extends \Zotlabs\Web\Controller { } } - function get_db_errno() { - if(class_exists('mysqli')) - return mysqli_connect_errno(); - else - return mysql_errno(); - } - /** * @brief Get output for the setup page. * @@ -175,6 +168,7 @@ class Setup extends \Zotlabs\Web\Controller { * * @return string parsed HTML output */ + function get() { $o = ''; @@ -401,7 +395,8 @@ class Setup extends \Zotlabs\Web\Controller { if (strlen($phpath)) { $passed = file_exists($phpath); - } else { + } + elseif(function_exists('shell_exec')) { if(is_windows()) $phpath = trim(shell_exec('where php')); else @@ -426,9 +421,13 @@ class Setup extends \Zotlabs\Web\Controller { if($passed) { $str = autoname(8); $cmd = "$phpath install/testargs.php $str"; - $result = trim(shell_exec($cmd)); - $passed2 = $result == $str; $help = ''; + + if(function_exists('shell_exec')) + $result = trim(shell_exec($cmd)); + else + $help .= t('Unable to check command line PHP as shell_exec() is disabled. This is required.') . EOL; + $passed2 = (($result == $str) ? true : false); if(!$passed2) { $help .= t('The command line version of PHP on your system does not have "register_argc_argv" enabled.'). EOL; $help .= t('This is required for message delivery to work.'); @@ -518,6 +517,18 @@ class Setup extends \Zotlabs\Web\Controller { else { $this->check_add($ck_funcs, t('proc_open'), true, true); } + if((! function_exists('exec')) || strstr(ini_get('disable_functions'),'exec')) { + $this->check_add($ck_funcs, t('exec'), false, true, t('Error: exec is required but is either not installed or has been disabled in php.ini')); + } + else { + $this->check_add($ck_funcs, t('exec'), true, true); + } + if((! function_exists('shell_exec')) || strstr(ini_get('disable_functions'),'shell_exec')) { + $this->check_add($ck_funcs, t('shell_exec'), false, true, t('Error: shell_exec is required but is either not installed or has been disabled in php.ini')); + } + else { + $this->check_add($ck_funcs, t('shell_exec'), true, true); + } if(! function_exists('curl_init')) { $ck_funcs[0]['status'] = false; -- cgit v1.2.3