server = $server; $this->server->on('beforeMethod', array($this, 'checkMaintenanceMode'), 10); } /** * This method is called before any HTTP method and returns http status code 503 * in case the system is in maintenance mode. * * @throws \Sabre\DAV\Exception\ServiceUnavailable * @internal param string $method * @return bool */ public function checkMaintenanceMode() { if (\OC_Config::getValue('maintenance', false)) { throw new \Sabre\DAV\Exception\ServiceUnavailable(); } if (\OC::checkUpgrade(false)) { throw new \Sabre\DAV\Exception\ServiceUnavailable('Upgrade needed'); } return true; } }