I developed a web site on a server "locally", and everything was functioning properly (including the ability to put the site into maintenance mode and define the page / message that users would see). I packed up all of the files, exported the database, migrated everything to a new server, modified the appropriate configuration files (new db host, db name, user/pass, updated path to files and resources), and tested the base functionality of the pages. Everything is working fine.
I attempted to put the site into maintenance mode on the new host, and it simply won't block access to the site. I've set the parameter to No, flushed the cache, and ensured I was using a browser with NO session to the Manager. Yet, it will not take down the site.
I would like to understand what the setting "does" so that I can troubleshoot this. Does it change a setting in a config file? Which file and what setting? If I at least understand what the change is that it's supposed to make, I can look for it on the server and see if maybe there's a permission issue causing a problem (my folders are all 755 and my files are all 644, though).
Are you changing the site_status System Setting in the Manager or in code? If in code, you need to set it to 0.
Flushing the site cache in the Manager is not a complete flush. Try deleting all files in the core/cache directory.
I am making the change via the Manager interface as I had done on my development system (where it worked). Where would I make that change in code (for testing)?
I have tried deleting everything from the cache directory, but it didn't have any impact (except to slow down the next page loads).
-
☆ A M B ☆
- 24,524 Posts
Just about the first thing MODX does after loading up the $modx object is to check the site status. The modx.class.php file provides the function to check the setting, but the modrequest.class.php is where it's actually checked. Immediately after the OnHandleRequest event is invoked, the site's status is checked - line 78 of modrequest.class.php. It calls the $modx checkSiteStatus() function, which returns 0 or 1. If it returned 0, then a 503 Service Unavailable HTTP header is set, the site_unavailable_page or site_unavailable_message is retrieved, and processing continues to generate and return the "offline" page.
In tracing this, it appears that modx.class.php contains the actual function. And, it should properly return true/false because the database is being updated properly when the setting is changed.
I deleted out the cache directory again, logged out of Manager, and then accessed the site. The info in the cache directory showed that it had properly read the information, but it was showing the Home Page. After fixing the status of the maintenance page (I published it), it started working properly.
I honestly don't know what happened because in between it not working and it working, I lost my database and had to restore from a backup from this morning (and lost some data).
I think I know what happened. You did get forwarded to the maintenance page, but since it was unpublished, you got forwarded again to the page specified in the error_page (page-not-found) System Setting, which by default is the home page. None of the links would have worked, they'd all lead to the home page by the same route.
The entire site worked, and the Maintenance page was published during the original tests. When I restored the database, it restored the Maintenance page in an unpublished state... I wasn't clear about the details.