Exemple #1
0
	function __construct($step = 0, $fast = 0, $fix_mode = 0)
	{
		if (!$this->step = intval($step))
			$this->arTestVars['site_checker_success'] = 'Y';
		$this->test_percent = 0;
		$this->strError = '';
		$this->timeout = 10; // sec for one step
		$this->strResult = '';
		$this->fix_mode = intval($fix_mode);
		$this->cafile = $_SERVER['DOCUMENT_ROOT'].'/bitrix/tmp/cacert.pem';

		$this->host = $_REQUEST['HTTP_HOST'] ? $_REQUEST['HTTP_HOST'] : 'localhost';
		if (!$fix_mode) // no need to know the host in fix mode
		{
			if (!preg_match('/^[a-z0-9\.\-]+$/i', $this->host)) // cyrillic domain hack
			{
				$host = $this->host;
				$host0 = CharsetConverter::ConvertCharset($host, 'utf8', 'cp1251');
				if (preg_match("/[\xC0-\xFF]/",$host0))
				{
					// utf-8;
					if (!defined('BX_UTF') && BX_UTF !== true)
						$host = $host0;
				}
				elseif (preg_match("/[\xC0-\xFF]/",$host))
				{
					// windows-1251
					if (defined('BX_UTF') && BX_UTF === true)
						$host = CharsetConverter::ConvertCharset($host, 'cp1251', 'utf8');
				}
				$converter = new CBXPunycode();
				$host = $converter->Encode($host);
				$this->host = $host;
			}
		}
		$this->ssl = $_REQUEST['HTTPS'] == 'on';
		$this->port = $_REQUEST['SERVER_PORT'] ? $_REQUEST['SERVER_PORT'] : ($this->ssl ? 443 : 80);

		$arTestGroup = array();
		$arGroupName = array();

		$arGroupName[1] = IsModuleInstalled('intranet') ? GetMessage("MAIN_SC_GENERAL") : GetMessage("MAIN_SC_GENERAL_SITE");
		$arGroupDesc[1] = GetMessage("MAIN_SC_REQUIRED_MODS_DESC");
		$arTestGroup[1] = array(
			array('check_php_modules' =>GetMessage('SC_T_MODULES')),
			array('check_php_settings' =>GetMessage('SC_T_PHP')),
			array('check_security' => GetMessage('SC_T_APACHE')),
			array('check_server_vars' =>GetMessage('SC_T_SERVER')),
			array('check_session' => GetMessage('SC_T_SESS')),
			array('check_mbstring' =>GetMessage('SC_T_MBSTRING')),
			array('check_socket' => GetMessage('SC_T_SOCK')),
		);

		$arGroupName[2] = GetMessage("MAIN_SC_BUSINESS");
		$arGroupDesc[2] = GetMessage("MAIN_SC_CORRECT_DESC");
		$arTestGroup[2] = array(
			array('check_pull_stream' => GetMessage("MAIN_SC_TEST_CHAT")),
			array('check_pull_comments' => GetMessage("MAIN_SC_TEST_COMMENTS")),
			array('check_turn' => GetMessage("MAIN_SC_TEST_VIDEO")),
			array('check_access_mobile' => GetMessage("MAIN_SC_TEST_MOBILE")),
			array('check_push_bitrix' => GetMessage("MAIN_SC_TEST_PUSH")),
			array('check_access_docs' => GetMessage("MAIN_SC_TEST_DOCS")),
			array('check_fast_download' => GetMessage("MAIN_SC_TEST_FAST_FILES")),
			array('check_search' => GetMessage("MAIN_SC_TEST_SEARCH_CONTENTS")),
			array('check_mail' => GetMessage("MAIN_SC_MAIL_TEST")),
			array('check_ca_file' => GetMessage("MAIN_SC_CLOUD_TEST")),
			array('check_connect_mail' => GetMessage("MAIN_SC_TEST_MAIL_INTEGRATION")),
			array('check_socnet' => GetMessage("MAIN_SC_TEST_SOCNET_INTEGRATION")),
		);
		if (IsModuleInstalled('extranet'))
			$arTestGroup[2][] = array('check_extranet' => GetMessage("MAIN_SC_EXTRANET_ACCESS")); 

		$arGroupName[4] = GetMessage("MAIN_SC_WINDOWS_ENV");
		$arGroupDesc[4] = '';
		$arTestGroup[4] = array(
			array('check_webdav' => GetMessage("MAIN_SC_DOCS_EDIT_MS_OFFICE")),
			array('check_socket_ssl' => GetMessage("MAIN_SC_EXTERNAL_APPS_TEST")),
			array('check_ad' => GetMessage("MAIN_SC_TEST_LDAP")),
			array('check_ntlm' => GetMessage("MAIN_SC_TEST_NTLM")),
		);

		$arGroupName[8] = GetMessage("MAIN_SC_PERFORM");
		$arGroupDesc[8] = '';
		$arTestGroup[8] = array(
			array('check_perf' => GetMessage("MAIN_SC_PERF_TEST")),
			array('check_compression' => GetMessage("MAIN_SC_COMPRESSION_TEST")),
		);

		$arGroupName[16] = GetMessage('SC_GR_EXTENDED');
		$arTestGroup[16] = array(
			array('check_dbconn_settings' => GetMessage('SC_T_DBCONN_SETTINGS')),
			array('check_dbconn' => GetMessage('SC_T_DBCONN')),
			array('check_bx_crontab' => GetMessage("MAIN_SC_AGENTS_CRON")),
			array('check_session_ua' => GetMessage('SC_T_SESS_UA')),
			array('check_sites' => GetMessage('SC_T_SITES')),
			array('check_install_scripts' => GetMessage('SC_T_INSTALL_SCRIPTS')),
			array('check_clone' => GetMessage('SC_T_CLONE')),

			array('check_pcre_recursion' => GetMessage('SC_T_RECURSION')),
			array('check_method_exists' => GetMessage('SC_T_METHOD_EXISTS')),

			array('check_upload' => GetMessage('SC_T_UPLOAD')),
			array('check_upload_big' => GetMessage('SC_T_UPLOAD_BIG')),
			array('check_upload_raw' => GetMessage('SC_T_UPLOAD_RAW')),
			array('check_post' => GetMessage('SC_T_POST')),

			array('check_mail' => GetMessage('SC_T_MAIL')),
			array('check_mail_big' => GetMessage('SC_T_MAIL_BIG')),
			array('check_mail_b_event' => GetMessage('SC_T_MAIL_B_EVENT')),

			array('check_localredirect' => GetMessage('SC_T_REDIRECT')),
			array('check_memory_limit' => GetMessage('SC_T_MEMORY')),
			array('check_cache' => GetMessage('SC_T_CACHE')),

			array('check_update' => GetMessage('SC_UPDATE_ACCESS')), 
			array('check_http_auth' => GetMessage('SC_T_AUTH')),
			array('check_exec' => GetMessage('SC_T_EXEC')),
			array('check_getimagesize' => GetMessage('SC_T_GETIMAGESIZE')),
		);

		$arGroupName[32] = GetMessage('SC_GR_MYSQL');
		$arTestGroup[32] = array(
			array('check_mysql_bug_version' => GetMessage('SC_T_MYSQL_VER')),
			array('check_mysql_time' => GetMessage('SC_T_TIME')),
			array('check_mysql_mode' => GetMessage('SC_T_SQL_MODE')),
			array('check_mysql_connection_charset' => GetMessage('SC_CONNECTION_CHARSET')),
			array('check_mysql_db_charset' => GetMessage('SC_DB_CHARSET')),

//			array('check_mysql_table_status' => GetMessage('SC_T_CHECK')),
			array('check_mysql_table_charset' => GetMessage('SC_T_CHARSET')),
			array('check_mysql_table_structure' => GetMessage('SC_T_STRUCTURE')),
		);

		if ($this->fix_mode)
		{
			switch ($this->fix_mode)
			{
				case 1:
					$this->arTest = array(
						array('check_mysql_table_status' => GetMessage('SC_T_CHECK')),
					);
				break;
				case 2:
					$this->arTest = array(
						array('check_mysql_connection_charset' => GetMessage('SC_CONNECTION_CHARSET')),
						array('check_mysql_db_charset' => GetMessage('SC_DB_CHARSET')),
						array('check_mysql_table_charset' => GetMessage('SC_T_CHARSET')),
					);
				break;
				case 3:
				default:
					$this->arTest = array(
						array('check_mysql_table_structure' => GetMessage('SC_T_STRUCTURE')),
					);
				break;
			}
		}
		else
		{
			$profile = 1;
			if ($fast)
			{
				if (IsModuleInstalled('intranet'))
				{
					$profile |= 2;
					$profile |= 4;
					$profile |= 8;
				}
			}
			else
			{
				$profile |= 16;
				if (strtolower($GLOBALS['DB']->type) == 'mysql')
					$profile |= 32;
			}
			$this->arTest = array();
			$step0 = $step;
			foreach($arTestGroup as $i => $ar)
			{
				if ($i & $profile)
				{
					if (!$this->group_name)
					{
						$c = count($ar);
						if ($step0 >= $c)
							$step0 -= $c;
						else
						{
							$this->group_name = $arGroupName[$i];
							$this->group_desc = $arGroupDesc[$i];
						}
					}
					$this->arTest = array_merge($this->arTest, $ar);
				}
			}
		}

		list($this->function, $this->strCurrentTestName) = each($this->arTest[$this->step]);
		$this->strNextTestName = $this->strCurrentTestName;

		$LICENSE_KEY = '';
		if (file_exists($file = $_SERVER['DOCUMENT_ROOT'].'/bitrix'.'/license_key.php'))
			include($file);

		if ($LICENSE_KEY == '')
			$LICENSE_KEY = 'DEMO';
		define('LICENSE_HASH', md5('CONNECTION_TEST'));
		$this->LogFile = '/bitrix'.'/site_checker_'.md5('SITE_CHECKER'.$LICENSE_KEY).'.log';
	}
Exemple #2
0
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/prolog.php";
$APPLICATION->SetTitle(GetMessage("MAIN_DUMP_AUTO_PAGE_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_admin_after.php";
$arAllBucket = CBackup::GetBucketList();
$strError = '';
if ($DB->type != 'MYSQL') {
    echo BeginNote() . GetMessage('MAIN_DUMP_MYSQL_ONLY') . EndNote();
}
$server_name = COption::GetOptionString("main", "server_name", "");
if (!$server_name) {
    $server_name = $_SERVER['HTTP_HOST'];
}
$server_name = rtrim($server_name, '/');
if (!preg_match('/^[a-z0-9\\.\\-]+$/i', $server_name)) {
    $converter = new CBXPunycode(defined('BX_UTF') && BX_UTF === true ? 'UTF-8' : 'windows-1251');
    $host = $converter->Encode($server_name);
    if (!preg_match('#--p1ai$#', $host)) {
        // trying to guess
        $host = $converter->Encode(CharsetConverter::ConvertCharset($server_name, 'utf-8', 'windows-1251'));
    }
    $server_name = $host;
}
$url = (CMain::IsHTTPS() ? "https://" : "http://") . $server_name;
define('LOCK_FILE', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/backup/auto_lock');
$dump_auto_enable = IntOption('dump_auto_enable');
if ($_REQUEST['save']) {
    if (!check_bitrix_sessid()) {
        CAdminMessage::ShowMessage(array("MESSAGE" => GetMessage("MAIN_DUMP_ERROR"), "DETAILS" => GetMessage("DUMP_MAIN_SESISON_ERROR"), "TYPE" => "ERROR", "HTML" => true));
    } else {
        $BUCKET_ID = $_REQUEST['dump_bucket_id'];
        if (!$bMcrypt) {
Exemple #3
0
 public static function GetServerName()
 {
     if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
         $server_name = SITE_SERVER_NAME;
     }
     if (!$server_name) {
         $server_name = COption::GetOptionString("main", "server_name", "");
     }
     if (!$server_name) {
         $server_name = $_SERVER['HTTP_HOST'];
     }
     $server_name = rtrim($server_name, '/');
     if (!preg_match('/^[a-z0-9\\.\\-]+$/i', $server_name)) {
         $converter = new CBXPunycode(defined('BX_UTF') && BX_UTF === true ? 'UTF-8' : 'windows-1251');
         $host = $converter->Encode($server_name);
         if (!preg_match('#--p1ai$#', $host)) {
             // trying to guess
             $host = $converter->Encode(CharsetConverter::ConvertCharset($server_name, 'utf-8', 'windows-1251'));
         }
         $server_name = $host;
     }
     return $server_name;
 }
Exemple #4
0
	public static function GetServerPath()
	{
		if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0)
			$server_name = SITE_SERVER_NAME;
		if (!$server_name)
			$server_name = COption::GetOptionString("main", "server_name", "");
		if (!$server_name)
			$server_name = $_SERVER['HTTP_HOST'];
		$server_name = rtrim($server_name, '/');
		if (!preg_match('/^[a-z0-9\.\-]+$/i', $server_name)) // cyrillic domain hack
		{
			$converter = new CBXPunycode(defined('BX_UTF') && BX_UTF === true ? 'UTF-8' : 'windows-1251');
			$host = $converter->Encode($server_name);
			if (!preg_match('#--p1ai$#', $host)) // trying to guess
				$host = $converter->Encode(CharsetConverter::ConvertCharset($server_name, 'utf-8', 'windows-1251'));
			$server_name = $host;
		}

		$serverPath = (CMain::IsHTTPS() ? "https://" : "http://").$server_name;

		return $serverPath;
	}