How can I have my CMS upgrade itself?

I have built a CMS (using the Codeigniter PHP framework) that we use for all our clients. I’m constantly tweaking it, and it gets hard to keep track of which clients have which version. We really want everyone to always have the latest version.

I’ve written it in a way so that updates and upgrades generally only involve uploading the new version via FTP, and deleting the old one – I just don’t touch the /uploads or /themes directories (everything specific to the site is either there or in the database). Everything is a module, and each module has it’s own version number (as well as the core CMS), as well as an install and uninstall script for each version, but I have to manually FTP the files first, then run the module’s install script from the control panel. I wrote and will continue to write everything personally, so I have complete control over the code.

What I’d like is to be able to upgrade the core CMS and individual modules from the control panel of the CMS itself. This is a “CMS for Dummies”, so asking people to FTP or do anything remotely technical is out of the question. I’m envisioning something like a message popping up on login, or in the list of installed modules, like “New version available”.

I’m confident that I can sort out most of the technical details once I get this going, but I’m not sure which direction to take. I can think of ways to attempt this with cURL (to authenticate and pull source files from somewhere on our server) and PHP’s native filesystem functions like unlink(), file_put_contents(), etc. to preform the actual updates to files or stuff the “old” CMS in a backup directory and set up the new one, but even as I’m writing this post – it sounds like a recipie for disaster.

I don’t use github or anything, but I have the feeling something like that could help? How should (or shouldn’t) I approach this?

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

4 Responses to How can I have my CMS upgrade itself?

  1. Alfonso Rubalcava says:

    You can use Git from your CMS: Glip. The cron would be a url on your own system, without installing Git.

  2. Mark Unwin says:

    Have you taken a look at how WordPress does it?
    That would seem to do what you want.
    Check this page for a description of how it works.
    http://tech.ipstenu.org/2011/how-the-wordpress-upgrade-works/

  3. Anonymous says:

    You can use Git from your CMS: Glip. The cron would be a url on your own system, without installing Git.

  4. Anonymous says:

    Have you taken a look at how WordPress does it?
    That would seem to do what you want.
    Check this page for a description of how it works.
    http://tech.ipstenu.org/2011/how-the-wordpress-upgrade-works/

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>