summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-08-15 21:26:18 +0200
committerGitHub <noreply@github.com>2017-08-15 21:26:18 +0200
commit60a485b80db9290df089d35b3fe73ad128371d7d (patch)
tree327fc66b9fe6b16134047407e9d67a62341232e5
parentf698aa11e7060ccf6069cf248dd0b83dd9db45d8 (diff)
parentfc12bd0be6efcf79a92d28a2f8e813bb6eb7c48e (diff)
downloadnextcloud-server-60a485b80db9290df089d35b3fe73ad128371d7d.tar.gz
nextcloud-server-60a485b80db9290df089d35b3fe73ad128371d7d.zip
Merge pull request #6132 from nextcloud/do-not-log-maintenance-mode
Do not log WebDAV maintenance mode exception
-rw-r--r--apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php3
2 files changed, 10 insertions, 3 deletions
diff --git a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
index dce2f9c45e4..ca2195fc65a 100644
--- a/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
@@ -28,8 +28,7 @@
namespace OCA\DAV\Connector\Sabre;
use OCP\ILogger;
-use Sabre\DAV\Exception;
-use Sabre\HTTP\Response;
+use Sabre\DAV\Exception\ServiceUnavailable;
class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
protected $nonFatalExceptions = [
@@ -90,7 +89,12 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
public function logException(\Exception $ex) {
$exceptionClass = get_class($ex);
$level = \OCP\Util::FATAL;
- if (isset($this->nonFatalExceptions[$exceptionClass])) {
+ if (isset($this->nonFatalExceptions[$exceptionClass]) ||
+ (
+ $exceptionClass === ServiceUnavailable::class &&
+ $ex->getMessage() === 'System in maintenance mode.'
+ )
+ ) {
$level = \OCP\Util::DEBUG;
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php
index 85ede2ad681..83a51ddd86b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php
@@ -28,6 +28,7 @@ use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin as PluginToTest;
use OC\Log;
use PHPUnit_Framework_MockObject_MockObject;
use Sabre\DAV\Exception\NotFound;
+use Sabre\DAV\Exception\ServiceUnavailable;
use Sabre\DAV\Server;
use Test\TestCase;
@@ -77,6 +78,8 @@ class ExceptionLoggerPluginTest extends TestCase {
public function providesExceptions() {
return [
[0, '', new NotFound()],
+ [0, 'System in maintenance mode.', new ServiceUnavailable('System in maintenance mode.')],
+ [4, 'Upgrade needed', new ServiceUnavailable('Upgrade needed')],
[4, 'This path leads to nowhere', new InvalidPath('This path leads to nowhere')]
];
}