Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP script "update process" management tutorials [closed]

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! :)

like image 938
happyhardik Avatar asked Dec 12 '25 00:12

happyhardik


1 Answers

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:

  • In order to manipulate them, all your files need to be chmoded 777 (if unix).
  • create a file, say updater.php
  • that file will connect to your website (through curl for example) and check whether an update is available.
  • server side, consider making a manifest file with paths to files to be replaced + an SQL file with database changes + the replacing files and package all that in a tar (or zip).
  • make your updater.php script download that archive and store it in a local directory say 'temp'.
  • updater.php will have to uncompress (using php's zip extension for example) to ./temp/files
  • updater.php will have to use ./temp/files/manifest in order to find and replace files
  • before replacing do some file integrity checks and be sure the files have not been changed (compare checksums).
  • check database too, before making any changes.
  • if all is OK, commit changes.
  • remove temp data.
  • that's all.

you can add backup support to restore working copy if it fails.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!