更新自行安装的 PHP 文件?
我正处于完成项目的最后阶段(vizulium - 开源摄影 CMS)。我还有最后一个障碍:更新软件。
我想要实现的想法是:
- 在 Vizulium 网站上检查最新版本(页面仅显示当前稳定版本)。
- 如果存在更新版本,并且用户请求它:
一个。将更新的文件压缩到 Vizulium 服务器上
b.将文件下载到用户的服务器
c.解压缩内容
我已经有一个跟踪系统,可以跟踪我推送的更新(日期时间)。我还没有开始第 2 步。所有内容都在 PHP 和 mySQL 中。
这是问题的典型实现吗?我需要澄清什么吗?
我没有使用 FTP,因为它是自行安装的,并且我假设用户不识字。
I am in the final stages of completing my project (vizulium - open-source photography CMS). I have one final remaining stumbling block: updating the software.
My idea that I wanting to implement is this:
- Check newest version at Vizulium website (page just displays current stable version).
- If newer version exists, and the user requests it:
a. Zip the updated files on Vizulium server
b. Download the files to the user's server
c. Unzip contents
I already have a tracking system in place that keeps track of the updates (datetime) that I push. I have not began step 2. All is in PHP and mySQL.
Is this a typical implementation of the problem? Do I need to clarify anything?
I am not using FTP since it is a self-install and I assume the user is programming-illiterate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的解决方案是有效的,但需要一些额外的考虑。
您应该通过 HTTPS 并通过证书验证连接到您的服务器,以查询和获取任何可用的更新。
您应该使用私钥对更新进行签名,并让客户端在应用更新之前验证更新是否真实。
如果您需要从安装中删除过时的文件,解压缩将无法执行此操作,可能在每次升级中都有一个“upgrade.php”脚本,执行该脚本以执行任何额外的必要步骤。
您的升级脚本应在执行升级之前备份 Web 目录和数据库,并保留备份直到用户请求删除它。
使您的升级增量,以便从 1 升级到 > 3、需要先升级到版本2。这当然对用户来说是透明的,但会确保版本之间的升级完成,并且所有数据库更新/修改都按正确的顺序应用。
Your solution is valid, but needs a few extra considerations.
You should connect to your server via HTTPS and with certificate verification to query and fetch any available updates.
You should sign your updates with a private key and have the client verify the updates as authentic before applying them.
If you need to remove an obsolete file from an install, unzipping will not do this, perhaps have an "upgrade.php" script in each upgrade that is executed to perform any extra necessary steps.
Your upgrade script should backup the web directory and database before performing the upgrade, and retain the backup until the user requests to remove it.
Make your upgrades incremental, so to upgraded from 1 -> 3, you need to upgrade to version 2 first. This would be of-course transparent to the user, but would ensure that the upgrades between versions would be complete and all database updates/modifications are applied in the correct order.