I'm actually trying to find a function which has to detect if the website is in maintenance mode or not do someone have the answer please? I know we can do it in the Console but I need it in one of my bloc.
Magento 2.1 Maintenance – Detect Maintenance Mode in Magento 2
magento-2.1maintenance
Best Answer
Let's say you want to detect this inside of one of your classes.
You need to add this dependency to it
Magento\Framework\App\MaintenanceMode
.Make your class constructor look like this:
Then you can call inside of your class this:
you can even specify an ip address as parameter for
isOn