I'm attempting to write an upgrade script for one of our website. Currently the script will unzip files provided from the upgrade link and unzip to the directory.
My problem is if there is a new version of itself i.e. upgrader-new.php
I need the script to run to completion and then delete itself, then haveupgrader-new.php
be renamed to upgrader.php
.
The only solution I can think of would be to create a third file i.e. upgrade-assist.php
that would be run before any upgrade to check if upgrader-new.php
exists and if it does, delete the original and rename the new to the proper name. I forsee problems because the original script would still have to call upgrader-assist.php
and as far as I know you can't delete a running script?
Any suggestions?
Thanks!