本文整理汇总了PHP中CUrlRewriter::RecurseIndex方法的典型用法代码示例。如果您正苦于以下问题:PHP CUrlRewriter::RecurseIndex方法的具体用法?PHP CUrlRewriter::RecurseIndex怎么用?PHP CUrlRewriter::RecurseIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUrlRewriter
的用法示例。
在下文中一共展示了CUrlRewriter::RecurseIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RecurseIndex
function RecurseIndex($path = array(), $max_execution_time = 0, &$NS)
{
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$abs_path = $DOC_ROOT . $path;
if (strlen($site) <= 0) {
return 0;
}
if (!file_exists($abs_path) || !is_dir($abs_path)) {
return 0;
}
$handle = @opendir($abs_path);
while (false !== ($file = @readdir($handle))) {
if ($file == "." || $file == "..") {
continue;
}
$full_path = $path . "/" . $file;
if (is_dir($abs_path . "/" . $file)) {
if ($full_path == "/bitrix" || $full_path == "/" . COption::GetOptionString("main", "upload_dir", "upload")) {
continue;
}
//this is not first step and we had stopped here, so go on to reindex
if ($max_execution_time <= 0 || strlen($NS["FLG"]) <= 0 || strlen($NS["FLG"]) > 0 && substr($NS["ID"] . "/", 0, strlen($site . "|" . $full_path . "/")) == $site . "|" . $full_path . "/") {
$new_site = CSite::GetSiteByFullPath($DOC_ROOT . $full_path);
if (CUrlRewriter::RecurseIndex(array($new_site, $full_path), $max_execution_time, $NS) === false) {
return false;
}
} else {
//all done
continue;
}
} else {
//not the first step and we found last file from previos one
if ($max_execution_time > 0 && strlen($NS["FLG"]) > 0 && $NS["ID"] == $site . "|" . $full_path) {
$NS["FLG"] = "";
} elseif (strlen($NS["FLG"]) <= 0) {
$ID = CUrlRewriter::ReindexFile(array($site, $full_path), $NS["SESS_ID"], $NS["max_file_size"]);
if ($ID) {
$NS["CNT"] = intval($NS["CNT"]) + 1;
}
}
if ($max_execution_time > 0 && getmicrotime() - START_EXEC_TIME > $max_execution_time) {
$NS["FLG"] = "Y";
$NS["ID"] = $site . "|" . $full_path;
return false;
}
}
}
return true;
}