在 Windows 7 中使用 Rsync 部署 Symfony Projekt - 权限问题

发布于 2024-09-30 18:59:25 字数 447 浏览 0 评论 0原文

我正在拼命尝试使用 Rsync 部署我的 Symfony 应用程序。

我安装了 cwRsync 并且它有点工作,至少 SSH 可以。我的应用程序位于 E:\xampp\htdocs\MyProject。

Rsync 实际上确实在我的服务器上创建了一个目录,但除此之外,我只收到权限错误。

现在,这似乎是一个常见问题,但是我无法实施任何解决方案,例如: cwRsync 在 Windows 7 上忽略“nontsec”

我将 cwRsync 安装到以下目录: c:\cwrsync

我的问题:我的 fstab 文件需要是什么样子,我什至必须把它放在哪里?这个问题还有其他解决方案吗?

提前致谢!

I am desperetly trying to deploy my Symfony app with Rsync.

I instally cwRsync and it somewhat works, at least SSH does. My app is located in E:\xampp\htdocs\MyProject.

Rsync actually does create one directory on my Server but other than that, I only get permission errors.

Now, this seems to be a common problem, however I am not able to implement any solutions, such as this one:
cwRsync ignores "nontsec" on Windows 7

I installed cwRsync to the following directory: c:\cwrsync

My Question: what does my fstab file need to look like, and where do I even have to put it? Are there any other solutions to this problem?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嘿哥们儿 2024-10-07 18:59:25

我已经发布了你提到的那个问题。以下是我最终让 symfony project:deploy 在 Windows 7 上工作的方法(它需要对 symfony 进行一些破解,因此它可能不是最佳解决方案)。使用此解决方案,您不需要安装完整的 cygwin,只需要 cwRsync。

在您的 fstab 中,添加以下行(fstab 应位于 [cwrsync install dir]\etc 下):

C:/wamp/www /www ntfs binary,noacl 0 0

这实际上将“C:\wamp\www”映射到您的 Windows 上cygwin 的文件系统为“/www”。

修改 symfony/lib/task/sfProjectDeployTask.class.php

protected function execute($arguments = array(), $options = array())
{
  ...
  $dryRun = $options['go'] ? '' : '--dry-run';

  // -- start hack --
  if(isset($properties['src']))
    $src = $properties['src'];
  else
    $src = './';

  $command = "rsync $dryRun $parameters -e $ssh $src $user$host:$dir";
  // -- end hack --

  $this->getFilesystem()->execute($command, $options['trace'] ? array($this, 'logOutput') : null, array($this, 'logErrors'));

  $this->clearBuffers();
}

这允许您在 properties.ini 中指定额外的 src 字段

src=/www/myProject

:使 Windows 和 cygwin 之间的整个文件系统映射定义更加清晰。 Cygwin(和 cwRsync)比 Windows 路径更好地理解 Unix 路径(即 /wwwC:/wamp/www),因此这样做可以使一切正常工作。

I'd posted that question you referred to. Here's what I ended up doing to get symfony project:deploy to work from Windows 7 (it required hacking symfony a bit, so it may not be the most optimal solution). With this solution, you don't need fullblown cygwin installed, you just need cwRsync.

In your fstab, add this line (fstab should be located under [cwrsync install dir]\etc):

C:/wamp/www /www ntfs binary,noacl 0 0

This essentially maps "C:\wamp\www" on your windows filesystem to "/www" for cygwin.

Modify symfony/lib/task/sfProjectDeployTask.class.php:

protected function execute($arguments = array(), $options = array())
{
  ...
  $dryRun = $options['go'] ? '' : '--dry-run';

  // -- start hack --
  if(isset($properties['src']))
    $src = $properties['src'];
  else
    $src = './';

  $command = "rsync $dryRun $parameters -e $ssh $src $user$host:$dir";
  // -- end hack --

  $this->getFilesystem()->execute($command, $options['trace'] ? array($this, 'logOutput') : null, array($this, 'logErrors'));

  $this->clearBuffers();
}

This allows you to specify an additional src field in properties.ini:

src=/www/myProject

Doing this makes the whole filesystem mapping between windows and cygwin much more clearly defined. Cygwin (and cwRsync) understand unix paths much better than windows paths (i.e. /www vs. C:/wamp/www), so doing this makes everything just work.

爱已欠费 2024-10-07 18:59:25

运行脚本

我认为 Rsync 在 Windows 和 Linux 之间同步期间总是会破坏您的文件权限。

您可以非常轻松地创建一个脚本,在同步后遍历您的文件并使用 chmod 重置文件权限。

Run a Script

I think Rsync always breaks your file permissions during sync between Windows and Linux.

You can quite easily create a script that goes through your file after a sync and resets the file permissions using chmod though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文