当前位置: 首页>>代码示例>>PHP>>正文


PHP CUrlRewriter::ReindexFile方法代码示例

本文整理汇总了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;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:30,代码来源:index.php

示例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;
 }
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:50,代码来源:urlrewriter.php


注:本文中的CUrlRewriter::ReindexFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。