本文整理匯總了PHP中CSearch::DeleteOld方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSearch::DeleteOld方法的具體用法?PHP CSearch::DeleteOld怎麽用?PHP CSearch::DeleteOld使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CSearch
的用法示例。
在下文中一共展示了CSearch::DeleteOld方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ReindexModule
function ReindexModule($MODULE_ID, $bFull=false)
{
global $APPLICATION;
$DB = CDatabase::GetModuleConnection('search');
if($bFull)
CSearch::DeleteForReindex($MODULE_ID);
$NS=Array("CLEAR"=>"N", "MODULE"=>"", "ID"=>"", "SESS_ID"=>md5(uniqid("")));
//for every who wants to be reindexed
foreach(GetModuleEvents("search", "OnReindex", true) as $arEvent)
{
if($arEvent["TO_MODULE_ID"]!=$MODULE_ID) continue;
$oCallBack = new CSearchCallback;
$oCallBack->MODULE = $arEvent["TO_MODULE_ID"];
$oCallBack->CNT = &$NS["CNT"];
$oCallBack->SESS_ID = $NS["SESS_ID"];
$r = &$oCallBack;
$arResult = ExecuteModuleEventEx($arEvent, array($NS, $r, "Index"));
if(is_array($arResult)) //old way
{
foreach($arResult as $arFields)
{
$ID = $arFields["ID"];
if(strlen($ID) > 0)
{
unset($arFields["ID"]);
$NS["CNT"]++;
CSearch::Index($arEvent["TO_MODULE_ID"], $ID, $arFields, false, $NS["SESS_ID"]);
}
}
}
else //new way
{
return Array("MODULE"=>$arEvent["TO_MODULE_ID"], "CNT"=>$oCallBack->CNT, "ID"=>$arResult, "CLEAR"=>$NS["CLEAR"], "SESS_ID"=>$NS["SESS_ID"]);
}
}
if(!$bFull)
CSearch::DeleteOld($NS["SESS_ID"], $MODULE_ID, $NS["SITE_ID"]);
}
示例2: StepIndex
//.........這裏部分代碼省略.........
$last_id = $this->ReindexIBlock($iblock, "G", "photo", "view", $path_template, array("PREVIEW_TEXT", "PROPERTY_FORUM_TOPIC_ID"), $last_id);
} else {
$last_id = 0;
}
break;
case "user_photos":
$path_template = trim($this->_params["PATH_TO_USER_PHOTO_ELEMENT"]);
$iblock = intval($this->_params["PHOTO_USER_IBLOCK_ID"]);
if (strlen($path_template) && $iblock) {
$last_id = $this->ReindexIBlock($iblock, "U", "photo", "view", $path_template, array("PREVIEW_TEXT", "PROPERTY_FORUM_TOPIC_ID"), $last_id);
} else {
$last_id = 0;
}
break;
case "group_calendars":
$path_template = trim($this->_params["PATH_TO_GROUP_CALENDAR_ELEMENT"]);
$iblock = intval($this->_params["CALENDAR_GROUP_IBLOCK_ID"]);
if (strlen($path_template) && $iblock) {
$last_id = $this->ReindexIBlock($iblock, "G", "calendar", "view", $path_template, array("DETAIL_TEXT"), $last_id);
} else {
$last_id = 0;
}
break;
case "group_tasks":
$path_template = trim($this->_params["PATH_TO_GROUP_TASK_ELEMENT"]);
$iblock = intval($this->_params["TASK_IBLOCK_ID"]);
if (strlen($path_template) && $iblock) {
$last_id = $this->ReindexGroupTasks($iblock, $path_template, $last_id);
} else {
$last_id = 0;
}
break;
case "user_tasks":
$path_template = trim($this->_params["PATH_TO_USER_TASK_ELEMENT"]);
if (strlen($path_template) && CModule::IncludeModule("iblock")) {
$iblock = intval($this->_params["TASK_IBLOCK_ID"]);
$rsSection = CIBlockSection::GetList(array(), array("GLOBAL_ACTIVE" => "Y", "EXTERNAL_ID" => "users_tasks", "IBLOCK_ID" => $iblock, "SECTION_ID" => 0), false);
$arSection = $rsSection->Fetch();
} else {
$arSection = false;
}
if ($arSection) {
$last_id = $this->ReindexUserTasks($arSection, $path_template, $last_id);
} else {
$last_id = 0;
}
break;
case "group_files":
$path_template = trim($this->_params["PATH_TO_GROUP_FILES_ELEMENT"]);
$iblock = intval($this->_params["FILES_GROUP_IBLOCK_ID"]);
$property = strtoupper(trim($this->_params["FILES_PROPERTY_CODE"]));
if (strlen($property) <= 0) {
$property = "FILE";
}
$this->_file_property = "PROPERTY_" . $property;
if (strlen($path_template) && $iblock) {
$last_id = $this->ReindexIBlock($iblock, "G", "files", "view", $path_template, array($this->_file_property, "PROPERTY_FORUM_TOPIC_ID"), $last_id);
} else {
$last_id = 0;
}
break;
case "group_wiki":
if (CModule::IncludeModule("wiki")) {
$path_template = trim($this->_params["PATH_TO_GROUP"]) . "wiki/#name#/";
$iblock = intval(COption::GetOptionInt("wiki", "socnet_iblock_id"));
if (strlen($path_template) && $iblock) {
$last_id = $this->ReindexIBlock($iblock, "G", "wiki", "view", $path_template, array("DETAIL_TEXT"), $last_id);
} else {
$last_id = 0;
}
}
break;
case "user_files":
$path_template = trim($this->_params["PATH_TO_USER_FILES_ELEMENT"]);
$iblock = intval($this->_params["FILES_USER_IBLOCK_ID"]);
$property = strtoupper(trim($this->_params["FILES_PROPERTY_CODE"]));
if (strlen($property) <= 0) {
$property = "FILE";
}
$this->_file_property = "PROPERTY_" . $property;
if (strlen($path_template) && $iblock) {
$last_id = $this->ReindexIBlock($iblock, "U", "files", "view", $path_template, array($this->_file_property, "PROPERTY_FORUM_TOPIC_ID"), $last_id);
} else {
$last_id = 0;
}
break;
case "delete_old":
CSearch::DeleteOld($_SESSION["BX_SOCNET_REINDEX_SESS_ID"], "socialnetwork");
$last_id = 0;
break;
default:
$last_id = 0;
break;
}
if ($last_id > 0 || preg_match('/^.\\d/', $last_id)) {
return array("step" => $current_step, "last_id" => $last_id);
} else {
return array("step" => $next_step, "last_id" => 0);
}
}