当前位置: 首页>>代码示例>>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;未经允许,请勿转载。