2

I've currently developed an addon for a popular billing system which i plan 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.

6
  • 1
    How are you going to solve the DB update then? If you manage that, why couldn't you update the source files as well? Commented Sep 27, 2011 at 21:43
  • I'd say just provide a tarball and let them upload it themselves. If you're updating the database (schema), simply put a few MySQL calls in a PHP script somewhere. Commented Sep 27, 2011 at 21:50
  • Yes but how? MySQL updates will only be for version control which is handled by the billing system im using by using a hook. Commented Sep 27, 2011 at 22:05
  • Melso, that's what i want to do...but my question is how do i do it, what php functions would be used? Commented Sep 27, 2011 at 22:05
  • As for updating php source files it can be done with a simple user interface(a plain web page that knows where the user's files are and where you list of upgrades in your server is). The user selects from a list (coming from your server) what upgrades he wants, and the interface downloads and replaces the old php sources. As for mysql with user data in there, that sounds more difficult! It could be done by some php script executing simple alter commands or whatever needed... this one with all security concerns is more tricky! Commented Sep 27, 2011 at 22:07

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.