Checking if the Application is Down for Maintenance

Problem

You want to check if your application is down for maintenance.

Solution

Use the App::isDownForMaintenance() method.

if (App::isDownForMaintenance())
{
    die("We're currently down for maintenance.");
}

Discussion

There's a better way to do this.

See the Registering a Maintenance Mode Handler recipe. This will allow you to set up an action to occur automatically when you're application is in maintenance mode.

Note that your application is considered in maintenance mode of the file app/storage/meta/down exists on your file system.

See also:

comments powered by Disqus