简体   繁体   English

PHP中的多站点文件管理器:只需单击一下即可更新多个站点中的单个文件?

[英]Multi-site File Manager in PHP: Update a single file in multipe sites w/one click?

I have a hosting (hostgator) account with a master directory and multiple subdirectories, each representing a www address. 我有一个托管(hostgator)帐户,该帐户具有一个主目录和多个子目录,每个子目录代表一个www地址。 I'd like to know if its possible to create an interface in php that would allow me to update a given file (say, header.php) in a specific folder (my custom wordpress theme which resides in each site) which will be the same in every site. 我想知道是否有可能在php中创建一个接口,该接口将允许我在特定文件夹(位于每个站点的我的自定义wordpress主题)中更新给定文件(例如header.php),这将是每个站点都一样。

I currently have to do this via FTP, but its cumbersome b/c I have to open each directory and copy the file to it. 我目前必须通过FTP来执行此操作,但是麻烦的b / c我必须打开每个目录并将文件复制到其中。 So if I have 30 sites to update, its very time consuming. 因此,如果我有30个要更新的站点,则非常耗时。 i'd like to just have a list of sites with a checkbox beside each of them (and a "select all" toggle) and run the update on all sites in one click) 我只想列出一个站点列表,在每个站点旁边都带有一个复选框(以及“全选”切换),然后一键在所有站点上运行更新)

Thanks for your input! 感谢您的输入!

PS: I know there are probably chron scripts or interfaces that can do this, but I'll be creating a scriptable (PHP) solution I can package up and send to someone and it just works and is brain-dead simple to use. PS:我知道可能有chron脚本或接口可以执行此操作,但是我将创建一个可脚本化(PHP)的解决方案,将其打包并发送给某人,它可以正常工作,并且使用起来很脑筋急转弯。

Yes, it's possible, you can modify files using PHP's file functions and you can communicate what to update through sockets. 是的,有可能,您可以使用PHP的文件功能来修改文件,并且可以通过套接字传达要更新的内容。

It would be fairly complicated to implement though so I'm not sure what you're asking for.. Yes it's possible but I doubt someone here will give you a copy&paste solution. 虽然实施起来会相当复杂,所以我不确定您要的是什么。是的,虽然有可能,但我怀疑这里有人会为您提供复制粘贴解决方案。 Do you have a more specific question? 您还有更具体的问题吗?


EDIT : an easier solution would be to have a SVN repository so you can simply do it with one line of PHP code: 编辑 :一个更简单的解决方案是拥有SVN信息库,因此您只需使用一行PHP代码即可:

`svn update`

Any reason you're not using WordPress MU ? 任何不使用WordPress MU的原因? With it and the child theme functionality built into recent versions of WordPress, your life might be a lot easier. 有了它以及最近版本的WordPress中内置的子主题功能,您的生活可能会轻松很多。

Yes: 是:

I currently have to do this via FTP, but its cumbersome b/c I have to open each directory and copy the file to it. 我目前必须通过FTP来执行此操作,但是麻烦的b / c我必须打开每个目录并将文件复制到其中。 So if I have 30 sites to update, its very time consuming. 因此,如果我有30个要更新的站点,则非常耗时。 i'd like to just have a list of sites with a checkbox beside each of them (and a "select all" toggle) and run the update on all sites in one click) 我只想列出一个站点列表,在每个站点旁边都带有一个复选框(以及“全选”切换),然后一键在所有站点上运行更新)

Basically you need to script those FTP actions and provide some logic as to what path and what files. 基本上,您需要为那些FTP操作编写脚本,并提供有关什么路径和什么文件的一些逻辑。 You can then style the entire thing with a simple front end, listing your sites with a checkbox to select. 然后,您可以使用简单的前端为整个样式设置样式,并通过选择框列出您的网站。

Doesn't seem difficult, just have to get the FTP path traversal working and file cp'ing down. 看起来并不困难,只需要使FTP路径遍历工作并关闭文件cp就可以了。

看看Phing并搜索Google以进行PHP部署

If you are hosting multiple WP sites, you really should use WPMU. 如果要托管多个WP站点,则确实应该使用WPMU。

I've implemented Uploadify for single / multiple file upload. 我已经为单个/多个文件上传实现了Uploadify Works great. 效果很好。 I also use Wordpress. 我也使用Wordpress。

如果它只是header.php而您没有svn(您可以设置一个钩子,将其复制到正确的位置),如果您具有ssh访问权限,则可以编写bash脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM