本文整理汇总了PHP中CSearch::RecurseIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP CSearch::RecurseIndex方法的具体用法?PHP CSearch::RecurseIndex怎么用?PHP CSearch::RecurseIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSearch
的用法示例。
在下文中一共展示了CSearch::RecurseIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RecurseIndex
function RecurseIndex($path=Array(), $max_execution_time = 0, &$NS)
{
global $APPLICATION;
if(!is_array($path))
return 0;
$site = $path[0];
$path = $path[1];
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$abs_path = $DOC_ROOT.$path;
$io = CBXVirtualIo::GetInstance();
if(!$io->DirectoryExists($abs_path))
return 0;
$f = $io->GetFile($abs_path);
if(!$f->IsReadable())
return 0;
$d = $io->GetDirectory($abs_path);
foreach($d->GetChildren() as $dir_entry)
{
$path_file = $path."/".$dir_entry->GetName();
if($dir_entry->IsDirectory())
{
if($path_file == "/bitrix")
continue;
//this is not first step and we had stopped here, so go on to reindex
if(
$max_execution_time <= 0
|| strlen($NS["MODULE"]) <= 0
|| (
$NS["MODULE"]=="main"
&& substr($NS["ID"]."/", 0, strlen($site."|".$path_file."/")) == $site."|".$path_file."/"
)
)
{
if(CSearch::CheckPath($path_file."/") !== false)
{
if(CSearch::RecurseIndex(Array($site, $path_file), $max_execution_time, $NS)===false)
return false;
}
}
else //all done
{
continue;
}
}
else
{
//not the first step and we found last file from previous one
if(
$max_execution_time > 0
&& strlen($NS["MODULE"]) > 0
&& $NS["MODULE"]=="main"
&& $NS["ID"] == $site."|".$path_file
)
{
$NS["MODULE"] = "";
}
elseif(strlen($NS["MODULE"]) <= 0)
{
$ID = CSearch::ReindexFile(Array($site, $path_file), $NS["SESS_ID"]);
if(IntVal($ID)>0)
{
$NS["CNT"] = IntVal($NS["CNT"]) + 1;
}
if(
$max_execution_time > 0
&& (getmicrotime() - START_EXEC_TIME > $max_execution_time)
)
{
$NS["MODULE"] = "main";
$NS["ID"] = $site."|".$path_file;
return false;
}
}
}
}
return true;
}