lukasjuhas / lj-maintenance-mode

Simple maintenance mode wordpress plugin.

Home Page:https://plugins.itsluk.as/maintenance-mode/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better handling of maintenance mode - possibly adding support for core updates maintenance mode?

lukasjuhas opened this issue · comments

Wordpress forums transcript

Serious issue when Enabled
esemlabel (@esemlabel)
1 hour, 43 minutes ago
Hi there,

The main reason I use “lj maintenance mode” is for updating active theme files.
But after enabling Maintenance Mode, the message page with 503 status appears only if a folder of the active theme exist on server. So when enabling 503 and delete active theme folder after that, the empty page with status code 200 will appear instead of 503, until the new revision of theme is finished copying, for example via ftp.

I think the maintenance page shouldn’t be dependent on existing of plugin’ or theme’s files at all, because mostly Maintenance Mode is enabled to update something like themes or plugin.

Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Plugin AuthorLukas Juhas (@lukasneptun) 
1 hour, 29 minutes ago
Hi there,

The plugin itself is not dependant on the theme, it’s a standalone plugin which uses core WordPress function so I don’t think this has something to do with the plugin.

It would probably worth trying this with different maintenance plugins as I think the same problem will occur just because WordPress is dependant on the theme etc.

I fear that this is something I cannot control via plugin but I’m welcome to suggestions.

At the end, is it worth developing a solution for a few seconds, maybe couple of minutes while new files get’s uploaded?

WordPress handles updates by placing a “.maintenance” file in the root which then gives you the message “briefly unavailable for maintenance” but of course that applies only for updates – not whilst copying files.

I would be more than happy if anyone has a good and simple idea of a workaround, otherwise I don’t think I can do much.

I hope that helps at least a bit.

Lukas

esemlabel (@esemlabel) 
26 minutes ago
Maybe you can use one of these solutions?

1. The plugin can change the active theme to any temporary one with just a single empty index.php in it on a fly when enabling, and reactivate main theme when disabling maintenance. BUT it is not a good idea since many themes do a lot on ‘after_switch_theme’ hook. Unless you can bypass all main theme functions that uses this or similar hooks, grab their names – then temporary remove_action in foreach() when restoring main theme.

2. Generate a copy of maintenance page from its settings page into /wp-content/maintenance.php file (delete on plugin deactivating). The WP will use this file not only when plugin’s maintenance mode is enabled, but for its plugins and core updates too, instead of boring ‘Briefly unavailable for scheduled maintenance. Check back in a minute.’ message. One more thing you need is creat .maintenance file with <?php $upgrading = time(); ?> in it, and delete on disabling maintenance mode. But remember to recreat .maintenance file on load if it was deleted after core or any other wp updates has finished, if ‘ljmm-enabled’ is still enabled. After creating /wp-content/maintenance.php file you will see active Drop-in on plugins page:


I prefer the 2 one, it looks more simple and fast.