本文整理汇总了PHP中CUrlRewriter::ReindexFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CUrlRewriter::ReindexFile方法的具体用法?PHP CUrlRewriter::ReindexFile怎么用?PHP CUrlRewriter::ReindexFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUrlRewriter
的用法示例。
在下文中一共展示了CUrlRewriter::ReindexFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstallFiles
function InstallFiles()
{
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/public/mobile/", $_SERVER["DOCUMENT_ROOT"] . "/mobile/", True, True);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/install/templates/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/", True, True);
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/install/components/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
$default_site_id = CSite::GetDefSite();
if ($default_site_id) {
$arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('/mobile/')", "TEMPLATE" => "mobile_app");
$arFields = array("TEMPLATE" => array());
$dbTemplates = CSite::GetTemplateList($default_site_id);
$mobileAppFound = false;
while ($template = $dbTemplates->Fetch()) {
if ($template["TEMPLATE"] == "mobile_app") {
$mobileAppFound = true;
$template = $arAppTempalate;
}
$arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
}
if (!$mobileAppFound) {
$arFields["TEMPLATE"][] = $arAppTempalate;
}
$obSite = new CSite();
$arFields["LID"] = $default_site_id;
$obSite->Update($default_site_id, $arFields);
}
CUrlRewriter::ReindexFile("/mobile/webdav/index.php");
CUrlRewriter::ReindexFile("/mobile/disk/index.php");
CUrlRewriter::Add(array("CONDITION" => "#^/mobile/disk/(?<hash>[0-9]+)/download#", "RULE" => "download=1&objectId=\$1", "ID" => "bitrix:mobile.disk.file.detail", "PATH" => "/mobile/disk/index.php"));
return true;
}
示例2: 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;
}