我需要运行一个 cron 作业来为 Redmine 使用 reposman.rb 添加一个 svn 存储库。但我们也有一个 php 脚本(带有一个界面),使我们能够自动创建存储库。
php 脚本接收 $_POST 值,创建存储库,设置权限,分配一些组以对新创建的存储库进行读写访问。
我的问题是:
- 我如何执行 php 脚本,而不是 reposman.rb 中的
svnadmin create
命令? - 如何为 php 脚本提供 $_POST 参数,以便它可以使用 php 脚本正确设置我的 svn 存储库。
谢谢
编辑: 以下是两个脚本的一些示例。
Ruby 脚本:
... // Add the repos system "svnadmin create #{path}" ...
PHP 脚本:
// Receive the name of the repos to add $dir= $_POST["dir"]; // Do all the stuff with the permissions $cmd= "sudo /usr/local/bin/createsvnrepo $dir"; system("$cmd", $retval); ...
最佳答案
如果可以更改脚本,它应该通过文件或标准输入获取输入数据。如果不是,您可以编写一个包装器脚本,从文件/标准输入中选取数据,填充 $_POST
用它(是的,PHP superglobals 是可写的)并通过 require
调用原始脚本.
关于php - 如何将 $_POST 值从 ruby 脚本传递给 php 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6045963/