本文整理汇总了PHP中CSearch::CheckPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CSearch::CheckPath方法的具体用法?PHP CSearch::CheckPath怎么用?PHP CSearch::CheckPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSearch
的用法示例。
在下文中一共展示了CSearch::CheckPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnChangeFilePermissions
function OnChangeFilePermissions($path, $permission = array(), $old_permission = array(), $arGroups = false)
{
global $APPLICATION;
$DB = CDatabase::GetModuleConnection('search');
$site = false;
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$path = rtrim($path, "/");
if(!is_array($arGroups))
{
$arGroups = CSearch::GetGroupCached();
//Check if anonymous permission was changed
if(!array_key_exists(2, $permission) && array_key_exists("*", $permission))
$permission[2] = $permission["*"];
if(!is_array($old_permission))
$old_permission = array();
if(!array_key_exists(2, $old_permission) && array_key_exists("*", $old_permission))
$old_permission[2] = $old_permission["*"];
//And if not when will do nothing
if(
(array_key_exists(2, $permission)
&& $permission[2] >= "R")
&& array_key_exists(2, $old_permission)
&& $old_permission[2] >= "R"
)
{
return;
}
}
if(file_exists($DOC_ROOT.$path))
{
@set_time_limit(300);
if(is_dir($DOC_ROOT.$path))
{
$handle = @opendir($DOC_ROOT.$path);
while(false !== ($file = @readdir($handle)))
{
if($file == "." || $file == "..")
continue;
$full_file = $path."/".$file;
if($full_file == "/bitrix")
continue;
if(is_dir($DOC_ROOT.$full_file) || CSearch::CheckPath($full_file))
CSearch::OnChangeFilePermissions(array($site, $full_file), array(), array(), $arGroups);
}
}
else//if(is_dir($DOC_ROOT.$path))
{
$rs = $DB->Query("
SELECT SC.ID
FROM b_search_content SC
WHERE MODULE_ID='main'
AND ITEM_ID='".$DB->ForSql($site."|".$path)."'
", false, "File: ".__FILE__."<br>Line: ".__LINE__);
if($ar = $rs->Fetch())
{
$arNewGroups = array();
foreach($arGroups as $group_id)
{
$p = $APPLICATION->GetFileAccessPermission(array($site, $path), array($group_id));
if($p >= "R")
{
$arNewGroups[$group_id] = 'G'.$group_id;
if($group_id == 2)
break;
}
}
CAllSearch::SetContentItemGroups($ar["ID"], $arNewGroups);
}
} //if(is_dir($DOC_ROOT.$path))
}//if(file_exists($DOC_ROOT.$path))
}