I'm wonder how people are kicking people out or blocking access to a site when you want to do an upgrade and you have users that are logged in.
My one thought is to just put a bool setting in a global file (such as the settings file) for whether or not the site is unavailable. True is available, while false is unavailable. When false, the next time the user attempts to access the site they will either be logged out or just presented with an unavailable message.
There are 2 issues I can see with this method:
If users are just finishing filling in a long form or writing a large portion of text (like a new question or answer on SO), as soon as they submit the form, they'd lose that information. (Can't always save it, because there maybe DB changes for that table or code may have changed already.)
Possible: On a busy site, editing the global file if it's more than a couple lines it might cause PHP parse errors if that page is loaded while it's partially uploaded or while saving. There might also be locking issues on the file, depending on the configuration.
Another option is to have a field in the database with the same setting. At the moment, I don't generally have a table for settings, so this would be the only thing in the table, but I could see it being faster as it avoids the second problem.
Is there something that you've used that worked well or any other ideas?
I'm working with LAMP.