Welcome Guest, Not a member yet? Register   Sign In
Creating a self updater
#1

Hi guys,
How do you add self updating capabilities to your CI app? Most CMS and web apps notify users there is an update. Click on update and it will copy the files, etc.
Is this possible with CI? If not, how does one go about it?
Reply
#2

Not sure but this may get you to the right direction.

GitHub-ozzi - php-app-updater
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

You would need to do a few different steps:

1. Occassionally ping your server/GitHub/whatever to get the latest version. If that's different than the current app's version then notify the user.
3. Create a UI to allow the user to update.
2. Download and install the updates when the user selects the update. This is the tricky portion. If I recall from the WordPress updater I looked at a few years ago, the most server-agnostic version is simply using FTP from the app to grab the files, pull them down the the current server, unzip, and move the files into place.

That works fine for standard hosting platforms, but not great for things that use images, like Kubernets, etc, since the file writes aren't permanent. The user would probably have a different flow at that time, anyway, where they'd do the updates locally, then commit those changes to a repo, which would then get deployed, so probably not a big deal, but something you would need to note in any docs for the project.
Reply
#4

Thanks for the replies. FTP seems a complicated way of doing it! I was hoping the CI had a simple way of downloading a zip and then extracting it, but the Filesystem helper doesn't have any of that.

I might have to play around with PHP's ZipArchive and see if I can build something basic from that.
Reply
#5

For anyone reading this, I was able to get an auto update system working with ZipArchive. Well worth the effort.
Reply
#6

Care to share your code?
Reply
#7

(02-05-2024, 11:49 AM)JustJohnQ Wrote: Care to share your code?
It's a working prototype, untidy, and very specific to my use case - so not much use to others. If more people are interested, I might refactor into a class and share it.

But the main purpose of my previous post is ZipArchive is a simple way to extract the files for installation. Have a self updater is also great when you want to quickly test some code changes on a different test environment.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB