fuel / core

Fuel PHP Framework - The core of the Fuel v1 framework
http://fuelphp.com
813 stars 345 forks source link

Router based offline redirect #724

Closed aranw closed 12 years ago

aranw commented 12 years ago

I was wanting too put a router based offline redirect into the route.php config but I don't believe its supported.

Happy to help add it but could do with some advise on where to begin on adding such a feature.

I was thinking it could be similar too _404_ or _root_ being called _offline_.

Was also thinking of there being a config parameter to indicate if a site is offline?

What do others think of such a feature?

jschreuder commented 12 years ago

I'm not a big fan of something like that as you'll probably take the site offline mostly for updating or similar operations. In which case it's a far better idea to just replace the front-controller or make it use some other file that shows an offline message. Fuel itself shouldn't be used in such a case as any editing/updating/whatever might break it and show your user an error message or a white screen.

[updated]

aranw commented 12 years ago

I was just thinking for times when updating my app data/controllers/models and I didn't want too do it live or replace the front-controller. Obviously if I was to ever update the fuel core then I would take it offline and put a temp index file in place of the fuel front-controller.

Reason as well I was thinking it may be possible to add say a "url bypass" where its a random hash or keyword that lets you view the pages.

WanWizard commented 12 years ago

I agree with Jelmer that if you want to update a live site, your users should never be allowed access to any part of that live site. Even if you're only copying files, there is a timeframe in which your site is not consistent. And that gets worse if you have to do migrations.

I use a simple rewrite for this purpose:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule . /offline.php [L]
</IfModule>

You could also opt to deal with this in your index.php, but even that is part of the FuelPHP application, and could be replaced when you upgrade your code.

aranw commented 12 years ago

mod_rewrite is a good option actually never thought about that.

Thanks for info for the rewrite.