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


PHP Files::createRelativeSymlink方法代码示例

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


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

示例1: publishDirectory

 /**
  * Publishes the specified directory to this target, with the given relative path.
  *
  * @param string $sourcePath Absolute path to the source directory
  * @param string $relativeTargetPathAndFilename relative path and filename in the target directory
  * @throws TargetException
  * @return void
  */
 protected function publishDirectory($sourcePath, $relativeTargetPathAndFilename)
 {
     $targetPathAndFilename = $this->path . $relativeTargetPathAndFilename;
     if (@stat($sourcePath) === false) {
         throw new TargetException(sprintf('Could not publish directory "%s" into resource publishing target "%s" because the source is not accessible (file stat failed).', $sourcePath, $this->name), 1416244512);
     }
     if (!file_exists(dirname($targetPathAndFilename))) {
         Files::createDirectoryRecursively(dirname($targetPathAndFilename));
     }
     try {
         if (Files::is_link($targetPathAndFilename)) {
             Files::unlink($targetPathAndFilename);
         }
         if ($this->relativeSymlinks) {
             $result = Files::createRelativeSymlink($sourcePath, $targetPathAndFilename);
         } else {
             $temporaryTargetPathAndFilename = uniqid($targetPathAndFilename . '.') . '.tmp';
             symlink($sourcePath, $temporaryTargetPathAndFilename);
             $result = rename($temporaryTargetPathAndFilename, $targetPathAndFilename);
         }
     } catch (\Exception $exception) {
         $result = false;
     }
     if ($result === false) {
         throw new TargetException(sprintf('Could not publish "%s" into resource publishing target "%s" because the source directory could not be symlinked at target location.', $sourcePath, $this->name), 1416244515, isset($exception) ? $exception : null);
     }
     $this->systemLogger->log(sprintf('FileSystemSymlinkTarget: Published directory. (target: %s, file: %s)', $this->name, $relativeTargetPathAndFilename), LOG_DEBUG);
 }
开发者ID:mkeitsch,项目名称:flow-development-collection,代码行数:36,代码来源:FileSystemSymlinkTarget.php


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