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


PHP CFileMan::DeleteDir方法代码示例

本文整理汇总了PHP中CFileMan::DeleteDir方法的典型用法代码示例。如果您正苦于以下问题:PHP CFileMan::DeleteDir方法的具体用法?PHP CFileMan::DeleteDir怎么用?PHP CFileMan::DeleteDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileMan的用法示例。


在下文中一共展示了CFileMan::DeleteDir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CopyEx


//.........这里部分代码省略.........
         }
         $APPLICATION->CopyFileAccessPermission(array($site_from, $path_from), array($site_to, $path_to));
         //************************** Quota **************************//
         if (COption::GetOptionInt("main", "disk_space") > 0) {
             $f = $io->GetFile($DOC_ROOT_FROM . $path_from);
             $size = $f->GetFileSize();
             $quota = new CDiskQuota();
             if (!$quota->checkDiskQuota(array("FILE_SIZE" => $size))) {
                 return $quota->LAST_ERROR;
             }
         }
         //************************** Quota **************************//
         // Copy file
         if (DEBUG_FILE_MAN) {
             echo "copy(" . $DOC_ROOT_FROM . $path_from . "," . $DOC_ROOT_TO . $path_to . ");<br>";
         }
         if (!$io->Copy($DOC_ROOT_FROM . $path_from, $DOC_ROOT_TO . $path_to)) {
             $strWarning .= GetMessage('FILEMAN_COPY_ERROR', array('#PATH_FROM#' => htmlspecialcharsex($path_from), '#PATH_TO#' => htmlspecialcharsex($path_to)));
         }
         //************************** Quota **************************//
         if (COption::GetOptionInt("main", "disk_space") > 0) {
             $quota->updateDiskQuota("file", $size, "copy");
         }
         //************************** Quota **************************//
         if (CModule::IncludeModule("search")) {
             $site = CSite::GetSiteByFullPath($DOC_ROOT_TO . $path_to);
             CSearch::ReIndexFile(array($site_to, $path_to), $site);
         }
         if ($bDeleteAfterCopy && strlen($strWarning) <= 0) {
             // If was command "delete after copy"?
             $strWarning .= CFileMan::DeleteFile(array($site_from, $path_from));
         }
         return $strWarning;
     }
     // Recursive
     $d = $io->GetDirectory($DOC_ROOT_FROM . $path_from);
     $arChildren = $d->GetChildren();
     foreach ($arChildren as $child) {
         $fn = $child->GetName();
         if ($child->IsDirectory()) {
             //go to recursion
             $strWarning .= CFileMan::CopyEx(array($site_from, $path_from . "/" . $fn), array($site_to, $path_to . "/" . $fn), $bDeleteAfterCopy, $bOverride);
             //back from recursion, in this subfolder all right
             //if($bDeleteAfterCopy) //necessary delete this subfolder
             //	$strWarning .= CFileMan::DeleteDir($path_from."/".$file);
         } else {
             if ($fn == ".access.php") {
                 continue;
             }
             //let's check, if we can to write there
             if (!$USER->CanDoFileOperation('fm_create_new_file', array($site_to, $path_to . "/" . $fn))) {
                 $strWarning .= GetMessage("FILEMAN_FILEMAN_FILE_WRITE_DENY") . " \"" . $path_to . "/" . $fn . "\".\n";
             } elseif (!$USER->CanDoFileOperation('fm_view_file', array($site_from, $path_from . "/" . $fn))) {
                 $strWarning .= GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY") . " \"" . $path_from . "/" . $fn . "\".\n";
             } elseif (!($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', array($site_from, $path_from . "/" . $fn)) || !(HasScriptExtension($fn) || substr($fn, 0, 1) == "."))) {
                 $strWarning .= GetMessage("FILEMAN_FILEMAN_FILE_READ_DENY") . " \"" . $path_from . "/" . $fn . "\".\n";
             } else {
                 if ($io->FileExists($DOC_ROOT_TO . $path_to . "/" . $fn)) {
                     if ($bOverride) {
                         $strWarn = CFileMan::DeleteEx(array($site_to, $path_to . "/" . $fn));
                         if ($strWarn != "") {
                             $strWarning .= $strWarn . "\n";
                         }
                     } else {
                         $strWarning .= GetMessage("FILEMAN_FILEMAN_FILE_WITH_NAME") . " \"" . $path_to . "/" . $fn . "\" " . GetMessage("FILEMAN_FILEMAN_ALREADY_EXISTS") . "!\n";
                     }
                 }
                 if ($strWarning == "") {
                     //it means we can copy, if we found here
                     $APPLICATION->CopyFileAccessPermission(array($site_from, $path_from . "/" . $fn), array($site_to, $path_to . "/" . $fn));
                     if (DEBUG_FILE_MAN) {
                         echo "copy(" . $DOC_ROOT_FROM . $path_from . "/" . $fn . "," . $DOC_ROOT_TO . $path_to . "/" . $fn . ");<br>";
                     }
                     if (!$io->Copy($DOC_ROOT_FROM . $path_from . "/" . $fn, $DOC_ROOT_TO . $path_to . "/" . $fn)) {
                         $strWarning .= GetMessage('FILEMAN_COPY_ERROR', array('#PATH_FROM#' => htmlspecialcharsex($path_from . "/" . $fn), '#PATH_TO#' => htmlspecialcharsex($path_to . "/" . $fn)));
                     }
                     //************************** Quota **************************//
                     if (COption::GetOptionInt("main", "disk_space") > 0) {
                         $f = $io->GetFile($DOC_ROOT_TO . $path_to . "/" . $fn);
                         $quota = new CDiskQuota();
                         $quota->updateDiskQuota("file", $f->GetFileSize(), "copy");
                     }
                     //************************** Quota **************************//
                     if (CModule::IncludeModule("search")) {
                         $site = CSite::GetSiteByFullPath($DOC_ROOT_TO, $path_to . "/" . $fn);
                         CSearch::ReindexFile($path_to . "/" . $fn, $site);
                     }
                     if ($bDeleteAfterCopy && strlen($strWarning) <= 0) {
                         $strWarning .= CFileMan::DeleteFile(array($site_from, $path_from . "/" . $fn));
                     }
                 }
             }
         }
     }
     //we may be need, to delete our initial folder
     if ($bDeleteAfterCopy) {
         $strWarning .= CFileMan::DeleteDir(array($site_from, $path_from));
     }
     return $strWarning;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:fileman.php


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