We are creating a php script project; which we will be selling to customers.
The customers can host the script on their web server.
We would like to develop an update or upgrade process for this script.
Means if a customer is using the version 1.2 of the script and we have released the new version 1.3 of the script, the users will be able to see a text saying “new version is available” in the backend control panel.
The user can than go to update or upgrade page and hit a button to auto update the script.
I can understand that this process will involve the following things:
1. A process to check the current version of the script available from our home website.
2. File update process: download and update the required files from my server on the client server.
3. Make required database changes: Download the upgrade sql file from my home server and run it against the database.
I tried google to find a good start up tutorial to give me a kick start and to verify if I am missing something but I am not able to find anything.
Can you point me to some kick start tutorials or guide about developing or managing update process of a script?
I know that all major open source scripts like WordPress, Joomla, osCommerce, Magento have this facility. So there must be resources available for this on the internet.
Thank you for our time.. have fun! 🙂
2
Answers
To do this requires a solid separation of custom vs core code. You would want to make sure users have a seperate set of pages to hook into your code from. Perhaps you should run an MD5 check remotely on the pages before carrying out the update.
The easiest solution to this is to have your script (on customer side) run a SOAp/REST command sending its version and serial to your home server. In turn your server can send back a message with the new version.
If the user clicks the link, the customer side script would need to send another SOAP/REST command with information (FTP info for instance) to allow your server to connect and overwrite the core files.
Keep in mind, this requires the users to set correct chmod and chgrp/chown permissions on the files so that you can actually connect and overwrite the files.
Many scripts have this functionality however it is a large security risk. Think hard on if the effort to implement this correctly is worth it…Sometimes simply sending a tar/zip is easier.
By remotely updating, you are running into huge liability and security issues…
Does this realy need a tutorial ? just bring your editor and start coding, if i were you, here’s the way i’ll be doing it:
you can add backup support to restore working copy if it fails.