require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/search/prolog.php");
IncludeModuleLangFile(__FILE__);
/** @global CMain $APPLICATION */
global $APPLICATION;
/** @var CAdminMessage $message */
$searchDB = CDatabase::GetModuleConnection('search');
$POST_RIGHT = $APPLICATION->GetGroupRight("search");
if($POST_RIGHT=="D")
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
$res = false;
$bFull = !isset($_REQUEST["Full"]) || $_REQUEST["Full"] != "N";
if($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["Reindex"]=="Y")
{
CUtil::JSPostUnescape();
@set_time_limit(0);
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_js.php");
if(array_key_exists("NS", $_POST) && is_array($_POST["NS"]))
{
$NS = $_POST["NS"];
}
else
{
$NS = array();
$max_execution_time = intval($max_execution_time);
if($max_execution_time <= 0)
$max_execution_time = '';
COption::SetOptionString("search", "max_execution_time", $max_execution_time);
if(!$bFull)
{
if(isset($_REQUEST["site_id"]) && $_REQUEST["site_id"] != "")
$NS["SITE_ID"] = $_REQUEST["site_id"];
if(isset($_REQUEST["module_id"]) && $_REQUEST["module_id"] != "")
$NS["MODULE_ID"] = $_REQUEST["module_id"];
}
}
//Check for expired session and set clear flag
//in order to not accidetialy clear search index
if(
$bFull
&& $NS["CLEAR"] != "Y"
&& !check_bitrix_sessid()
)
{
$NS["CLEAR"] = "Y";
}
$res = CSearch::ReIndexAll($bFull, COption::GetOptionInt("search", "max_execution_time"), $NS, $_REQUEST["clear_suggest"]==="Y");
if(is_array($res)):
$jsNS = CUtil::PhpToJSObject(array("NS"=>$res));
$urlNS = "";
foreach($res as $key => $value)
$urlNS .= "&".urlencode("NS[".$key."]")."=".urlencode($value);
if($bFull)
$urlNS .= "&Full=Y";
$path = "";
if($res["MODULE"] === "main")
{
list($site, $path) = explode("|", $res["ID"], 2);
if($path)
$path .= "
";
}
CAdminMessage::ShowMessage(array(
"MESSAGE"=>GetMessage("SEARCH_REINDEX_IN_PROGRESS"),
"DETAILS"=>GetMessage("SEARCH_REINDEX_TOTAL")." ".$res["CNT"]."
".$path."
".GetMessage("SEARCH_REINDEX_NEXT_STEP")."",
"HTML"=>true,
"TYPE"=>"PROGRESS",
));
?>
GetMessage("SEARCH_REINDEX_COMPLETE"),
"DETAILS"=>GetMessage("SEARCH_REINDEX_TOTAL")." ".$res."",
"HTML"=>true,
"TYPE"=>"OK",
));
if(IsModuleInstalled("socialnetwork"))
{
CAdminMessage::ShowMessage(array(
"MESSAGE"=>GetMessage("SEARCH_REINDEX_SOCNET_WARNING"),
"DETAILS"=>GetMessage("SEARCH_REINDEX_SOCNET_WARN_DETAILS"),
"HTML"=>true,
"TYPE"=>"ERROR",
));
}
?>
SetTitle(GetMessage("SEARCH_REINDEX_TITLE"));
$aTabs = array(
array("DIV" => "edit1", "TAB" => GetMessage("SEARCH_REINDEX_TAB"), "ICON"=>"main_user_edit", "TITLE"=>GetMessage("SEARCH_REINDEX_TAB_TITLE")),
);
$tabControl = new CAdminTabControl("tabControl", $aTabs, true, true);
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
if(is_object($message))
echo '