Completed
Pull Request — master (#7308)
by Morris
19:44 queued 03:32
created
apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -37,78 +37,78 @@
 block discarded – undo
37 37
 use Sabre\DAV\Exception\ServiceUnavailable;
38 38
 
39 39
 class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
40
-	protected $nonFatalExceptions = [
41
-		NotAuthenticated::class => true,
42
-		// If tokenauth can throw this exception (which is basically as
43
-		// NotAuthenticated. So not fatal.
44
-		PasswordLoginForbidden::class => true,
45
-		// basically a NotAuthenticated
46
-		InvalidSyncToken::class => true,
47
-		// the sync client uses this to find out whether files exist,
48
-		// so it is not always an error, log it as debug
49
-		NotFound::class => true,
50
-		// this one mostly happens when the same file is uploaded at
51
-		// exactly the same time from two clients, only one client
52
-		// wins, the second one gets "Precondition failed"
53
-		PreconditionFailed::class => true,
54
-		// forbidden can be expected when trying to upload to
55
-		// read-only folders for example
56
-		Forbidden::class => true,
57
-		// Happens when an external storage or federated share is temporarily
58
-		// not available
59
-		StorageNotAvailableException::class => true,
60
-	];
40
+    protected $nonFatalExceptions = [
41
+        NotAuthenticated::class => true,
42
+        // If tokenauth can throw this exception (which is basically as
43
+        // NotAuthenticated. So not fatal.
44
+        PasswordLoginForbidden::class => true,
45
+        // basically a NotAuthenticated
46
+        InvalidSyncToken::class => true,
47
+        // the sync client uses this to find out whether files exist,
48
+        // so it is not always an error, log it as debug
49
+        NotFound::class => true,
50
+        // this one mostly happens when the same file is uploaded at
51
+        // exactly the same time from two clients, only one client
52
+        // wins, the second one gets "Precondition failed"
53
+        PreconditionFailed::class => true,
54
+        // forbidden can be expected when trying to upload to
55
+        // read-only folders for example
56
+        Forbidden::class => true,
57
+        // Happens when an external storage or federated share is temporarily
58
+        // not available
59
+        StorageNotAvailableException::class => true,
60
+    ];
61 61
 
62
-	/** @var string */
63
-	private $appName;
62
+    /** @var string */
63
+    private $appName;
64 64
 
65
-	/** @var ILogger */
66
-	private $logger;
65
+    /** @var ILogger */
66
+    private $logger;
67 67
 
68
-	/**
69
-	 * @param string $loggerAppName app name to use when logging
70
-	 * @param ILogger $logger
71
-	 */
72
-	public function __construct($loggerAppName, $logger) {
73
-		$this->appName = $loggerAppName;
74
-		$this->logger = $logger;
75
-	}
68
+    /**
69
+     * @param string $loggerAppName app name to use when logging
70
+     * @param ILogger $logger
71
+     */
72
+    public function __construct($loggerAppName, $logger) {
73
+        $this->appName = $loggerAppName;
74
+        $this->logger = $logger;
75
+    }
76 76
 
77
-	/**
78
-	 * This initializes the plugin.
79
-	 *
80
-	 * This function is called by \Sabre\DAV\Server, after
81
-	 * addPlugin is called.
82
-	 *
83
-	 * This method should set up the required event subscriptions.
84
-	 *
85
-	 * @param \Sabre\DAV\Server $server
86
-	 * @return void
87
-	 */
88
-	public function initialize(\Sabre\DAV\Server $server) {
77
+    /**
78
+     * This initializes the plugin.
79
+     *
80
+     * This function is called by \Sabre\DAV\Server, after
81
+     * addPlugin is called.
82
+     *
83
+     * This method should set up the required event subscriptions.
84
+     *
85
+     * @param \Sabre\DAV\Server $server
86
+     * @return void
87
+     */
88
+    public function initialize(\Sabre\DAV\Server $server) {
89 89
 
90
-		$server->on('exception', array($this, 'logException'), 10);
91
-	}
90
+        $server->on('exception', array($this, 'logException'), 10);
91
+    }
92 92
 
93
-	/**
94
-	 * Log exception
95
-	 *
96
-	 */
97
-	public function logException(\Exception $ex) {
98
-		$exceptionClass = get_class($ex);
99
-		$level = \OCP\Util::FATAL;
100
-		if (isset($this->nonFatalExceptions[$exceptionClass]) ||
101
-			(
102
-				$exceptionClass === ServiceUnavailable::class &&
103
-				$ex->getMessage() === 'System in maintenance mode.'
104
-			)
105
-		) {
106
-			$level = \OCP\Util::DEBUG;
107
-		}
93
+    /**
94
+     * Log exception
95
+     *
96
+     */
97
+    public function logException(\Exception $ex) {
98
+        $exceptionClass = get_class($ex);
99
+        $level = \OCP\Util::FATAL;
100
+        if (isset($this->nonFatalExceptions[$exceptionClass]) ||
101
+            (
102
+                $exceptionClass === ServiceUnavailable::class &&
103
+                $ex->getMessage() === 'System in maintenance mode.'
104
+            )
105
+        ) {
106
+            $level = \OCP\Util::DEBUG;
107
+        }
108 108
 
109
-		$this->logger->logException($ex, [
110
-			'app' => $this->appName,
111
-			'level' => $level,
112
-		]);
113
-	}
109
+        $this->logger->logException($ex, [
110
+            'app' => $this->appName,
111
+            'level' => $level,
112
+        ]);
113
+    }
114 114
 }
Please login to merge, or discard this patch.