Use PHP to upgrade an existing PHP script?
I've currently developed an addon for a popular billing system which i pla开发者_如何学Pythonn to give out to many other people, I would like to make it very easy for them to upgrade the addon whenever i create any bug fixes or updates.
The script uses PHP and MySQL db, i know how to update the MySQL but i'm looking for someone to point me in the right direction on how i could create a PHP script or code that would download the update file or tarball from my website and then upgrade/replace the current file with the new one, that's it.
My concern is just with customers who may be using it on a shared hosting environment or something where they may have problems with upgrades.
I was thinking something sorta along the lines of how Wordpress upgrades itself, i thought about the FTP option but i don't want to make the customers have to enter FTP credentials.
Why don't you just use PHP's ftp functions to compare the files with ftp_mdtm() and download it on difference from your FTP - the customers FTP data won't be used as you just write locally from a local upgrade script with ftp_get(). Maybe unlink() the old file before you download to avoid overwriting problems.
Downside is just you need to open your FTP Server for the customers, but the login-data could be in your own scripts - maybe create a custom user that only has access to the update-files. Can't think of any other way.
精彩评论