本文整理汇总了PHP中CSearch::ReindexLock方法的典型用法代码示例。如果您正苦于以下问题:PHP CSearch::ReindexLock方法的具体用法?PHP CSearch::ReindexLock怎么用?PHP CSearch::ReindexLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSearch
的用法示例。
在下文中一共展示了CSearch::ReindexLock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ReIndexAll
function ReIndexAll($bFull = false, $max_execution_time = 0, $NS = Array(), $clear_suggest = false)
{
global $APPLICATION;
$DB = CDatabase::GetModuleConnection('search');
@set_time_limit(0);
if(!is_array($NS))
$NS = Array();
if($max_execution_time<=0)
{
$NS_OLD=$NS;
$NS=Array("CLEAR"=>"N", "MODULE"=>"", "ID"=>"", "SESS_ID"=>md5(uniqid("")));
if($NS_OLD["SITE_ID"]!="") $NS["SITE_ID"]=$NS_OLD["SITE_ID"];
if($NS_OLD["MODULE_ID"]!="") $NS["MODULE_ID"]=$NS_OLD["MODULE_ID"];
}
$NS["CNT"] = IntVal($NS["CNT"]);
if(!$bFull && strlen($NS["SESS_ID"])!=32)
$NS["SESS_ID"] = md5(uniqid(""));
$p1 = getmicrotime();
$DB->StartTransaction();
CSearch::ReindexLock();
if($NS["CLEAR"] != "Y")
{
if($bFull)
{
foreach(GetModuleEvents("search", "OnBeforeFullReindexClear", true) as $arEvent)
ExecuteModuleEventEx($arEvent);
CSearchTags::CleanCache();
$DB->Query("TRUNCATE TABLE b_search_content_param", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_content_site", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_content_right", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_content_title", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_tags", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_content_freq", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_content", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_suggest", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_user_right", false, "File: ".__FILE__."<br>Line: ".__LINE__);
CSearchFullText::getInstance()->truncate();
COption::SetOptionString("search", "full_reindex_required", "N");
}
elseif($clear_suggest)
{
$DB->Query("TRUNCATE TABLE b_search_suggest", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_user_right", false, "File: ".__FILE__."<br>Line: ".__LINE__);
$DB->Query("TRUNCATE TABLE b_search_content_freq", false, "File: ".__FILE__."<br>Line: ".__LINE__);
}
}
$NS["CLEAR"] = "Y";
clearstatcache();
if(
($NS["MODULE"]=="" || $NS["MODULE"]=="main") &&
($NS["MODULE_ID"]=="" || $NS["MODULE_ID"]=="main")
)
{
$arLangDirs = Array();
$arFilter = Array("ACTIVE"=>"Y");
if($NS["SITE_ID"]!="")
$arFilter["ID"]=$NS["SITE_ID"];
$r = CSite::GetList($by="sort", $order="asc", $arFilter);
while($arR = $r->Fetch())
{
$path = rtrim($arR["DIR"], "/");
$arLangDirs[$arR["ABS_DOC_ROOT"]."/".$path."/"] = $arR;
}
//get rid of duplicates
$dub = Array();
foreach($arLangDirs as $path=>$arR)
{
foreach($arLangDirs as $path2=>$arR2)
{
if($path==$path2) continue;
if(substr($path, 0, strlen($path2)) == $path2)
$dub[] = $path;
}
}
foreach($dub as $p)
unset($arLangDirs[$p]);
foreach($arLangDirs as $arR)
{
$site = $arR["ID"];
$path = rtrim($arR["DIR"], "/");
$site_path = $site."|".$path."/";
if(
$max_execution_time > 0
&& $NS["MODULE"] == "main"
&& substr($NS["ID"]."/", 0, strlen($site_path)) != $site_path
)
continue;
//.........这里部分代码省略.........