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


PHP LocalFile::getAbsolutePath方法代码示例

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


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

示例1: copyFile

 public static function copyFile($params)
 {
     $apiManager = new ApiManager();
     $user = ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser();
     $cloudspace = false;
     $cloudOrig = isset($params['cloud']['origin']) && strlen($params['cloud']['origin']) > 0 ? $params['cloud']['origin'] : null;
     $cloudDestination = isset($params['cloud']['destination']) && strlen($params['cloud']['destination']) > 0 ? $params['cloud']['destination'] : null;
     $pathCloud = "home://~" . $user->getName() . "/Cloudspaces/";
     $pathOrig = null;
     if ($cloudOrig) {
         if ($pathCloud . $cloudOrig == $params['orig']) {
             $pathOrig = "/";
         } else {
             $pathOrig = substr($params['orig'], strlen($pathCloud . $cloudOrig)) . "/";
         }
     }
     if ($cloudDestination) {
         $cloudspace = true;
     }
     $file = null;
     $isFolder = true;
     $tmpFile = null;
     $filename = null;
     $pathinfo = null;
     $pathAbsolute = null;
     if (!$params['file']['is_folder']) {
         $isFolder = false;
         $tmpFile = new LocalFile('/var/tmp/' . date('Y_m_d_H_i_s') . '_' . $user->getId());
         $pathAbsolute = AdvancedPathLib::getPhpLocalHackPath($tmpFile->getAbsolutePath());
         if (array_key_exists('id', $params['file'])) {
             $token = $_SESSION['access_token_' . $cloudOrig . '_v2'];
             $resourceUrl = null;
             if (isset($params['file']['resource_url'])) {
                 $token = new stdClass();
                 $token->key = $params['access_token_key'];
                 $token->secret = $params['access_token_secret'];
                 $resourceUrl = $params['resource_url'];
             }
             $metadata = $apiManager->downloadMetadata($token, $params['file']['id'], $pathAbsolute, $user->getId(), true, $cloudOrig, $resourceUrl);
             if ($metadata['status'] == 'KO') {
                 if ($metadata['error'] == 403) {
                     $denied = self::permissionDeniedCloud($cloudOrig);
                     $metadata['path'] = $denied['path'];
                 }
                 return $metadata;
             } else {
                 if (isset($metadata['local'])) {
                     $file = FSI::getFile($params['file']['pathEyeos']);
                     $tmpFile->putContents($file->getContents());
                 }
             }
         } else {
             $file = FSI::getFile($params['file']['path']);
             $tmpFile->putContents($file->getContents());
         }
     }
     if ($pathOrig) {
         if ($params['file']['path'] == $pathOrig) {
             $pathinfo = pathinfo($params['file']['filename']);
         }
     } else {
         if ($params['file']['parent'] == null) {
             $pathinfo = pathinfo($params['file']['filename']);
         }
     }
     if ($pathinfo) {
         $nameForCheck = $pathinfo['filename'];
         $extension = null;
         if (isset($pathinfo['extension'])) {
             $extension = $pathinfo['extension'];
             $nameForCheck .= '.' . $extension;
         }
         $number = 1;
         $newFile = FSI::getFile($params['dest'] . "/" . $nameForCheck);
         while ($newFile->exists()) {
             $futureName = array($pathinfo['filename'], $number);
             $nameForCheck = implode(' ', $futureName);
             if ($extension) {
                 $nameForCheck .= '.' . $extension;
             }
             $number++;
             $newFile = FSI::getFile($params['dest'] . "/" . $nameForCheck);
             $params['filenameChange'] = $nameForCheck;
             if (!array_key_exists('parent', $params['file'])) {
                 $params['pathChange'] = substr($params['orig'], strlen($pathCloud . $cloudOrig));
             }
         }
         $filename = $newFile->getName();
     } else {
         $filename = $params['file']['filename'];
     }
     if ($cloudspace) {
         $pathParent = substr($params['dest'], strlen($pathCloud . $cloudDestination));
         if (array_key_exists('parent', $params['file'])) {
             if (strlen($pathParent) == 0 && !$params['file']['parent']) {
                 $pathParent = '/';
             }
             if ($params['file']['parent']) {
                 $pathParent .= $params['file']['parent'];
             }
//.........这里部分代码省略.........
开发者ID:sebasalons,项目名称:eyeos-u1db,代码行数:101,代码来源:files.php


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