on('exception', [$this, 'logException'], 10); } /** * Log exception * * @param Exception|Error $e */ public function logException($e) { if (!preg_match("/No 'Authorization: (Basic|Digest)' header found./", $e->getMessage())) { Utils::log('fatal', "[{class}] {message} in {file}({line})", [ 'class' => get_class($e), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine(), ]); Utils::log('debug', 'User-Agent: {agent}', ['agent' => @$_SERVER['HTTP_USER_AGENT']]); Utils::log('debug', 'Remote-User: {user}', ['user' => @$_SERVER['REMOTE_USER']]); Utils::log('debug', 'Request-URI: {uri}', ['uri' => @$_SERVER['REQUEST_URI']]); Utils::log('debug', 'Request-Method: {method}', ['method' => @$_SERVER['REQUEST_METHOD']]); } } /** * Returns a plugin name. * * Using this name other plugins will be able to access other plugins * using Sabre\DAV\Server::getPlugin * * @return string */ public function getPluginName() { return 'exception'; } /** * Returns a bunch of meta-data about the plugin. * * Providing this information is optional, and is mainly displayed by the * Browser plugin. * * The description key in the returned array may contain html and will not * be sanitized. * * @return array */ public function getPluginInfo() { return [ 'name' => $this->getPluginName(), 'description' => 'WebDAV plugin exception for DokuWiki', 'link' => 'https://dokuwiki.org/plugin:webdav', ]; } }