Passed
Push — master ( 07dffb...bd5189 )
by John
11:02 queued 10s
created
apps/admin_audit/lib/Actions/GroupManagement.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -38,71 +38,71 @@
 block discarded – undo
38 38
  */
39 39
 class GroupManagement extends Action {
40 40
 
41
-	/**
42
-	 * log add user to group event
43
-	 *
44
-	 * @param IGroup $group
45
-	 * @param IUser $user
46
-	 */
47
-	public function addUser(IGroup $group, IUser $user) {
48
-		$this->log('User "%s" added to group "%s"',
49
-			[
50
-				'group' => $group->getGID(),
51
-				'user' => $user->getUID()
52
-			],
53
-			[
54
-				'user', 'group'
55
-			]
56
-		);
57
-	}
41
+    /**
42
+     * log add user to group event
43
+     *
44
+     * @param IGroup $group
45
+     * @param IUser $user
46
+     */
47
+    public function addUser(IGroup $group, IUser $user) {
48
+        $this->log('User "%s" added to group "%s"',
49
+            [
50
+                'group' => $group->getGID(),
51
+                'user' => $user->getUID()
52
+            ],
53
+            [
54
+                'user', 'group'
55
+            ]
56
+        );
57
+    }
58 58
 
59
-	/**
60
-	 * log remove user from group event
61
-	 *
62
-	 * @param IGroup $group
63
-	 * @param IUser $user
64
-	 */
65
-	public function removeUser(IGroup $group, IUser $user) {
66
-		$this->log('User "%s" removed from group "%s"',
67
-			[
68
-				'group' => $group->getGID(),
69
-				'user' => $user->getUID()
70
-			],
71
-			[
72
-				'user', 'group'
73
-			]
74
-		);
75
-	}
59
+    /**
60
+     * log remove user from group event
61
+     *
62
+     * @param IGroup $group
63
+     * @param IUser $user
64
+     */
65
+    public function removeUser(IGroup $group, IUser $user) {
66
+        $this->log('User "%s" removed from group "%s"',
67
+            [
68
+                'group' => $group->getGID(),
69
+                'user' => $user->getUID()
70
+            ],
71
+            [
72
+                'user', 'group'
73
+            ]
74
+        );
75
+    }
76 76
 	
77
-	/**
78
-	 * log create group to group event
79
-	 *
80
-	 * @param IGroup $group
81
-	 */
82
-	public function createGroup(IGroup $group) {
83
-		$this->log('Group created: "%s"',
84
-			[
85
-				'group' => $group->getGID()
86
-			],
87
-			[
88
-				'group'
89
-			]
90
-		);
91
-	}
77
+    /**
78
+     * log create group to group event
79
+     *
80
+     * @param IGroup $group
81
+     */
82
+    public function createGroup(IGroup $group) {
83
+        $this->log('Group created: "%s"',
84
+            [
85
+                'group' => $group->getGID()
86
+            ],
87
+            [
88
+                'group'
89
+            ]
90
+        );
91
+    }
92 92
 
93
-	/**
94
-	 * log delete group to group event
95
-	 *
96
-	 * @param IGroup $group
97
-	 */
98
-	public function deleteGroup(IGroup $group) {
99
-		$this->log('Group deleted: "%s"',
100
-			[
101
-				'group' => $group->getGID()
102
-			],
103
-			[
104
-				'group'
105
-			]
106
-		);
107
-	}
93
+    /**
94
+     * log delete group to group event
95
+     *
96
+     * @param IGroup $group
97
+     */
98
+    public function deleteGroup(IGroup $group) {
99
+        $this->log('Group deleted: "%s"',
100
+            [
101
+                'group' => $group->getGID()
102
+            ],
103
+            [
104
+                'group'
105
+            ]
106
+        );
107
+    }
108 108
 }
Please login to merge, or discard this patch.
apps/admin_audit/lib/Actions/Files.php 1 patch
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -29,137 +29,137 @@
 block discarded – undo
29 29
  * @package OCA\AdminAudit\Actions
30 30
  */
31 31
 class Files extends Action {
32
-	/**
33
-	 * Logs file read actions
34
-	 *
35
-	 * @param array $params
36
-	 */
37
-	public function read(array $params) {
38
-		$this->log(
39
-			'File accessed: "%s"',
40
-			$params,
41
-			[
42
-				'path',
43
-			]
44
-		);
45
-	}
32
+    /**
33
+     * Logs file read actions
34
+     *
35
+     * @param array $params
36
+     */
37
+    public function read(array $params) {
38
+        $this->log(
39
+            'File accessed: "%s"',
40
+            $params,
41
+            [
42
+                'path',
43
+            ]
44
+        );
45
+    }
46 46
 
47
-	/**
48
-	 * Logs rename actions of files
49
-	 *
50
-	 * @param array $params
51
-	 */
52
-	public function rename(array $params) {
53
-		$this->log(
54
-			'File renamed: "%s" to "%s"',
55
-			$params,
56
-			[
57
-				'oldpath',
58
-				'newpath',
59
-			]
60
-		);
61
-	}
47
+    /**
48
+     * Logs rename actions of files
49
+     *
50
+     * @param array $params
51
+     */
52
+    public function rename(array $params) {
53
+        $this->log(
54
+            'File renamed: "%s" to "%s"',
55
+            $params,
56
+            [
57
+                'oldpath',
58
+                'newpath',
59
+            ]
60
+        );
61
+    }
62 62
 
63
-	/**
64
-	 * Logs creation of files
65
-	 *
66
-	 * @param array $params
67
-	 */
68
-	public function create(array $params) {
69
-		if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) {
70
-			return;
71
-		}
63
+    /**
64
+     * Logs creation of files
65
+     *
66
+     * @param array $params
67
+     */
68
+    public function create(array $params) {
69
+        if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) {
70
+            return;
71
+        }
72 72
 
73
-		$this->log(
74
-			'File created: "%s"',
75
-			$params,
76
-			[
77
-				'path',
78
-			]
79
-		);
80
-	}
73
+        $this->log(
74
+            'File created: "%s"',
75
+            $params,
76
+            [
77
+                'path',
78
+            ]
79
+        );
80
+    }
81 81
 
82
-	/**
83
-	 * Logs copying of files
84
-	 *
85
-	 * @param array $params
86
-	 */
87
-	public function copy(array $params) {
88
-		$this->log(
89
-			'File copied: "%s" to "%s"',
90
-			$params,
91
-			[
92
-				'oldpath',
93
-				'newpath',
94
-			]
95
-		);
96
-	}
82
+    /**
83
+     * Logs copying of files
84
+     *
85
+     * @param array $params
86
+     */
87
+    public function copy(array $params) {
88
+        $this->log(
89
+            'File copied: "%s" to "%s"',
90
+            $params,
91
+            [
92
+                'oldpath',
93
+                'newpath',
94
+            ]
95
+        );
96
+    }
97 97
 
98
-	/**
99
-	 * Logs writing of files
100
-	 *
101
-	 * @param array $params
102
-	 */
103
-	public function write(array $params) {
104
-		if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) {
105
-			return;
106
-		}
98
+    /**
99
+     * Logs writing of files
100
+     *
101
+     * @param array $params
102
+     */
103
+    public function write(array $params) {
104
+        if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) {
105
+            return;
106
+        }
107 107
 
108
-		$this->log(
109
-			'File written to: "%s"',
110
-			$params,
111
-			[
112
-				'path',
113
-			]
114
-		);
115
-	}
108
+        $this->log(
109
+            'File written to: "%s"',
110
+            $params,
111
+            [
112
+                'path',
113
+            ]
114
+        );
115
+    }
116 116
 
117
-	/**
118
-	 * Logs update of files
119
-	 *
120
-	 * @param array $params
121
-	 */
122
-	public function update(array $params) {
123
-		$this->log(
124
-			'File updated: "%s"',
125
-			$params,
126
-			[
127
-				'path',
128
-			]
129
-		);
130
-	}
117
+    /**
118
+     * Logs update of files
119
+     *
120
+     * @param array $params
121
+     */
122
+    public function update(array $params) {
123
+        $this->log(
124
+            'File updated: "%s"',
125
+            $params,
126
+            [
127
+                'path',
128
+            ]
129
+        );
130
+    }
131 131
 
132
-	/**
133
-	 * Logs deletions of files
134
-	 *
135
-	 * @param array $params
136
-	 */
137
-	public function delete(array $params) {
138
-		$this->log(
139
-			'File deleted: "%s"',
140
-			$params,
141
-			[
142
-				'path',
143
-			]
144
-		);
145
-	}
132
+    /**
133
+     * Logs deletions of files
134
+     *
135
+     * @param array $params
136
+     */
137
+    public function delete(array $params) {
138
+        $this->log(
139
+            'File deleted: "%s"',
140
+            $params,
141
+            [
142
+                'path',
143
+            ]
144
+        );
145
+    }
146 146
 
147
-	/**
148
-	 * Logs preview access to a file
149
-	 *
150
-	 * @param array $params
151
-	 */
152
-	public function preview(array $params) {
153
-		$this->log(
154
-			'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")',
155
-			$params,
156
-			[
157
-				'path',
158
-				'width',
159
-				'height',
160
-				'crop',
161
-				'mode'
162
-			]
163
-		);
164
-	}
147
+    /**
148
+     * Logs preview access to a file
149
+     *
150
+     * @param array $params
151
+     */
152
+    public function preview(array $params) {
153
+        $this->log(
154
+            'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")',
155
+            $params,
156
+            [
157
+                'path',
158
+                'width',
159
+                'height',
160
+                'crop',
161
+                'mode'
162
+            ]
163
+        );
164
+    }
165 165
 }
Please login to merge, or discard this patch.
apps/admin_audit/lib/Actions/Auth.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -29,33 +29,33 @@
 block discarded – undo
29 29
  * @package OCA\AdminAudit\Actions
30 30
  */
31 31
 class Auth extends Action {
32
-	public function loginAttempt(array $params) {
33
-		$this->log(
34
-			'Login attempt: "%s"',
35
-			$params,
36
-			[
37
-				'uid',
38
-			],
39
-			true
40
-		);
41
-	}
32
+    public function loginAttempt(array $params) {
33
+        $this->log(
34
+            'Login attempt: "%s"',
35
+            $params,
36
+            [
37
+                'uid',
38
+            ],
39
+            true
40
+        );
41
+    }
42 42
 
43
-	public function loginSuccessful(array $params) {
44
-		$this->log(
45
-			'Login successful: "%s"',
46
-			$params,
47
-			[
48
-				'uid',
49
-			],
50
-			true
51
-		);
52
-	}
43
+    public function loginSuccessful(array $params) {
44
+        $this->log(
45
+            'Login successful: "%s"',
46
+            $params,
47
+            [
48
+                'uid',
49
+            ],
50
+            true
51
+        );
52
+    }
53 53
 
54
-	public function logout(array $params) {
55
-		$this->log(
56
-			'Logout occurred',
57
-			[],
58
-			[]
59
-		);
60
-	}
54
+    public function logout(array $params) {
55
+        $this->log(
56
+            'Logout occurred',
57
+            [],
58
+            []
59
+        );
60
+    }
61 61
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Settings/PersonalSection.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,25 +29,25 @@
 block discarded – undo
29 29
 use OCP\IUserSession;
30 30
 
31 31
 class PersonalSection extends Section {
32
-	/** @var IUserSession */
33
-	private $userSession;
32
+    /** @var IUserSession */
33
+    private $userSession;
34 34
 
35
-	/** @var UserGlobalStoragesService */
36
-	private $userGlobalStoragesService;
35
+    /** @var UserGlobalStoragesService */
36
+    private $userGlobalStoragesService;
37 37
 
38
-	/** @var BackendService */
39
-	private $backendService;
38
+    /** @var BackendService */
39
+    private $backendService;
40 40
 
41
-	public function __construct(
42
-		IURLGenerator $url,
43
-		IL10N $l,
44
-		IUserSession $userSession,
45
-		UserGlobalStoragesService $userGlobalStoragesService,
46
-		BackendService $backendService
47
-	) {
48
-		parent::__construct($url, $l);
49
-		$this->userSession = $userSession;
50
-		$this->userGlobalStoragesService = $userGlobalStoragesService;
51
-		$this->backendService = $backendService;
52
-	}
41
+    public function __construct(
42
+        IURLGenerator $url,
43
+        IL10N $l,
44
+        IUserSession $userSession,
45
+        UserGlobalStoragesService $userGlobalStoragesService,
46
+        BackendService $backendService
47
+    ) {
48
+        parent::__construct($url, $l);
49
+        $this->userSession = $userSession;
50
+        $this->userGlobalStoragesService = $userGlobalStoragesService;
51
+        $this->backendService = $backendService;
52
+    }
53 53
 }
Please login to merge, or discard this patch.
apps/encryption/templates/settings-personal.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@  discard block
 block discarded – undo
7 7
 <form id="ocDefaultEncryptionModule" class="section">
8 8
 	<h2 data-anchor-name="basic-encryption-module"><?php p($l->t('Basic encryption module')); ?></h2>
9 9
 
10
-	<?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED ): ?>
10
+	<?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED): ?>
11 11
 
12 12
 	<?php p($l->t("Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.")); ?>
13 13
 
14
-	<?php elseif ( $_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED ): ?>
14
+	<?php elseif ($_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED): ?>
15 15
 		<p>
16 16
 			<a name="changePKPasswd" />
17 17
 			<label for="changePrivateKeyPasswd">
18
-				<em><?php p( $l->t( "Your private key password no longer matches your log-in password." ) ); ?></em>
18
+				<em><?php p($l->t("Your private key password no longer matches your log-in password.")); ?></em>
19 19
 			</label>
20 20
 			<br />
21
-			<?php p( $l->t( "Set your old private key password to your current log-in password:" ) ); ?>
22
-			<?php if (  $_["recoveryEnabledForUser"] ):
23
-					p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) );
21
+			<?php p($l->t("Set your old private key password to your current log-in password:")); ?>
22
+			<?php if ($_["recoveryEnabledForUser"]):
23
+					p($l->t(" If you don't remember your old password you can ask your administrator to recover your files."));
24 24
 			endif; ?>
25 25
 			<br />
26 26
 			<input
27 27
 				type="password"
28 28
 				name="changePrivateKeyPassword"
29 29
 				id="oldPrivateKeyPassword" />
30
-			<label for="oldPrivateKeyPassword"><?php p($l->t( "Old log-in password" )); ?></label>
30
+			<label for="oldPrivateKeyPassword"><?php p($l->t("Old log-in password")); ?></label>
31 31
 			<br />
32 32
 			<input
33 33
 				type="password"
34 34
 				name="changePrivateKeyPassword"
35 35
 				id="newPrivateKeyPassword" />
36
-			<label for="newRecoveryPassword"><?php p($l->t( "Current log-in password" )); ?></label>
36
+			<label for="newRecoveryPassword"><?php p($l->t("Current log-in password")); ?></label>
37 37
 			<br />
38 38
 			<button
39 39
 				type="button"
40 40
 				name="submitChangePrivateKeyPassword"
41
-				disabled><?php p($l->t( "Update Private Key Password" )); ?>
41
+				disabled><?php p($l->t("Update Private Key Password")); ?>
42 42
 			</button>
43 43
 			<span class="msg"></span>
44 44
 		</p>
45 45
 
46
-	<?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] &&  $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?>
46
+	<?php elseif ($_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL): ?>
47 47
 		<br />
48 48
 		<p id="userEnableRecovery">
49
-			<label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
49
+			<label for="userEnableRecovery"><?php p($l->t("Enable password recovery:")); ?></label>
50 50
 			<span class="msg"></span>
51 51
 			<br />
52
-			<em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
52
+			<em><?php p($l->t("Enabling this option will allow you to reobtain access to your encrypted files in case of password loss")); ?></em>
53 53
 			<br />
54 54
 			<input
55 55
 			type="radio"
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 			id="userEnableRecoveryCheckbox"
58 58
 			name="userEnableRecovery"
59 59
 			value="1"
60
-			<?php echo ( $_["recoveryEnabledForUser"] ? 'checked="checked"' : '' ); ?> />
61
-			<label for="userEnableRecoveryCheckbox"><?php p( $l->t( "Enabled" ) ); ?></label>
60
+			<?php echo ($_["recoveryEnabledForUser"] ? 'checked="checked"' : ''); ?> />
61
+			<label for="userEnableRecoveryCheckbox"><?php p($l->t("Enabled")); ?></label>
62 62
 			<br />
63 63
 
64 64
 			<input
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 			id="userDisableRecoveryCheckbox"
68 68
 			name="userEnableRecovery"
69 69
 			value="0"
70
-			<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
71
-			<label for="userDisableRecoveryCheckbox"><?php p( $l->t( "Disabled" ) ); ?></label>
70
+			<?php echo ($_["recoveryEnabledForUser"] === false ? 'checked="checked"' : ''); ?> />
71
+			<label for="userDisableRecoveryCheckbox"><?php p($l->t("Disabled")); ?></label>
72 72
 		</p>
73 73
 	<?php endif; ?>
74 74
 </form>
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	/** @var array $_ */
3
-	/** @var \OCP\IL10N $l */
2
+    /** @var array $_ */
3
+    /** @var \OCP\IL10N $l */
4 4
 script('encryption', 'settings-personal');
5 5
 ?>
6 6
 <form id="ocDefaultEncryptionModule" class="section">
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 			<br />
20 20
 			<?php p( $l->t( "Set your old private key password to your current log-in password:" ) ); ?>
21 21
 			<?php if (  $_["recoveryEnabledForUser"] ):
22
-					p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) );
23
-			endif; ?>
22
+                    p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) );
23
+            endif; ?>
24 24
 			<br />
25 25
 			<input
26 26
 				type="password"
Please login to merge, or discard this patch.
lib/private/Files/Cache/Wrapper/JailPropagator.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,19 +26,19 @@
 block discarded – undo
26 26
 use OC\Files\Storage\Wrapper\Jail;
27 27
 
28 28
 class JailPropagator extends Propagator {
29
-	/**
30
-	 * @var Jail
31
-	 */
32
-	protected $storage;
29
+    /**
30
+     * @var Jail
31
+     */
32
+    protected $storage;
33 33
 
34
-	/**
35
-	 * @param string $internalPath
36
-	 * @param int $time
37
-	 * @param int $sizeDifference
38
-	 */
39
-	public function propagateChange($internalPath, $time, $sizeDifference = 0) {
40
-		/** @var \OC\Files\Storage\Storage $storage */
41
-		list($storage, $sourceInternalPath) = $this->storage->resolvePath($internalPath);
42
-		$storage->getPropagator()->propagateChange($sourceInternalPath, $time, $sizeDifference);
43
-	}
34
+    /**
35
+     * @param string $internalPath
36
+     * @param int $time
37
+     * @param int $sizeDifference
38
+     */
39
+    public function propagateChange($internalPath, $time, $sizeDifference = 0) {
40
+        /** @var \OC\Files\Storage\Storage $storage */
41
+        list($storage, $sourceInternalPath) = $this->storage->resolvePath($internalPath);
42
+        $storage->getPropagator()->propagateChange($sourceInternalPath, $time, $sizeDifference);
43
+    }
44 44
 }
Please login to merge, or discard this patch.
lib/private/Security/Bruteforce/Capabilities.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -24,29 +24,29 @@
 block discarded – undo
24 24
 use OCP\IRequest;
25 25
 
26 26
 class Capabilities implements IPublicCapability {
27
-	/** @var IRequest */
28
-	private $request;
27
+    /** @var IRequest */
28
+    private $request;
29 29
 
30
-	/** @var Throttler */
31
-	private $throttler;
30
+    /** @var Throttler */
31
+    private $throttler;
32 32
 
33
-	/**
34
-	 * Capabilities constructor.
35
-	 *
36
-	 * @param IRequest $request
37
-	 * @param Throttler $throttler
38
-	 */
39
-	public function __construct(IRequest $request,
40
-								Throttler $throttler) {
41
-		$this->request = $request;
42
-		$this->throttler = $throttler;
43
-	}
33
+    /**
34
+     * Capabilities constructor.
35
+     *
36
+     * @param IRequest $request
37
+     * @param Throttler $throttler
38
+     */
39
+    public function __construct(IRequest $request,
40
+                                Throttler $throttler) {
41
+        $this->request = $request;
42
+        $this->throttler = $throttler;
43
+    }
44 44
 
45
-	public function getCapabilities() {
46
-		return [
47
-			'bruteforce' => [
48
-				'delay' => $this->throttler->getDelay($this->request->getRemoteAddress())
49
-			]
50
-		];
51
-	}
45
+    public function getCapabilities() {
46
+        return [
47
+            'bruteforce' => [
48
+                'delay' => $this->throttler->getDelay($this->request->getRemoteAddress())
49
+            ]
50
+        ];
51
+    }
52 52
 }
Please login to merge, or discard this patch.
lib/private/Files/Storage/Wrapper/PermissionsMask.php 1 patch
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -37,122 +37,122 @@
 block discarded – undo
37 37
  * Note that the read permissions can't be masked
38 38
  */
39 39
 class PermissionsMask extends Wrapper {
40
-	/**
41
-	 * @var int the permissions bits we want to keep
42
-	 */
43
-	private $mask;
44
-
45
-	/**
46
-	 * @param array $arguments ['storage' => $storage, 'mask' => $mask]
47
-	 *
48
-	 * $storage: The storage the permissions mask should be applied on
49
-	 * $mask: The permission bits that should be kept, a combination of the \OCP\Constant::PERMISSION_ constants
50
-	 */
51
-	public function __construct($arguments) {
52
-		parent::__construct($arguments);
53
-		$this->mask = $arguments['mask'];
54
-	}
55
-
56
-	private function checkMask($permissions) {
57
-		return ($this->mask & $permissions) === $permissions;
58
-	}
59
-
60
-	public function isUpdatable($path) {
61
-		return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::isUpdatable($path);
62
-	}
63
-
64
-	public function isCreatable($path) {
65
-		return $this->checkMask(Constants::PERMISSION_CREATE) and parent::isCreatable($path);
66
-	}
67
-
68
-	public function isDeletable($path) {
69
-		return $this->checkMask(Constants::PERMISSION_DELETE) and parent::isDeletable($path);
70
-	}
71
-
72
-	public function isSharable($path) {
73
-		return $this->checkMask(Constants::PERMISSION_SHARE) and parent::isSharable($path);
74
-	}
75
-
76
-	public function getPermissions($path) {
77
-		return $this->storage->getPermissions($path) & $this->mask;
78
-	}
79
-
80
-	public function rename($path1, $path2) {
81
-		$p = strpos($path1, $path2);
82
-		if ($p === 0) {
83
-			$part = substr($path1, strlen($path2));
84
-			//This is a rename of the transfer file to the original file
85
-			if (strpos($part, '.ocTransferId') === 0) {
86
-				return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $path2);
87
-			}
88
-		}
89
-		return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::rename($path1, $path2);
90
-	}
91
-
92
-	public function copy($path1, $path2) {
93
-		return $this->checkMask(Constants::PERMISSION_CREATE) and parent::copy($path1, $path2);
94
-	}
95
-
96
-	public function touch($path, $mtime = null) {
97
-		$permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
98
-		return $this->checkMask($permissions) and parent::touch($path, $mtime);
99
-	}
100
-
101
-	public function mkdir($path) {
102
-		return $this->checkMask(Constants::PERMISSION_CREATE) and parent::mkdir($path);
103
-	}
104
-
105
-	public function rmdir($path) {
106
-		return $this->checkMask(Constants::PERMISSION_DELETE) and parent::rmdir($path);
107
-	}
108
-
109
-	public function unlink($path) {
110
-		return $this->checkMask(Constants::PERMISSION_DELETE) and parent::unlink($path);
111
-	}
112
-
113
-	public function file_put_contents($path, $data) {
114
-		$permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
115
-		return $this->checkMask($permissions) ? parent::file_put_contents($path, $data) : false;
116
-	}
117
-
118
-	public function fopen($path, $mode) {
119
-		if ($mode === 'r' or $mode === 'rb') {
120
-			return parent::fopen($path, $mode);
121
-		} else {
122
-			$permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
123
-			return $this->checkMask($permissions) ? parent::fopen($path, $mode) : false;
124
-		}
125
-	}
126
-
127
-	/**
128
-	 * get a cache instance for the storage
129
-	 *
130
-	 * @param string $path
131
-	 * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache
132
-	 * @return \OC\Files\Cache\Cache
133
-	 */
134
-	public function getCache($path = '', $storage = null) {
135
-		if (!$storage) {
136
-			$storage = $this;
137
-		}
138
-		$sourceCache = parent::getCache($path, $storage);
139
-		return new CachePermissionsMask($sourceCache, $this->mask);
140
-	}
141
-
142
-	public function getMetaData($path) {
143
-		$data = parent::getMetaData($path);
144
-
145
-		if ($data && isset($data['permissions'])) {
146
-			$data['scan_permissions'] = isset($data['scan_permissions']) ? $data['scan_permissions'] : $data['permissions'];
147
-			$data['permissions'] &= $this->mask;
148
-		}
149
-		return $data;
150
-	}
151
-
152
-	public function getScanner($path = '', $storage = null) {
153
-		if (!$storage) {
154
-			$storage = $this->storage;
155
-		}
156
-		return parent::getScanner($path, $storage);
157
-	}
40
+    /**
41
+     * @var int the permissions bits we want to keep
42
+     */
43
+    private $mask;
44
+
45
+    /**
46
+     * @param array $arguments ['storage' => $storage, 'mask' => $mask]
47
+     *
48
+     * $storage: The storage the permissions mask should be applied on
49
+     * $mask: The permission bits that should be kept, a combination of the \OCP\Constant::PERMISSION_ constants
50
+     */
51
+    public function __construct($arguments) {
52
+        parent::__construct($arguments);
53
+        $this->mask = $arguments['mask'];
54
+    }
55
+
56
+    private function checkMask($permissions) {
57
+        return ($this->mask & $permissions) === $permissions;
58
+    }
59
+
60
+    public function isUpdatable($path) {
61
+        return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::isUpdatable($path);
62
+    }
63
+
64
+    public function isCreatable($path) {
65
+        return $this->checkMask(Constants::PERMISSION_CREATE) and parent::isCreatable($path);
66
+    }
67
+
68
+    public function isDeletable($path) {
69
+        return $this->checkMask(Constants::PERMISSION_DELETE) and parent::isDeletable($path);
70
+    }
71
+
72
+    public function isSharable($path) {
73
+        return $this->checkMask(Constants::PERMISSION_SHARE) and parent::isSharable($path);
74
+    }
75
+
76
+    public function getPermissions($path) {
77
+        return $this->storage->getPermissions($path) & $this->mask;
78
+    }
79
+
80
+    public function rename($path1, $path2) {
81
+        $p = strpos($path1, $path2);
82
+        if ($p === 0) {
83
+            $part = substr($path1, strlen($path2));
84
+            //This is a rename of the transfer file to the original file
85
+            if (strpos($part, '.ocTransferId') === 0) {
86
+                return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $path2);
87
+            }
88
+        }
89
+        return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::rename($path1, $path2);
90
+    }
91
+
92
+    public function copy($path1, $path2) {
93
+        return $this->checkMask(Constants::PERMISSION_CREATE) and parent::copy($path1, $path2);
94
+    }
95
+
96
+    public function touch($path, $mtime = null) {
97
+        $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
98
+        return $this->checkMask($permissions) and parent::touch($path, $mtime);
99
+    }
100
+
101
+    public function mkdir($path) {
102
+        return $this->checkMask(Constants::PERMISSION_CREATE) and parent::mkdir($path);
103
+    }
104
+
105
+    public function rmdir($path) {
106
+        return $this->checkMask(Constants::PERMISSION_DELETE) and parent::rmdir($path);
107
+    }
108
+
109
+    public function unlink($path) {
110
+        return $this->checkMask(Constants::PERMISSION_DELETE) and parent::unlink($path);
111
+    }
112
+
113
+    public function file_put_contents($path, $data) {
114
+        $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
115
+        return $this->checkMask($permissions) ? parent::file_put_contents($path, $data) : false;
116
+    }
117
+
118
+    public function fopen($path, $mode) {
119
+        if ($mode === 'r' or $mode === 'rb') {
120
+            return parent::fopen($path, $mode);
121
+        } else {
122
+            $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
123
+            return $this->checkMask($permissions) ? parent::fopen($path, $mode) : false;
124
+        }
125
+    }
126
+
127
+    /**
128
+     * get a cache instance for the storage
129
+     *
130
+     * @param string $path
131
+     * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache
132
+     * @return \OC\Files\Cache\Cache
133
+     */
134
+    public function getCache($path = '', $storage = null) {
135
+        if (!$storage) {
136
+            $storage = $this;
137
+        }
138
+        $sourceCache = parent::getCache($path, $storage);
139
+        return new CachePermissionsMask($sourceCache, $this->mask);
140
+    }
141
+
142
+    public function getMetaData($path) {
143
+        $data = parent::getMetaData($path);
144
+
145
+        if ($data && isset($data['permissions'])) {
146
+            $data['scan_permissions'] = isset($data['scan_permissions']) ? $data['scan_permissions'] : $data['permissions'];
147
+            $data['permissions'] &= $this->mask;
148
+        }
149
+        return $data;
150
+    }
151
+
152
+    public function getScanner($path = '', $storage = null) {
153
+        if (!$storage) {
154
+            $storage = $this->storage;
155
+        }
156
+        return parent::getScanner($path, $storage);
157
+    }
158 158
 }
Please login to merge, or discard this patch.
lib/private/Diagnostics/QueryLogger.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -29,68 +29,68 @@
 block discarded – undo
29 29
 use OCP\Diagnostics\IQueryLogger;
30 30
 
31 31
 class QueryLogger implements IQueryLogger {
32
-	/**
33
-	 * @var \OC\Diagnostics\Query
34
-	 */
35
-	protected $activeQuery;
32
+    /**
33
+     * @var \OC\Diagnostics\Query
34
+     */
35
+    protected $activeQuery;
36 36
 
37
-	/**
38
-	 * @var CappedMemoryCache
39
-	 */
40
-	protected $queries;
37
+    /**
38
+     * @var CappedMemoryCache
39
+     */
40
+    protected $queries;
41 41
 
42
-	/**
43
-	 * QueryLogger constructor.
44
-	 */
45
-	public function __construct() {
46
-		$this->queries = new CappedMemoryCache(1024);
47
-	}
42
+    /**
43
+     * QueryLogger constructor.
44
+     */
45
+    public function __construct() {
46
+        $this->queries = new CappedMemoryCache(1024);
47
+    }
48 48
 
49 49
 
50
-	/**
51
-	 * @var bool - Module needs to be activated by some app
52
-	 */
53
-	private $activated = false;
50
+    /**
51
+     * @var bool - Module needs to be activated by some app
52
+     */
53
+    private $activated = false;
54 54
 
55
-	/**
56
-	 * @inheritdoc
57
-	 */
58
-	public function startQuery($sql, array $params = null, array $types = null) {
59
-		if ($this->activated) {
60
-			$this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack());
61
-		}
62
-	}
55
+    /**
56
+     * @inheritdoc
57
+     */
58
+    public function startQuery($sql, array $params = null, array $types = null) {
59
+        if ($this->activated) {
60
+            $this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack());
61
+        }
62
+    }
63 63
 
64
-	private function getStack() {
65
-		$stack = debug_backtrace();
66
-		array_shift($stack);
67
-		array_shift($stack);
68
-		array_shift($stack);
69
-		return $stack;
70
-	}
64
+    private function getStack() {
65
+        $stack = debug_backtrace();
66
+        array_shift($stack);
67
+        array_shift($stack);
68
+        array_shift($stack);
69
+        return $stack;
70
+    }
71 71
 
72
-	/**
73
-	 * @inheritdoc
74
-	 */
75
-	public function stopQuery() {
76
-		if ($this->activated && $this->activeQuery) {
77
-			$this->activeQuery->end(microtime(true));
78
-			$this->queries[] = $this->activeQuery;
79
-			$this->activeQuery = null;
80
-		}
81
-	}
72
+    /**
73
+     * @inheritdoc
74
+     */
75
+    public function stopQuery() {
76
+        if ($this->activated && $this->activeQuery) {
77
+            $this->activeQuery->end(microtime(true));
78
+            $this->queries[] = $this->activeQuery;
79
+            $this->activeQuery = null;
80
+        }
81
+    }
82 82
 
83
-	/**
84
-	 * @inheritdoc
85
-	 */
86
-	public function getQueries() {
87
-		return $this->queries->getData();
88
-	}
83
+    /**
84
+     * @inheritdoc
85
+     */
86
+    public function getQueries() {
87
+        return $this->queries->getData();
88
+    }
89 89
 
90
-	/**
91
-	 * @inheritdoc
92
-	 */
93
-	public function activate() {
94
-		$this->activated = true;
95
-	}
90
+    /**
91
+     * @inheritdoc
92
+     */
93
+    public function activate() {
94
+        $this->activated = true;
95
+    }
96 96
 }
Please login to merge, or discard this patch.