if ($arOption[1][0] == "checkbox" && $val != "Y") { $val = "N"; } COption::SetOptionString("search", $name, $val, $arOption[0]); } } if ($old_use_tf_cache != COption::GetOptionString("search", "use_tf_cache") || $old_max_result_size != COption::GetOptionInt("search", "max_result_size")) { $DBsearch = CDatabase::GetModuleConnection('search'); $DBsearch->Query("TRUNCATE TABLE b_search_content_freq"); } if ($old_full_text_engine != COption::GetOptionString("search", "full_text_engine")) { COption::SetOptionString("search", "full_reindex_required", "Y"); } } } CSearchStatistic::SetActive(COption::GetOptionString("search", "stat_phrase") == "Y"); if (!$bVarsFromForm) { if (strlen($Update) > 0 && strlen($_REQUEST["back_url_settings"]) > 0) { LocalRedirect($_REQUEST["back_url_settings"]); } else { LocalRedirect($APPLICATION->GetCurPage() . "?mid=" . urlencode($mid) . "&lang=" . urlencode(LANGUAGE_ID) . "&back_url_settings=" . urlencode($_REQUEST["back_url_settings"]) . "&" . $tabControl->ActiveTabParam()); } } } if (is_object($message)) { echo $message->Show(); } $aMenu = array(array("TEXT" => GetMessage("SEARCH_OPTIONS_REINDEX"), "LINK" => "search_reindex.php?lang=" . LANGUAGE_ID, "TITLE" => GetMessage("SEARCH_OPTIONS_REINDEX_TITLE")), array("TEXT" => GetMessage("SEARCH_OPTIONS_SITEMAP"), "LINK" => "search_sitemap.php?lang=" . LANGUAGE_ID, "TITLE" => GetMessage("SEARCH_OPTIONS_SITEMAP_TITLE"))); $context = new CAdminContextMenu($aMenu); $context->Show(); $tabControl->Begin();
function InstallDB($arParams = array()) { global $DBType, $APPLICATION; $this->errors = false; $node_id = strlen($arParams["DATABASE"]) > 0 ? intval($arParams["DATABASE"]) : false; if ($node_id !== false) { $DB = $GLOBALS["DB"]->GetDBNodeConnection($node_id); } else { $DB = $GLOBALS["DB"]; } // Database tables creation if (!$DB->Query("SELECT 'x' FROM b_search_content WHERE 1=0", true)) { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/search/install/db/" . strtolower($DB->type) . "/install.sql"); if ($this->errors === false && strtolower($DB->type) == "mssql") { $rs = $DB->Query("\n\t\t\t\t\tselect c.*\n\t\t\t\t\tfrom sys.tables t\n\t\t\t\t\tinner join sys.columns c on t.object_id = c.object_id\n\t\t\t\t\twhere t.name='b_search_tags'\n\t\t\t\t\tand c.name='NAME'\n\t\t\t\t"); if ($ar = $rs->Fetch()) { if (strpos($ar["collation_name"], "_CI_") !== false) { $new_collation = str_replace("_CI_", "_CS_", $ar["collation_name"]); $rs = $DB->Query("DROP TABLE b_search_tags"); if ($rs) { $rs = $DB->Query("\n\t\t\t\t\t\t\t\tCREATE TABLE b_search_tags\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\tSEARCH_CONTENT_ID INT NOT NULL,\n\t\t\t\t\t\t\t\t\tSITE_ID CHAR(2) NOT NULL,\n\t\t\t\t\t\t\t\t\tNAME VARCHAR(255) COLLATE " . $new_collation . " NOT NULL,\n\t\t\t\t\t\t\t\t\tCONSTRAINT PK_B_SEARCH_TAGS PRIMARY KEY (SEARCH_CONTENT_ID, SITE_ID, NAME)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t"); } if (!$rs) { $this->errors = array($DB->db_Error); } } } } } if ($this->errors === false && !$DB->Query("SELECT 'x' FROM b_search_phrase WHERE 1=0", true)) { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/search/install/db/" . strtolower($DB->type) . "/stat_install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } else { RegisterModule("search"); CModule::IncludeModule("search"); RegisterModuleDependences("main", "OnChangePermissions", "search", "CSearch", "OnChangeFilePermissions"); RegisterModuleDependences("main", "OnChangeFile", "search", "CSearch", "OnChangeFile"); RegisterModuleDependences("main", "OnGroupDelete", "search", "CSearch", "OnGroupDelete"); RegisterModuleDependences("main", "OnLangDelete", "search", "CSearch", "OnLangDelete"); RegisterModuleDependences("main", "OnAfterUserUpdate", "search", "CSearchUser", "OnAfterUserUpdate"); RegisterModuleDependences("main", "OnUserDelete", "search", "CSearchUser", "DeleteByUserID"); RegisterModuleDependences("cluster", "OnGetTableList", "search", "search", "OnGetTableList"); RegisterModuleDependences("perfmon", "OnGetTableSchema", "search", "search", "OnGetTableSchema"); if ($node_id !== false) { COption::SetOptionString("search", "dbnode_id", $node_id); if (CModule::IncludeModule('cluster')) { CClusterDBNode::SetOnline($node_id); } } else { COption::SetOptionString("search", "dbnode_id", "N"); } COption::SetOptionString("search", "dbnode_status", "ok"); CAgent::AddAgent("CSearchSuggest::CleanUpAgent();", "search", "N", 86400, "", "Y", "", 10); CAgent::AddAgent("CSearchStatistic::CleanUpAgent();", "search", "N", 86400, "", "Y", "", 10); CSearchStatistic::SetActive(COption::GetOptionString("search", "stat_phrase") == "Y"); return true; } }