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


PHP FileHandler::copyDir方法代码示例

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


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

示例1: copyDir

 /**
  * @brief 특정 디렉토리를 복사
  **/
 function copyDir($source_dir, $target_dir, $filter = null, $type = null)
 {
     $source_dir = FileHandler::getRealPath($source_dir);
     $target_dir = FileHandler::getRealPath($target_dir);
     if (!is_dir($source_dir)) {
         return false;
     }
     // target이 없을땐 생성
     if (!file_exists($target_dir)) {
         FileHandler::makeDir($target_dir);
     }
     if (substr($source_dir, -1) != '/') {
         $source_dir .= '/';
     }
     if (substr($target_dir, -1) != '/') {
         $target_dir .= '/';
     }
     $oDir = dir($source_dir);
     while ($file = $oDir->read()) {
         if (substr($file, 0, 1) == '.') {
             continue;
         }
         if ($filter && preg_match($filter, $file)) {
             continue;
         }
         if (is_dir($source_dir . $file)) {
             FileHandler::copyDir($source_dir . $file, $target_dir . $file, $type);
         } else {
             if ($type == 'force') {
                 @unlink($target_dir . $file);
             } else {
                 if (!file_exists($target_dir . $file)) {
                     @copy($source_dir . $file, $target_dir . $file);
                 }
             }
         }
     }
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:41,代码来源:FileHandler.class.php

示例2: procLayoutAdminUserLayoutExport

 /**
  * export user layout
  * @return void
  */
 function procLayoutAdminUserLayoutExport()
 {
     $layout_srl = Context::get('layout_srl');
     if (!$layout_srl) {
         return new Object('-1', 'msg_invalid_request');
     }
     require_once _XE_PATH_ . 'libs/tar.class.php';
     $oLayoutModel = getModel('layout');
     // Copy files to temp path
     $file_path = $oLayoutModel->getUserLayoutPath($layout_srl);
     $target_path = $oLayoutModel->getUserLayoutPath(0);
     FileHandler::copyDir($file_path, $target_path);
     // replace path and ini config
     $ini_config = $oLayoutModel->getUserLayoutIniConfig(0);
     $file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);
     unset($file_list[2]);
     foreach ($file_list as $file) {
         if (strncasecmp('images', $file, 6) === 0) {
             continue;
         }
         // replace path
         $file = $target_path . $file;
         $content = FileHandler::readFile($file);
         $pattern = '/(http:\\/\\/[^ ]+)?(\\.\\/)?' . str_replace('/', '\\/', str_replace('./', '', $file_path)) . '/';
         if (basename($file) == 'faceoff.css' || basename($file) == 'layout.css') {
             $content = preg_replace($pattern, '../', $content);
         } else {
             $content = preg_replace($pattern, './', $content);
         }
         // replace ini config
         foreach ($ini_config as $key => $value) {
             $content = str_replace('{$layout_info->faceoff_ini_config[\'' . $key . '\']}', $value, $content);
         }
         FileHandler::writeFile($file, $content);
     }
     // make info.xml
     $info_file = $target_path . 'conf/info.xml';
     FileHandler::copyFile('./modules/layout/faceoff/conf/info.xml', $info_file);
     $content = FileHandler::readFile($info_file);
     $content = str_replace('type="faceoff"', '', $content);
     FileHandler::writeFile($info_file, $content);
     $file_list[] = 'conf/info.xml';
     // make css file
     $css_file = $target_path . 'css/layout.css';
     FileHandler::copyFile('./modules/layout/faceoff/css/layout.css', $css_file);
     $content = FileHandler::readFile('./modules/layout/tpl/css/widget.css');
     FileHandler::writeFile($css_file, "\n" . $content, 'a');
     $content = FileHandler::readFile($target_path . 'faceoff.css');
     FileHandler::writeFile($css_file, "\n" . $content, 'a');
     $content = FileHandler::readFile($target_path . 'layout.css');
     FileHandler::writeFile($css_file, "\n" . $content, 'a');
     // css load
     $content = FileHandler::readFile($target_path . 'layout.html');
     $content = "<load target=\"css/layout.css\" />\n" . $content;
     FileHandler::writeFile($target_path . 'layout.html', $content);
     unset($file_list[3]);
     unset($file_list[1]);
     $file_list[] = 'css/layout.css';
     // Compress the files
     $tar = new tar();
     $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath(0));
     chdir($user_layout_path);
     foreach ($file_list as $key => $file) {
         $tar->addFile($file);
     }
     $stream = $tar->toTarStream();
     $filename = 'faceoff_' . date('YmdHis') . '.tar';
     header("Cache-Control: ");
     header("Pragma: ");
     header("Content-Type: application/x-compressed");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     //            header("Content-Length: " .strlen($stream)); ?? why??
     header('Content-Disposition: attachment; filename="' . $filename . '"');
     header("Content-Transfer-Encoding: binary\n");
     echo $stream;
     // Close Context and then exit
     Context::close();
     // delete temp path
     FileHandler::removeDir($target_path);
     exit;
 }
开发者ID:ddmshu,项目名称:xe-core,代码行数:85,代码来源:layout.admin.controller.php

示例3: initTextyle

 function initTextyle($site_srl)
 {
     $oCounterController =& getController('counter');
     $oDocumentController =& getController('document');
     $oCommentController =& getController('comment');
     $oTagController =& getController('tag');
     $oAddonController =& getController('addon');
     $oEditorController =& getController('editor');
     $oTrackbackController =& getController('trackback');
     $oModuleModel =& getModel('module');
     $oTextyleModel =& getModel('textyle');
     $oMemberModel =& getModel('member');
     $site_info = $oModuleModel->getSiteInfo($site_srl);
     $module_srl = $site_info->index_module_srl;
     $args->site_srl = $site_srl;
     $oTextyle = new TextyleInfo($module_srl);
     if ($oTextyle->module_srl != $module_srl) {
         return new Object(-1, 'msg_invalid_request');
     }
     $oCounterController->deleteSiteCounterLogs($args->site_srl);
     $oAddonController->removeAddonConfig($args->site_srl);
     $args->module_srl = $module_srl;
     $output = executeQuery('textyle.deleteTextyleFavorites', $args);
     $output = executeQuery('textyle.deleteTextyleTags', $args);
     $output = executeQuery('textyle.deleteTextyleVoteLogs', $args);
     $output = executeQuery('textyle.deleteTextyleMemos', $args);
     $output = executeQuery('textyle.deleteTextyleReferer', $args);
     $output = executeQuery('textyle.deleteTextyleApis', $args);
     $output = executeQuery('textyle.deleteTextyleGuestbook', $args);
     $output = executeQuery('textyle.deleteTextyleSupporters', $args);
     $output = executeQuery('textyle.deletePublishLogs', $args);
     FileHandler::removeFile(sprintf("./files/cache/textyle/textyle_deny/%d.php", $module_srl));
     FileHandler::removeDir($oTextyleModel->getTextylePath($module_srl));
     // delete document comment tag
     $output = $oDocumentController->triggerDeleteModuleDocuments($args);
     $output = $oCommentController->triggerDeleteModuleComments($args);
     $output = $oTagController->triggerDeleteModuleTags($args);
     $output = $oTrackbackController->triggerDeleteModuleTrackbacks($args);
     $args->module_srl = $args->module_srl * -1;
     $output = $oDocumentController->triggerDeleteModuleDocuments($args);
     $output = $oCommentController->triggerDeleteModuleComments($args);
     $output = $oTagController->triggerDeleteModuleTags($args);
     $args->module_srl = $args->module_srl * -1;
     // set category
     $obj->module_srl = $module_srl;
     $obj->title = Context::getLang('init_category_title');
     $oDocumentController->insertCategory($obj);
     FileHandler::copyDir($this->module_path . 'skins/' . $this->skin, $oTextyleModel->getTextylePath($module_srl));
     $langType = Context::getLangType();
     $file = sprintf('%ssample/%s.html', $this->module_path, $langType);
     if (!file_exists(FileHandler::getRealPath($file))) {
         $file = sprintf('%ssample/ko.html', $this->module_path);
     }
     $member_info = $oMemberModel->getMemberInfoByEmailAddress($oTextyle->getUserId());
     $doc->module_srl = $module_srl;
     $doc->title = Context::getLang('sample_title');
     $doc->tags = Context::getLang('sample_tags');
     $doc->content = FileHandler::readFile($file);
     $doc->member_srl = $member_info->member_srl;
     $doc->user_id = $member_info->user_id;
     $doc->user_name = $member_info->user_name;
     $doc->nick_name = $member_info->nick_name;
     $doc->email_address = $member_info->email_address;
     $doc->homepage = $member_info->homepage;
     $output = $oDocumentController->insertDocument($doc, true);
     return new Object(1, 'success_textyle_init');
 }
开发者ID:google-code-backups,项目名称:xe-textyle,代码行数:67,代码来源:textyle.admin.controller.php

示例4: resetSkin

 /**
  * reset skin
  * @param $module_srl
  * @param null $skin
  */
 public function resetSkin($module_srl,$skin=NULL){
     if(!$skin) $skin = $this->skin;
     if(!file_exists($this->module_path.'skins/'.$skin)) $skin = $this->skin;
     $oShopModel = $this->model;
     FileHandler::removeDir($oShopModel->getShopPath($module_srl));
     FileHandler::copyDir($this->module_path.'skins/'.$skin, $oShopModel->getShopPath($module_srl));
 }
开发者ID:haegyung,项目名称:xe-module-shop,代码行数:12,代码来源:shop.controller.php

示例5: resetSkin

 function resetSkin($module_srl, $skin = null)
 {
     if (!$skin) {
         $skin = $this->skin;
     }
     if (!file_exists($this->module_path . 'skins/' . $skin)) {
         $skin = $this->skin;
     }
     $oTextyleModel =& getModel('textyle');
     FileHandler::removeDir($oTextyleModel->getTextylePath($module_srl));
     FileHandler::copyDir($this->module_path . 'skins/' . $skin, $oTextyleModel->getTextylePath($module_srl));
 }
开发者ID:google-code-backups,项目名称:xe-textyle,代码行数:12,代码来源:textyle.controller.php


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