{$mod_strings['ERR_CHECKSYS_FASTCGI_LOGGING']}"; $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_FASTCGI'].' '.$iisVersion.' '; } if(strpos($server_software,'Microsoft-IIS') !== false) { $iis_version = ''; if(preg_match_all("/^.*\/(\d+\.?\d*)$/", $server_software, $out)) $iis_version = $out[1][0]; $check_iis_version_result = check_iis_version($iis_version); if($check_iis_version_result == -1) { installLog($mod_strings['ERR_CHECKSYS_IIS_INVALID_VER'].' '.$iis_version); $iisVersion = "{$mod_strings['ERR_CHECKSYS_IIS_INVALID_VER']} {$iis_version}"; $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_IISVER'].' '.$iisVersion.' '; } else if(php_sapi_name() != 'cgi-fcgi') { installLog($mod_strings['ERR_CHECKSYS_FASTCGI'].' '.$iis_version); $iisVersion = "{$mod_strings['ERR_CHECKSYS_FASTCGI']}"; $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_FASTCGI'].' '.$iisVersion.' '; } else if(ini_get('fastcgi.logging') != '0') { installLog($mod_strings['ERR_CHECKSYS_FASTCGI_LOGGING'].' '.$iis_version); $iisVersion = "{$mod_strings['ERR_CHECKSYS_FASTCGI_LOGGING']}"; $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_FASTCGI'].' '.$iisVersion.' '; } } // PHP VERSION $php_version = constant('PHP_VERSION'); $check_php_version_result = check_php_version($php_version); if($check_php_version_result == -1) { installLog($mod_strings['ERR_CHECKSYS_PHP_INVALID_VER'].' '.$php_version); $phpVersion = "{$mod_strings['ERR_CHECKSYS_PHP_INVALID_VER']} {$php_version} )"; $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_PHPVER'].' '.$phpVersion.' '; } //Php Backward compatibility checks if(ini_get("zend.ze1_compatibility_mode")) { installLog($mod_strings['LBL_BACKWARD_COMPATIBILITY_ON'].' '.'Php Backward Compatibility'); $phpCompatibility = "{$mod_strings['LBL_BACKWARD_COMPATIBILITY_ON']}"; $error_found = true; $error_txt .= ' Php Backward Compatibility '.$phpCompatibility.' '; } // database and connect if (!empty($_REQUEST['setup_db_type'])) $_SESSION['setup_db_type'] = $_REQUEST['setup_db_type']; $mssqlStatus = ''; $dbVersion = ''; // Removed php_sqlsrv install support until the driver support is out of beta status $supported_dbs = array("mysql_connect", "mysqli_connect", "mssql_connect", "sqlsrv_connect", ); $db_support_exists = false; foreach ($supported_dbs as $dbfunct){ if( function_exists( $dbfunct) ){ $db_support_exists = true; installLog("Found at least one supported DB Type"); break; } } if( !$db_support_exists ){ $db_name = $mod_strings['LBL_DB_UNAVAILABLE']; installLog("ERROR:: {$mod_strings['LBL_CHECKSYS_DB_SUPPORT_NOT_AVAILABLE']}"); $dbStatus = "{$mod_strings['LBL_CHECKSYS_DB_SUPPORT_NOT_AVAILABLE']}"; $error_found = true; $error_txt .= ' '.$db_name.' '.$dbStatus.' '; } // XML Parsing if(!function_exists('xml_parser_create')) { $xmlStatus = "{$mod_strings['LBL_CHECKSYS_XML_NOT_AVAILABLE']}"; installLog("ERROR:: {$mod_strings['LBL_CHECKSYS_XML_NOT_AVAILABLE']}"); $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_XML'].' '.$xmlStatus.' '; }else{ installLog("XML Parsing Support Found"); } // mbstrings if(!function_exists('mb_strlen')) { $mbstringStatus = "{$mod_strings['ERR_CHECKSYS_MBSTRING']}"; installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_MBSTRING']}"); $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_MBSTRING'].' '.$mbstringStatus.' '; }else{ installLog("MBString Support Found"); } // config.php if(file_exists('./config.php') && (!(make_writable('./config.php')) || !(is_writable('./config.php')))) { installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CONFIG_NOT_WRITABLE']}"); $configStatus = "{$mod_strings['ERR_CHECKSYS_CONFIG_NOT_WRITABLE']}"; $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_CONFIG'].' '.$configStatus.' '; } // custom dir if(!make_writable('./custom')) { $customStatus = "{$mod_strings['ERR_CHECKSYS_CUSTOM_NOT_WRITABLE']}"; installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CUSTOM_NOT_WRITABLE']}"); $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_CUSTOM'].' '.$customStatus.' '; }else{ installLog("/custom directory and subdirectory check passed"); } // data dir if(!make_writable('./data') || !make_writable('./data/upload')) { $dataStatus = "{$mod_strings['ERR_CHECKSYS_FILES_NOT_WRITABLE']}"; installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_FILES_NOT_WRITABLE']}"); $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_DATA'].' '.$dataStatus .' '.$mod_strings['LBL_CHECKSYS_FIX_FILES'].''; if(!make_writable('./data')) { $error_txt .='
'.getcwd().'/data'; } if(!make_writable('./data/upload')) { $error_txt .='
'.getcwd().'/data/upload'; } $error_txt .= ' '; }else{ installLog("/data/upoad directory and subdirectory check passed"); } // cache dir $cache_files[] = '/cache'; $cache_files[] = '/cache/images'; $cache_files[] = '/cache/import'; $cache_files[] = '/cache/layout'; $cache_files[] = '/cache/pdf'; $cache_files[] = '/cache/upload'; $cache_files[] = '/cache/xml'; $filelist = ''; foreach($cache_files as $c_file) { $dirname = ".".$c_file; $ok = false; if ((is_dir($dirname)) || @sugar_mkdir($dirname,0555)) // set permissions to restrictive - use make_writable to change in a standard way to the required permissions { $ok = make_writable($dirname); } if (!$ok) { $filelist .= '
'.getcwd().$c_file; } } if (strlen($filelist)>0) { $error_found = true; installLog("ERROR:: Some subdirectories in cache subfolder were not read/writeable:"); installLog($filelist); $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_CACHE'].' '.$mod_strings['ERR_CHECKSYS_FILES_NOT_WRITABLE'].' '.$mod_strings['LBL_CHECKSYS_FIX_FILES'].''.$filelist. ' '; }else{ installLog("/cache directory and subdirectory check passed"); } // check modules dir $_SESSION['unwriteable_module_files'] = array(); //if(!$writeableFiles['ret_val']) { $passed_write = recursive_make_writable('./modules'); if (isset($_SESSION['unwriteable_module_files']['failed']) && $_SESSION['unwriteable_module_files']['failed']){ $passed_write = false; } if(!$passed_write) { $moduleStatus = "{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}"; installLog("ERROR:: Module directories and the files under them are not writeable."); $error_found = true; $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_MODULE'].' '.$moduleStatus.' '; //list which module directories are not writeable, if there are less than 10 $error_txt .= ' '.$mod_strings['LBL_CHECKSYS_FIX_MODULE_FILES'].''; foreach($_SESSION['unwriteable_module_files'] as $key=>$file){ if($key !='.' && $key != 'failed'){ $error_txt .='
'.$file; } } $error_txt .= ' '; }else{ installLog("/module directory and subdirectory check passed"); } // PHP.ini $phpIniLocation = get_cfg_var("cfg_file_path"); installLog("php.ini location found. {$phpIniLocation}"); // disable form if error found if($error_found){ installLog("Outputting HTML for System check"); installLog("Errors were found *************"); $disabled = $error_found ? 'disabled="disabled"' : ''; $help_url = get_help_button_url(); /////////////////////////////////////////////////////////////////////////////// //// BEGIN PAGE OUTPUT $out =<< {$mod_strings['LBL_CHECKSYS_TITLE']} SugarCRM
{$mod_strings['LBL_HELP']}

{$mod_strings['ERR_CHECKSYS']}

$error_txt
{$mod_strings['LBL_CHECKSYS_COMPONENT']} {$mod_strings['LBL_CHECKSYS_STATUS']}
{$mod_strings['LBL_CHECKSYS_PHP_INI']}
{$phpIniLocation}


EOQ; return $out; }else{ installLog("Outputting HTML for System check"); installLog("No Errors were found *************"); return 'passed'; } } //// END PAGEOUTPUT /////////////////////////////////////////////////////////////////////////////// ?>