Enabling "Maintenance mode" in PrestaShop 1.7 using a script and not admin panel?

968 Views Asked by At

I'm writing a script that would back-up my PrestaShop instance installed on my own server. I'm using Prestashop 1.7.7.4.

I suppose it is recommended to put your shop(s) in "Maintenance mode" during database dumping, to make sure nobody interacts with it. However, the only method of enabling the "Maintenance mode" I can find is using the administration panel, which of course requires manual intervention. It makes automatic backups impossible.

Is there any established way to enable "Maintenance mode" using a script/cli/api and not the administration panel?

2

There are 2 best solutions below

0
On

For active shop

Configuration::updateValue('PS_SHOP_ENABLE', '1');

For maintenance mode

Configuration::updateValue('PS_SHOP_ENABLE', '0');
0
On

Additional you can upload the script found here: https://github.com/crezzur/myshoprepair/

This script will allow you to perform some important task like removing cache, changing important database variables all needed to restore access to you web-shop but also disable and re-enable you web-shop and add a maintenance ip address.

All features of this file can be viewed in this demo: https://crezzur.com/demoshop17/myshoprepair.php