Automatic Maintenance
Posted: Mon Jun 01, 2015 12:15 am
installing modules OCMOD the store goes into maintenance
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
I see your point and it makes sense to do it that way too, but in this case, with this version, it seems to be "staying" in maintenance mode after refreshing.fido-x wrote:This is not a bug, merely an inconvenience. Your site will automatically be switched to maintenance mode when you refresh your modification cache. This gives you (as admin) the chance to check that the modification is working before allowing customers to view your store.
I made a while ago a pull request at GitHub to check the maintenance mode before doing the modification.fido-x wrote:You have to turn maintenance mode off yourself. It isn't done automatically.
Code: Select all
$org_maintenance = $this->config->get('config_maintenance');
if (!$this->config->get('config_maintenance')) {
$this->load->model('setting/setting');
$this->model_setting_setting->editSettingValue('config', 'config_maintenance', true);
}
Code: Select all
if ($org_maintenance != $this->config->get('config_maintenance')) {
$this->model_setting_setting->editSettingValue('config', 'config_maintenance', false);
}
Yes, this was my PR.fido-x wrote:This is in admin/controller/extension/modification.php (lines 62 to 68):This should store the maintenance mode setting prior to refreshing the modification cache.Code: Select all
$org_maintenance = $this->config->get('config_maintenance'); if (!$this->config->get('config_maintenance')) { $this->load->model('setting/setting'); $this->model_setting_setting->editSettingValue('config', 'config_maintenance', true); }
And, further down (lines 418 to 420):This should reset maintenance mode to what it was before refreshing the modification cache. Obviously not working, so I suppose this is a bug.Code: Select all
if ($org_maintenance != $this->config->get('config_maintenance')) { $this->model_setting_setting->editSettingValue('config', 'config_maintenance', false); }
Code: Select all
if ($org_maintenance != $this->config->get('config_maintenance')) {
$this->model_setting_setting->editSettingValue('config', 'config_maintenance', false);
}
Code: Select all
if (!$org_maintenance) {
$this->model_setting_setting->editSettingValue('config', 'config_maintenance', false);
}
A bit confusing now what I should be using. You say the viethemes vqmod is wrong but it works for me. But then today, the site made itself offline again. Not sure if it has something to do with cookies etc.fido-x wrote:Just change this bit from:to:Code: Select all
if ($org_maintenance != $this->config->get('config_maintenance')) { $this->model_setting_setting->editSettingValue('config', 'config_maintenance', false); }
Code: Select all
if (!$org_maintenance) { $this->model_setting_setting->editSettingValue('config', 'config_maintenance', false); }
Code: Select all
if ($org_maintenance != $this->config->get('config_maintenance')) {
$this->model_setting_setting->editSettingValue('config', 'config_maintenance', false);
}
Code: Select all
if (!$org_maintenance) {
$this->model_setting_setting->editSettingValue('config', 'config_maintenance', false);
}
Thank you for this, I have done it and will monitor. Thanks for the explanation too, it helps more.fido-x wrote: To fix, replace this (lines 418 to 420) in admin/controller/extension/modification.phpwith:Code: Select all
if ($org_maintenance != $this->config->get('config_maintenance')) { $this->model_setting_setting->editSettingValue('config', 'config_maintenance', false); }
This will need to be hard-coded as the modification.php file can not be modified while it is in use.Code: Select all
if (!$org_maintenance) { $this->model_setting_setting->editSettingValue('config', 'config_maintenance', false); }
The code provided by viethemes only ensures that maintenance mode stays turned on.
You have a choice. You can apply the fix as stated above. You can get an update from GitHub. Or, just remember that refreshing your modification cache will put your site into maintenance mode while rebuilding the modification cache and "forget" to take it out of maintenance mode. Which means you will have to go to your system settings and take it out of maintenance mode yourself. The choice is yours.skimottaret wrote:I am having the same issue, is this a bug? I have installed VQMod and am testing a new shop using 2.0.3.1 and Journal theme 2.5.2
Surely I don't have to add special code patches so my shop can be viewed, or do I?
http://www.insideoutskiing.com/sales2
Yes fido-x you are right in this aspect but there is also one more problem and that is of mobile site, with one extension I have solved the maintenance issue for desktop version but the same when viewed on the mobile shows as the site in maintenance mode so what can be done about that ?fido-x wrote:You have a choice. You can apply the fix as stated above. You can get an update from GitHub. Or, just remember that refreshing your modification cache will put your site into maintenance mode while rebuilding the modification cache and "forget" to take it out of maintenance mode. Which means you will have to go to your system settings and take it out of maintenance mode yourself. The choice is yours.