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


PHP CRM_Utils_File::copyDir方法代码示例

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


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

示例1: moveFiles

 public function moveFiles($id, $key, $deleteOrginal = false)
 {
     $e = self::$_extensions;
     if ($e['per_id'][$id]['status'] === 'uploaded') {
         require_once 'CRM/Utils/File.php';
         CRM_Utils_File::copyDir($e['per_id'][$id]['path'], $this->extDir . DIRECTORY_SEPARATOR . $e['per_id'][$id]['type'] . DIRECTORY_SEPARATOR . $e['per_id'][$id]['key']);
         if ($deleteOrginal) {
             $this->deleteFiles($id, $key);
         }
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:11,代码来源:ExtensionType.php

示例2: replaceDir

 /**
  * Move $fromDir to $toDir, replacing/deleting any
  * pre-existing content.
  *
  * @param string $fromDir
  *   The directory which should be moved.
  * @param string $toDir
  *   The new location of the directory.
  * @param bool $verbose
  *
  * @return bool
  *   TRUE on success
  */
 public static function replaceDir($fromDir, $toDir, $verbose = FALSE)
 {
     if (is_dir($toDir)) {
         if (!self::cleanDir($toDir, TRUE, $verbose)) {
             return FALSE;
         }
     }
     // return rename($fromDir, $toDir); CRM-11987, https://bugs.php.net/bug.php?id=54097
     CRM_Utils_File::copyDir($fromDir, $toDir);
     if (!CRM_Utils_File::cleanDir($fromDir, TRUE, FALSE)) {
         CRM_Core_Session::setStatus(ts('Failed to clean temp dir: %1', array(1 => $fromDir)), '', 'alert');
         return FALSE;
     }
     return TRUE;
 }
开发者ID:routinet,项目名称:civicrm-core,代码行数:28,代码来源:File.php

示例3: copyDir

 public function copyDir($source, $destination)
 {
     $dir = opendir($source);
     @mkdir($destination);
     while (FALSE !== ($file = readdir($dir))) {
         if ($file != '.' && $file != '..') {
             if (is_dir($source . DIRECTORY_SEPARATOR . $file)) {
                 CRM_Utils_File::copyDir($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file);
             } else {
                 copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file);
             }
         }
     }
     closedir($dir);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:15,代码来源:File.php

示例4: installFiles

 public function installFiles()
 {
     $config = CRM_Core_Config::singleton();
     $zip = new ZipArchive();
     $res = $zip->open($this->tmpFile);
     if ($res === TRUE) {
         $zipSubDir = CRM_Utils_Zip::guessBasedir($zip, $this->key);
         if ($zipSubDir === FALSE) {
             CRM_Core_Session::setStatus(ts('Unable to extract the extension: bad directory structure') . '<br/>');
             return FALSE;
         }
         $path = $config->extensionsDir . DIRECTORY_SEPARATOR . 'tmp';
         $extractedZipPath = $path . DIRECTORY_SEPARATOR . $zipSubDir;
         if (is_dir($extractedZipPath)) {
             if (!CRM_Utils_File::cleanDir($extractedZipPath, TRUE, FALSE)) {
                 CRM_Core_Session::setStatus(ts('Unable to extract the extension: %1 cannot be cleared', array(1 => $extractedZipPath)) . '<br/>');
                 return FALSE;
             }
         }
         if (!$zip->extractTo($path)) {
             CRM_Core_Session::setStatus(ts('Unable to extract the extension to %1.', array(1 => $path)) . '<br/>');
             return FALSE;
         }
         $zip->close();
     } else {
         CRM_Core_Session::setStatus('Unable to extract the extension.');
         return FALSE;
     }
     $filename = $extractedZipPath . DIRECTORY_SEPARATOR . 'info.xml';
     if (!is_readable($filename)) {
         CRM_Core_Session::setStatus(ts('Failed reading data from %1 during installation', array(1 => $filename)) . '<br/>');
         return FALSE;
     }
     $newxml = file_get_contents($filename);
     if (empty($newxml)) {
         CRM_Core_Session::setStatus(ts('Failed reading data from %1 during installation', array(1 => $filename)) . '<br/>');
         return FALSE;
     }
     $check = new CRM_Core_Extensions_Extension($this->key . ".newversion");
     $check->readXMLInfo($newxml);
     if ($check->version != $this->version) {
         CRM_Core_Error::fatal('Cannot install - there are differences between extdir XML file and archive XML file!');
     }
     // Why is this a copy instead of a move?
     CRM_Utils_File::copyDir($extractedZipPath, $config->extensionsDir . DIRECTORY_SEPARATOR . $this->key);
     if (!CRM_Utils_File::cleanDir($extractedZipPath, TRUE, FALSE)) {
         CRM_Core_Session::setStatus(ts('Failed to clean temp dir: %1', array(1 => $extractedZipPath)) . '<br/>');
     }
     return TRUE;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:50,代码来源:Extension.php


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