title: What are best practices for self-updating PHP+MySQL applications?
body: <p>It is pretty standard practice now for desktop applications to be self-updating. On the Mac, every non-Apple program that uses <a href="http://sparkle.andymatuschak.org/" rel="noreferrer">Sparkle</a> in my book is an instant win. For Windows developers, <a href="https://stackoverflow.com/questions/232347/how-should-i-implement-an-auto-updater">this has already been discussed at length</a>. I have not yet found information on self-updating web applications, and I hope you can help.</p>
  
  <p>I am building a web application that is meant to be installed like Wordpress or Drupal  - unzip it in a directory, hit some install page, and it's ready to go. In order to have broad server compatibility, I've been asked to use PHP and MySQL -- is that **MP? In any event, it has to be broadly cross-platform. For context, this is basically a unified web messaging application for small businesses. It's not another CMS platform, think webmail.</p>
  
  <p>I want to know about self-updating web applications. First of all, (1) is this a bad idea? As of Wordpress 2.7 the automatic update is a single button, which seems easy, and yet I can imagine so many ways this could go terribly, terribly wrong. Also, isn't the idea that the web files are writable by the web process a security hole?</p>
  
  <p>(2) Is it worth the development time? There are probably millions of WP installs in the world, so it's probably worth the time it took the WP team to make it easy, saving millions of man hours worldwide. I can only imagine a few thousand installs of my software -- is building self-upgrade worth the time investment, or can I assume that users sophisticated enough to download and install web software in the first place could go through an upgrade checklist?</p>
  
  <p>If it's not a security disaster or waste of time, then (3) I'm looking for suggestions from anyone who has done it before. Do you keep a version table in your database? How do you manage DB upgrades? What method do you use for rolling back a partial upgrade in the context of a self-updating web application? Did using an ORM layer make it easier or harder? Do you keep a delta of version changes or do you just blow out the whole thing every time?</p>
  
  <p>I appreciate your thoughts on this.</p>