I am currently working on a web app update system. It will work kind of like version control where the master server is the repo. The difference between my system and vc would be you cannot commit/push etc to the master server.
So the idea is:
User goes to admin > update
Checks for updates
The master repo sends back a list of all the latest version files and their checksums
The app checks this list against the files on the server. If some are out of date/dont match checksum, then request those file contents, and over write the files on the server.
My question is, what if the update file itself needs updating... how would I go about updating it? Would i be able to overwrite it even though its currently executed? Or would there be an error and the whole thing blows up? I would guess that the current file is stored in ram so it can overwrite itself but I am not sure.
Thanks
Here is one way you can go about it: