Пример #1
0
	function OnEpilog()
	{
		if(isset($_REQUEST["sphrase_id"]))
		{
			$phrase_id = intval($_REQUEST["sphrase_id"]);
			if($phrase_id)
			{
				$DB = CDatabase::GetModuleConnection('search');

				$rs = $DB->Query("
					SELECT *
					FROM b_search_phrase
					WHERE ID = ".$phrase_id."
					AND SESSION_ID = '".$DB->ForSQL(freetrix_sessid())."'
					AND URL_TO IS NULL
				");
				if($ar = $rs->Fetch())
				{
					$URL_TO = $DB->ForSQL(CSearchStatistic::GetCurrentURL(), 2000);
					$DB->Query("
						UPDATE b_search_phrase
						SET URL_TO = '".$URL_TO."'
							,URL_TO_404 = '".(defined("ERROR_404")? "Y": "N")."'
							,URL_TO_SITE_ID = ".(defined("SITE_ID")? "'".$DB->ForSQL(SITE_ID, 2)."'": "null")."
						WHERE ID = ".$phrase_id."
					");
				}
			}
		}
	}
Пример #2
0
                    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();
    $arFilter["=STAT_SESS_ID"] = $find_stat_sess_id;
} else {
    $arFilter["STAT_SESS_ID"] = $find_stat_sess_id;
}
if ($_REQUEST["find_url_to_exact_match"] == "Y") {
    $arFilter["=URL_TO"] = $find_url_to;
} else {
    $arFilter["URL_TO"] = $find_url_to;
}
$arFilter["=URL_TO_404"] = $find_url_to_404;
foreach ($arFilter as $key => $value) {
    if (!strlen($value)) {
        unset($arFilter[$key]);
    }
}
$rsData = CSearchStatistic::GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
// navigation setup
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("SEARCH_PHL_PHRASES")));
$aContext = array();
$lAdmin->AddAdminContextMenu($aContext);
$arHeaders = array(array("id" => "ID", "content" => GetMessage("SEARCH_PHL_ID"), "sort" => "ID", "default" => true, "align" => "right"), array("id" => "SITE_ID", "content" => GetMessage("SEARCH_PHL_SITE_ID"), "default" => true), array("id" => "PHRASE", "content" => GetMessage("SEARCH_PHL_PHRASE"), "sort" => "PHRASE", "default" => true), array("id" => "TAGS", "content" => GetMessage("SEARCH_PHL_TAGS"), "sort" => "TAGS", "default" => true), array("id" => "TIMESTAMP_X", "content" => GetMessage("SEARCH_PHL_TIMESTAMP_X"), "sort" => "TIMESTAMP_X", "default" => true), array("id" => "URL_TO", "content" => GetMessage("SEARCH_PHL_URL_TO"), "sort" => "URL_TO", "default" => true), array("id" => "RESULT_COUNT", "content" => GetMessage("SEARCH_PHL_RESULT_COUNT"), "sort" => "RESULT_COUNT", "default" => true, "align" => "right"), array("id" => "PAGES", "content" => GetMessage("SEARCH_PHL_PAGES"), "title" => GetMessage("SEARCH_PHL_PAGES_ALT"), "sort" => "PAGES", "default" => true, "align" => "right"));
if (IsModuleInstalled('statistic')) {
    $arHeaders[] = array("id" => "STAT_SESS_ID", "content" => GetMessage("SEARCH_PHL_STAT_SESS_ID"), "sort" => "STAT_SESS_ID", "default" => true, "align" => "right");
}
$lAdmin->AddHeaders($arHeaders);
$i = 0;
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes);
    if ($_REQUEST["mode"] != "excel") {
Пример #4
0
 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;
     }
 }