本文整理汇总了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);
}