src/Controller/Component/SetupComponent.php
public function setMaintenance($maintenance) {
		$ip = env('REMOTE_ADDR');
		// optional length in minutes
		$length = (int)$this->Controller->request->getQuery('duration');

		$Maintenance = new Maintenance();
		if (!$Maintenance->setMaintenanceMode($maintenance ? $length : false)) {
			return false;
		}
		if (!$Maintenance->whitelist([$ip])) {
			return false;
		}

		return true;
	}
public function setMaintenance($maintenance) {
		$ip = env('REMOTE_ADDR');
		// optional length in minutes
		$length = (int)$this->Controller->request->getQuery('duration');

		$Maintenance = new Maintenance();
		if (!$Maintenance->setMaintenanceMode($maintenance ? $length : false)) {
			return false;
		}
		if (!$Maintenance->whitelist([$ip])) {
			return false;
		}

		return true;
	}
public function setMaintenance ( $ maintenance ) { $ ip = env ( 'REMOTE_ADDR' ) ; // optional length in minutes $ length = ( int ) $ this -> Controller -> request -> getQuery ( 'duration' ) ; $ Maintenance = new Maintenance ( ) ; if ( ! $ Maintenance -> setMaintenanceMode ( $ maintenance ? $ length : false ) ) { return false ; } if ( ! $ Maintenance -> whitelist ( [ $ ip ] ) ) { return false ; } return true ; }
Set maintance mode for everybody except for the own IP which will
be whitelisted.

Alternatively, this can and should be done using the CLI shell.

URL Options:
- `duration` query string can be used to set a timeout maintenance window

@param mixed $maintenance
@return bool Success
Set maintance mode for everybody except for the own IP which will be whitelisted .