code: public function maintenanceCheck()
  	{
  		$this->import(BackendUser::class, 'User');
  
  		if (!$this->User->hasAccess('maintenance', 'modules'))
  		{
  			return '';
  		}
  
  		try
  		{
  			if (System::getContainer()->get('lexik_maintenance.driver.factory')->getDriver()->isExists())
  			{
  				return '<p class="tl_error">' . $GLOBALS['TL_LANG']['MSC']['maintenanceEnabled'] . '</p>';
  			}
  		}
  		catch (\Exception $e)
  		{
  			// ignore
  		}
  
  		return '';
  	}
docs: Check for maintenance mode
  
  @return string