當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dir::copyDir方法代碼示例

本文整理匯總了PHP中Dir::copyDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dir::copyDir方法的具體用法?PHP Dir::copyDir怎麽用?PHP Dir::copyDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dir的用法示例。


在下文中一共展示了Dir::copyDir方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: install

 public function install()
 {
     define("INSTALL", true);
     import("Dir");
     //安裝目錄
     $path = APP_PATH . C("APP_GROUP_PATH") . DIRECTORY_SEPARATOR . $this->config['module'] . DIRECTORY_SEPARATOR . 'Install' . DIRECTORY_SEPARATOR;
     $Dir = new Dir();
     //SQL文件
     if (file_exists($path . $this->config['module'] . '.sql')) {
         $sql = file_get_contents($path . $this->config['module'] . '.sql');
         $sql_split = $this->sql_split($sql, C("DB_PREFIX"));
         $db = M('');
         if (is_array($sql_split)) {
             foreach ($sql_split as $s) {
                 $db->execute($s);
             }
         }
     }
     //Extention,菜單添加
     if (file_exists($path . 'Extention.inc.php')) {
         @(include $path . 'Extention.inc.php');
     }
     //前台模板
     if (file_exists($path . "Template" . DIRECTORY_SEPARATOR)) {
         $Dir->copyDir($path . "Template", $this->templatePath);
     }
     D("Module")->add(array("module" => $this->config['module'], "name" => $this->config['modulename'], "iscore" => 0, "version" => $this->config['version'], "description" => $this->config['introduce'], "disabled" => 1, "installdate" => date("Y-m-d"), "updatedate" => date("Y-m-d")));
     return true;
 }
開發者ID:BGCX262,項目名稱:ztoa-svn-to-git,代碼行數:29,代碼來源:Module.class.php

示例2: copyDir

 function copyDir($source, $destination)
 {
     if (is_dir($source) == false) {
         exit("The Source Directory Is Not Exist!");
     }
     if (is_dir($destination) == false) {
         mkdir($destination, 0700);
     }
     $handle = opendir($source);
     while (false !== ($file = readdir($handle))) {
         if ($file != "." && $file != "..") {
             is_dir("{$source}/{$file}") ? Dir::copyDir("{$source}/{$file}", "{$destination}/{$file}") : copy("{$source}/{$file}", "{$destination}/{$file}");
         }
     }
     closedir($handle);
 }
開發者ID:hello7921,項目名稱:haorizi,代碼行數:16,代碼來源:Dir.class.php

示例3: copyDir

 /**
  +----------------------------------------------------------
 * 複製目錄
  +----------------------------------------------------------
 * @access static
  +----------------------------------------------------------
 * @return void
  +----------------------------------------------------------
 */
 function copyDir($source, $destination)
 {
     if (is_dir($source) == false) {
         $this->error = "源目錄不存在!";
         return false;
     }
     if (is_dir($destination) == false) {
         mkdir($destination, 0700);
     }
     $handle = opendir($source);
     while (false !== ($file = readdir($handle))) {
         if ($file != "." && $file != "..") {
             is_dir("{$source}/{$file}") ? Dir::copyDir("{$source}/{$file}", "{$destination}/{$file}") : copy("{$source}/{$file}", "{$destination}/{$file}");
         }
     }
     closedir($handle);
 }
開發者ID:qq907274532,項目名稱:cms,代碼行數:26,代碼來源:Dir.class.php

示例4: install

 /**
  * 執行模塊安裝
  * @param type $moduleName 模塊名(目錄名)
  * @return boolean
  */
 public function install($moduleName = '')
 {
     defined('INSTALL') or define("INSTALL", true);
     if (empty($moduleName)) {
         if ($this->moduleName) {
             $moduleName = $this->moduleName;
         } else {
             $this->error = '請選擇需要安裝的模塊!';
             return false;
         }
     }
     //已安裝模塊列表
     $moduleList = cache('Module');
     //設置腳本最大執行時間
     set_time_limit(0);
     if ($this->competence($moduleName) !== true) {
         return false;
     }
     //加載模塊基本配置
     $config = $this->config($moduleName);
     //版本檢查
     if ($config['adaptation']) {
         if (version_compare(SHUIPF_VERSION, $config['adaptation'], '>=') == false) {
             $this->error = '該模塊要求係統最低版本為:' . $config['adaptation'] . '!';
             return false;
         }
     }
     //依賴模塊檢測
     if (!empty($config['depend']) && is_array($config['depend'])) {
         foreach ($config['depend'] as $mod) {
             if ('Content' == $mod) {
                 continue;
             }
             if (!isset($moduleList[$mod])) {
                 $this->error = "安裝該模塊,需要安裝依賴模塊 {$mod} !";
                 return false;
             }
         }
     }
     //檢查模塊是否已經安裝
     if ($this->isInstall($moduleName)) {
         $this->error = '該模塊已經安裝,無法重複安裝!';
         return false;
     }
     $model = D('Common/Module');
     if (!$model->create($config, 1)) {
         $this->error = $model->getError() ?: '安裝初始化失敗!';
         return false;
     }
     if ($model->add() == false) {
         $this->error = '安裝失敗!';
         return false;
     }
     //執行安裝腳本
     if (!$this->runInstallScript($moduleName)) {
         $this->installRollback($moduleName);
         return false;
     }
     //執行數據庫腳本安裝
     $this->runSQL($moduleName);
     //執行菜單項安裝
     if ($this->installMenu($moduleName) !== true) {
         $this->installRollback($moduleName);
         return false;
     }
     //緩存注冊
     if (!empty($config['cache'])) {
         if (D('Common/Cache')->installModuleCache($config['cache'], $config) !== true) {
             $this->error = D('Common/Cache')->getError();
             $this->installRollback($moduleName);
             return false;
         }
     }
     $Dir = new \Dir();
     //前台模板
     if (file_exists($this->appPath . "{$moduleName}/Install/Template/")) {
         //拷貝模板到前台模板目錄中去
         $Dir->copyDir($this->appPath . "{$moduleName}/Install/Template/", $this->templatePath);
     }
     //靜態資源文件
     if (file_exists($this->appPath . "{$moduleName}/Install/Extres/")) {
         //拷貝模板到前台模板目錄中去
         $Dir->copyDir($this->appPath . "{$moduleName}/Install/Extres/", $this->extresPath . strtolower($moduleName) . '/');
     }
     //安裝行為
     if (!empty($config['tags'])) {
         D('Common/Behavior')->moduleBehaviorInstallation($moduleName, $config['tags']);
     }
     //安裝結束,最後調用安裝腳本完成
     $this->runInstallScriptEnd($moduleName);
     //更新緩存
     cache('Module', NULL);
     return true;
 }
開發者ID:sandom123,項目名稱:king400,代碼行數:99,代碼來源:Module.class.php

示例5: copyDir

 public function copyDir($source, $destination)
 {
     if (is_dir($source) == false) {
         exit('The Source Directory Is Not Exist!');
     }
     if (is_dir($destination) == false) {
         mkdir($destination, 448);
     }
     $handle = opendir($source);
     while (false !== ($file = readdir($handle))) {
         if ($file != '.' && $file != '..') {
             is_dir($source . '/' . $file) ? Dir::copyDir($source . '/' . $file, $destination . '/' . $file) : copy($source . '/' . $file, $destination . '/' . $file);
         }
     }
     closedir($handle);
 }
開發者ID:fkssei,項目名稱:pigcms10,代碼行數:16,代碼來源:Dir.class.php


注:本文中的Dir::copyDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。