本文整理匯總了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))
}