Completed
Push — master ( 034246...d4e9a8 )
by
unknown
19:42 queued 13s
created
lib/private/Authentication/TwoFactorAuth/ProviderSet.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	 * @return IProvider[]
73 73
 	 */
74 74
 	public function getPrimaryProviders(): array {
75
-		return array_filter($this->providers, function (IProvider $provider) {
75
+		return array_filter($this->providers, function(IProvider $provider) {
76 76
 			return !($provider instanceof BackupCodesProvider);
77 77
 		});
78 78
 	}
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,49 +33,49 @@
 block discarded – undo
33 33
  * Contains all two-factor provider information for the two-factor login challenge
34 34
  */
35 35
 class ProviderSet {
36
-	/** @var IProvider */
37
-	private $providers;
36
+    /** @var IProvider */
37
+    private $providers;
38 38
 
39
-	/** @var bool */
40
-	private $providerMissing;
39
+    /** @var bool */
40
+    private $providerMissing;
41 41
 
42
-	/**
43
-	 * @param IProvider[] $providers
44
-	 * @param bool $providerMissing
45
-	 */
46
-	public function __construct(array $providers, bool $providerMissing) {
47
-		$this->providers = [];
48
-		foreach ($providers as $provider) {
49
-			$this->providers[$provider->getId()] = $provider;
50
-		}
51
-		$this->providerMissing = $providerMissing;
52
-	}
42
+    /**
43
+     * @param IProvider[] $providers
44
+     * @param bool $providerMissing
45
+     */
46
+    public function __construct(array $providers, bool $providerMissing) {
47
+        $this->providers = [];
48
+        foreach ($providers as $provider) {
49
+            $this->providers[$provider->getId()] = $provider;
50
+        }
51
+        $this->providerMissing = $providerMissing;
52
+    }
53 53
 
54
-	/**
55
-	 * @param string $providerId
56
-	 * @return IProvider|null
57
-	 */
58
-	public function getProvider(string $providerId) {
59
-		return $this->providers[$providerId] ?? null;
60
-	}
54
+    /**
55
+     * @param string $providerId
56
+     * @return IProvider|null
57
+     */
58
+    public function getProvider(string $providerId) {
59
+        return $this->providers[$providerId] ?? null;
60
+    }
61 61
 
62
-	/**
63
-	 * @return IProvider[]
64
-	 */
65
-	public function getProviders(): array {
66
-		return $this->providers;
67
-	}
62
+    /**
63
+     * @return IProvider[]
64
+     */
65
+    public function getProviders(): array {
66
+        return $this->providers;
67
+    }
68 68
 
69
-	/**
70
-	 * @return IProvider[]
71
-	 */
72
-	public function getPrimaryProviders(): array {
73
-		return array_filter($this->providers, function (IProvider $provider) {
74
-			return !($provider instanceof BackupCodesProvider);
75
-		});
76
-	}
69
+    /**
70
+     * @return IProvider[]
71
+     */
72
+    public function getPrimaryProviders(): array {
73
+        return array_filter($this->providers, function (IProvider $provider) {
74
+            return !($provider instanceof BackupCodesProvider);
75
+        });
76
+    }
77 77
 
78
-	public function isProviderMissing(): bool {
79
-		return $this->providerMissing;
80
-	}
78
+    public function isProviderMissing(): bool {
79
+        return $this->providerMissing;
80
+    }
81 81
 }
Please login to merge, or discard this patch.
lib/private/Collaboration/Resources/Collection.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @since 16.0.0
127 127
 	 */
128 128
 	public function addResource(IResource $resource): void {
129
-		array_map(function (IResource $r) use ($resource) {
129
+		array_map(function(IResource $r) use ($resource) {
130 130
 			if ($this->isSameResource($r, $resource)) {
131 131
 				throw new ResourceException('Already part of the collection');
132 132
 			}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @since 16.0.0
159 159
 	 */
160 160
 	public function removeResource(IResource $resource): void {
161
-		$this->resources = array_filter($this->getResources(), function (IResource $r) use ($resource) {
161
+		$this->resources = array_filter($this->getResources(), function(IResource $r) use ($resource) {
162 162
 			return !$this->isSameResource($r, $resource);
163 163
 		});
164 164
 
Please login to merge, or discard this patch.
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -18,163 +18,163 @@
 block discarded – undo
18 18
 use OCP\IUser;
19 19
 
20 20
 class Collection implements ICollection {
21
-	/** @var IResource[] */
22
-	protected array $resources = [];
23
-
24
-	public function __construct(
25
-		/** @var Manager $manager */
26
-		protected IManager $manager,
27
-		protected IDBConnection $connection,
28
-		protected int $id,
29
-		protected string $name,
30
-		protected ?IUser $userForAccess = null,
31
-		protected ?bool $access = null,
32
-	) {
33
-	}
34
-
35
-	/**
36
-	 * @since 16.0.0
37
-	 */
38
-	public function getId(): int {
39
-		return $this->id;
40
-	}
41
-
42
-	/**
43
-	 * @since 16.0.0
44
-	 */
45
-	public function getName(): string {
46
-		return $this->name;
47
-	}
48
-
49
-	/**
50
-	 * @since 16.0.0
51
-	 */
52
-	public function setName(string $name): void {
53
-		$query = $this->connection->getQueryBuilder();
54
-		$query->update(Manager::TABLE_COLLECTIONS)
55
-			->set('name', $query->createNamedParameter($name))
56
-			->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
57
-		$query->executeStatement();
58
-
59
-		$this->name = $name;
60
-	}
61
-
62
-	/**
63
-	 * @return IResource[]
64
-	 * @since 16.0.0
65
-	 */
66
-	public function getResources(): array {
67
-		if (empty($this->resources)) {
68
-			$this->resources = $this->manager->getResourcesByCollectionForUser($this, $this->userForAccess);
69
-		}
70
-
71
-		return $this->resources;
72
-	}
73
-
74
-	/**
75
-	 * Adds a resource to a collection
76
-	 *
77
-	 * @throws ResourceException when the resource is already part of the collection
78
-	 * @since 16.0.0
79
-	 */
80
-	public function addResource(IResource $resource): void {
81
-		array_map(function (IResource $r) use ($resource) {
82
-			if ($this->isSameResource($r, $resource)) {
83
-				throw new ResourceException('Already part of the collection');
84
-			}
85
-		}, $this->getResources());
86
-
87
-		$this->resources[] = $resource;
88
-
89
-		$query = $this->connection->getQueryBuilder();
90
-		$query->insert(Manager::TABLE_RESOURCES)
91
-			->values([
92
-				'collection_id' => $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT),
93
-				'resource_type' => $query->createNamedParameter($resource->getType()),
94
-				'resource_id' => $query->createNamedParameter($resource->getId()),
95
-			]);
96
-
97
-		try {
98
-			$query->execute();
99
-		} catch (ConstraintViolationException $e) {
100
-			throw new ResourceException('Already part of the collection');
101
-		}
102
-
103
-		$this->manager->invalidateAccessCacheForCollection($this);
104
-	}
105
-
106
-	/**
107
-	 * Removes a resource from a collection
108
-	 *
109
-	 * @since 16.0.0
110
-	 */
111
-	public function removeResource(IResource $resource): void {
112
-		$this->resources = array_filter($this->getResources(), function (IResource $r) use ($resource) {
113
-			return !$this->isSameResource($r, $resource);
114
-		});
115
-
116
-		$query = $this->connection->getQueryBuilder();
117
-		$query->delete(Manager::TABLE_RESOURCES)
118
-			->where($query->expr()->eq('collection_id', $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT)))
119
-			->andWhere($query->expr()->eq('resource_type', $query->createNamedParameter($resource->getType())))
120
-			->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($resource->getId())));
121
-		$query->executeStatement();
122
-
123
-		if (empty($this->resources)) {
124
-			$this->removeCollection();
125
-		} else {
126
-			$this->manager->invalidateAccessCacheForCollection($this);
127
-		}
128
-	}
129
-
130
-	/**
131
-	 * Can a user/guest access the collection
132
-	 *
133
-	 * @since 16.0.0
134
-	 */
135
-	public function canAccess(?IUser $user): bool {
136
-		if ($user instanceof IUser) {
137
-			return $this->canUserAccess($user);
138
-		}
139
-		return $this->canGuestAccess();
140
-	}
141
-
142
-	protected function canUserAccess(IUser $user): bool {
143
-		if (\is_bool($this->access) && $this->userForAccess instanceof IUser && $user->getUID() === $this->userForAccess->getUID()) {
144
-			return $this->access;
145
-		}
146
-
147
-		$access = $this->manager->canAccessCollection($this, $user);
148
-		if ($this->userForAccess instanceof IUser && $user->getUID() === $this->userForAccess->getUID()) {
149
-			$this->access = $access;
150
-		}
151
-		return $access;
152
-	}
153
-
154
-	protected function canGuestAccess(): bool {
155
-		if (\is_bool($this->access) && !$this->userForAccess instanceof IUser) {
156
-			return $this->access;
157
-		}
158
-
159
-		$access = $this->manager->canAccessCollection($this, null);
160
-		if (!$this->userForAccess instanceof IUser) {
161
-			$this->access = $access;
162
-		}
163
-		return $access;
164
-	}
165
-
166
-	protected function isSameResource(IResource $resource1, IResource $resource2): bool {
167
-		return $resource1->getType() === $resource2->getType()
168
-			&& $resource1->getId() === $resource2->getId();
169
-	}
170
-
171
-	protected function removeCollection(): void {
172
-		$query = $this->connection->getQueryBuilder();
173
-		$query->delete(Manager::TABLE_COLLECTIONS)
174
-			->where($query->expr()->eq('id', $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT)));
175
-		$query->executeStatement();
176
-
177
-		$this->manager->invalidateAccessCacheForCollection($this);
178
-		$this->id = 0;
179
-	}
21
+    /** @var IResource[] */
22
+    protected array $resources = [];
23
+
24
+    public function __construct(
25
+        /** @var Manager $manager */
26
+        protected IManager $manager,
27
+        protected IDBConnection $connection,
28
+        protected int $id,
29
+        protected string $name,
30
+        protected ?IUser $userForAccess = null,
31
+        protected ?bool $access = null,
32
+    ) {
33
+    }
34
+
35
+    /**
36
+     * @since 16.0.0
37
+     */
38
+    public function getId(): int {
39
+        return $this->id;
40
+    }
41
+
42
+    /**
43
+     * @since 16.0.0
44
+     */
45
+    public function getName(): string {
46
+        return $this->name;
47
+    }
48
+
49
+    /**
50
+     * @since 16.0.0
51
+     */
52
+    public function setName(string $name): void {
53
+        $query = $this->connection->getQueryBuilder();
54
+        $query->update(Manager::TABLE_COLLECTIONS)
55
+            ->set('name', $query->createNamedParameter($name))
56
+            ->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
57
+        $query->executeStatement();
58
+
59
+        $this->name = $name;
60
+    }
61
+
62
+    /**
63
+     * @return IResource[]
64
+     * @since 16.0.0
65
+     */
66
+    public function getResources(): array {
67
+        if (empty($this->resources)) {
68
+            $this->resources = $this->manager->getResourcesByCollectionForUser($this, $this->userForAccess);
69
+        }
70
+
71
+        return $this->resources;
72
+    }
73
+
74
+    /**
75
+     * Adds a resource to a collection
76
+     *
77
+     * @throws ResourceException when the resource is already part of the collection
78
+     * @since 16.0.0
79
+     */
80
+    public function addResource(IResource $resource): void {
81
+        array_map(function (IResource $r) use ($resource) {
82
+            if ($this->isSameResource($r, $resource)) {
83
+                throw new ResourceException('Already part of the collection');
84
+            }
85
+        }, $this->getResources());
86
+
87
+        $this->resources[] = $resource;
88
+
89
+        $query = $this->connection->getQueryBuilder();
90
+        $query->insert(Manager::TABLE_RESOURCES)
91
+            ->values([
92
+                'collection_id' => $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT),
93
+                'resource_type' => $query->createNamedParameter($resource->getType()),
94
+                'resource_id' => $query->createNamedParameter($resource->getId()),
95
+            ]);
96
+
97
+        try {
98
+            $query->execute();
99
+        } catch (ConstraintViolationException $e) {
100
+            throw new ResourceException('Already part of the collection');
101
+        }
102
+
103
+        $this->manager->invalidateAccessCacheForCollection($this);
104
+    }
105
+
106
+    /**
107
+     * Removes a resource from a collection
108
+     *
109
+     * @since 16.0.0
110
+     */
111
+    public function removeResource(IResource $resource): void {
112
+        $this->resources = array_filter($this->getResources(), function (IResource $r) use ($resource) {
113
+            return !$this->isSameResource($r, $resource);
114
+        });
115
+
116
+        $query = $this->connection->getQueryBuilder();
117
+        $query->delete(Manager::TABLE_RESOURCES)
118
+            ->where($query->expr()->eq('collection_id', $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT)))
119
+            ->andWhere($query->expr()->eq('resource_type', $query->createNamedParameter($resource->getType())))
120
+            ->andWhere($query->expr()->eq('resource_id', $query->createNamedParameter($resource->getId())));
121
+        $query->executeStatement();
122
+
123
+        if (empty($this->resources)) {
124
+            $this->removeCollection();
125
+        } else {
126
+            $this->manager->invalidateAccessCacheForCollection($this);
127
+        }
128
+    }
129
+
130
+    /**
131
+     * Can a user/guest access the collection
132
+     *
133
+     * @since 16.0.0
134
+     */
135
+    public function canAccess(?IUser $user): bool {
136
+        if ($user instanceof IUser) {
137
+            return $this->canUserAccess($user);
138
+        }
139
+        return $this->canGuestAccess();
140
+    }
141
+
142
+    protected function canUserAccess(IUser $user): bool {
143
+        if (\is_bool($this->access) && $this->userForAccess instanceof IUser && $user->getUID() === $this->userForAccess->getUID()) {
144
+            return $this->access;
145
+        }
146
+
147
+        $access = $this->manager->canAccessCollection($this, $user);
148
+        if ($this->userForAccess instanceof IUser && $user->getUID() === $this->userForAccess->getUID()) {
149
+            $this->access = $access;
150
+        }
151
+        return $access;
152
+    }
153
+
154
+    protected function canGuestAccess(): bool {
155
+        if (\is_bool($this->access) && !$this->userForAccess instanceof IUser) {
156
+            return $this->access;
157
+        }
158
+
159
+        $access = $this->manager->canAccessCollection($this, null);
160
+        if (!$this->userForAccess instanceof IUser) {
161
+            $this->access = $access;
162
+        }
163
+        return $access;
164
+    }
165
+
166
+    protected function isSameResource(IResource $resource1, IResource $resource2): bool {
167
+        return $resource1->getType() === $resource2->getType()
168
+            && $resource1->getId() === $resource2->getId();
169
+    }
170
+
171
+    protected function removeCollection(): void {
172
+        $query = $this->connection->getQueryBuilder();
173
+        $query->delete(Manager::TABLE_COLLECTIONS)
174
+            ->where($query->expr()->eq('id', $query->createNamedParameter($this->id, IQueryBuilder::PARAM_INT)));
175
+        $query->executeStatement();
176
+
177
+        $this->manager->invalidateAccessCacheForCollection($this);
178
+        $this->id = 0;
179
+    }
180 180
 }
Please login to merge, or discard this patch.
lib/public/Accounts/PropertyDoesNotExistException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 	 * @since 15.0.0
39 39
 	 */
40 40
 	public function __construct($property) {
41
-		parent::__construct('Property ' . $property . ' does not exist.');
41
+		parent::__construct('Property '.$property.' does not exist.');
42 42
 	}
43 43
 
44 44
 }
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
30 30
  *
31 31
  */
32 32
 class PropertyDoesNotExistException extends \Exception {
33
-	/**
34
-	 * Constructor
35
-	 * @param string $msg the error message
36
-	 * @since 15.0.0
37
-	 */
38
-	public function __construct($property) {
39
-		parent::__construct('Property ' . $property . ' does not exist.');
40
-	}
33
+    /**
34
+     * Constructor
35
+     * @param string $msg the error message
36
+     * @since 15.0.0
37
+     */
38
+    public function __construct($property) {
39
+        parent::__construct('Property ' . $property . ' does not exist.');
40
+    }
41 41
 }
Please login to merge, or discard this patch.
lib/private/Collaboration/Collaborators/RemotePlugin.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 							$searchResult->markExactIdMatch($resultType);
113 113
 						}
114 114
 						$result['exact'][] = [
115
-							'label' => $contact['FN'] . " ($cloudId)",
115
+							'label' => $contact['FN']." ($cloudId)",
116 116
 							'uuid' => $contact['UID'],
117 117
 							'name' => $contact['FN'],
118 118
 							'type' => $cloudIdType,
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 						];
125 125
 					} else {
126 126
 						$result['wide'][] = [
127
-							'label' => $contact['FN'] . " ($cloudId)",
127
+							'label' => $contact['FN']." ($cloudId)",
128 128
 							'uuid' => $contact['UID'],
129 129
 							'name' => $contact['FN'],
130 130
 							'type' => $cloudIdType,
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 				$localUser = $this->userManager->get($remoteUser);
155 155
 				if ($localUser === null || $search !== $localUser->getCloudId()) {
156 156
 					$result['exact'][] = [
157
-						'label' => $remoteUser . " ($serverUrl)",
157
+						'label' => $remoteUser." ($serverUrl)",
158 158
 						'uuid' => $remoteUser,
159 159
 						'name' => $remoteUser,
160 160
 						'value' => [
Please login to merge, or discard this patch.
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -16,150 +16,150 @@
 block discarded – undo
16 16
 use OCP\Share\IShare;
17 17
 
18 18
 class RemotePlugin implements ISearchPlugin {
19
-	protected bool $shareeEnumeration;
19
+    protected bool $shareeEnumeration;
20 20
 
21
-	private string $userId;
21
+    private string $userId;
22 22
 
23
-	public function __construct(
24
-		private IManager $contactsManager,
25
-		private ICloudIdManager $cloudIdManager,
26
-		private IConfig $config,
27
-		private IUserManager $userManager,
28
-		IUserSession $userSession,
29
-	) {
30
-		$this->userId = $userSession->getUser()?->getUID() ?? '';
31
-		$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
32
-	}
23
+    public function __construct(
24
+        private IManager $contactsManager,
25
+        private ICloudIdManager $cloudIdManager,
26
+        private IConfig $config,
27
+        private IUserManager $userManager,
28
+        IUserSession $userSession,
29
+    ) {
30
+        $this->userId = $userSession->getUser()?->getUID() ?? '';
31
+        $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
32
+    }
33 33
 
34
-	public function search($search, $limit, $offset, ISearchResult $searchResult): bool {
35
-		$result = ['wide' => [], 'exact' => []];
36
-		$resultType = new SearchResultType('remotes');
34
+    public function search($search, $limit, $offset, ISearchResult $searchResult): bool {
35
+        $result = ['wide' => [], 'exact' => []];
36
+        $resultType = new SearchResultType('remotes');
37 37
 
38
-		// Search in contacts
39
-		$addressBookContacts = $this->contactsManager->search($search, ['CLOUD', 'FN'], [
40
-			'limit' => $limit,
41
-			'offset' => $offset,
42
-			'enumeration' => false,
43
-			'fullmatch' => false,
44
-		]);
45
-		foreach ($addressBookContacts as $contact) {
46
-			if (isset($contact['isLocalSystemBook'])) {
47
-				continue;
48
-			}
49
-			if (isset($contact['CLOUD'])) {
50
-				$cloudIds = $contact['CLOUD'];
51
-				if (is_string($cloudIds)) {
52
-					$cloudIds = [$cloudIds];
53
-				}
54
-				$lowerSearch = strtolower($search);
55
-				foreach ($cloudIds as $cloudId) {
56
-					$cloudIdType = '';
57
-					if (\is_array($cloudId)) {
58
-						$cloudIdData = $cloudId;
59
-						$cloudId = $cloudIdData['value'];
60
-						$cloudIdType = $cloudIdData['type'];
61
-					}
62
-					try {
63
-						[$remoteUser, $serverUrl] = $this->splitUserRemote($cloudId);
64
-					} catch (\InvalidArgumentException $e) {
65
-						continue;
66
-					}
38
+        // Search in contacts
39
+        $addressBookContacts = $this->contactsManager->search($search, ['CLOUD', 'FN'], [
40
+            'limit' => $limit,
41
+            'offset' => $offset,
42
+            'enumeration' => false,
43
+            'fullmatch' => false,
44
+        ]);
45
+        foreach ($addressBookContacts as $contact) {
46
+            if (isset($contact['isLocalSystemBook'])) {
47
+                continue;
48
+            }
49
+            if (isset($contact['CLOUD'])) {
50
+                $cloudIds = $contact['CLOUD'];
51
+                if (is_string($cloudIds)) {
52
+                    $cloudIds = [$cloudIds];
53
+                }
54
+                $lowerSearch = strtolower($search);
55
+                foreach ($cloudIds as $cloudId) {
56
+                    $cloudIdType = '';
57
+                    if (\is_array($cloudId)) {
58
+                        $cloudIdData = $cloudId;
59
+                        $cloudId = $cloudIdData['value'];
60
+                        $cloudIdType = $cloudIdData['type'];
61
+                    }
62
+                    try {
63
+                        [$remoteUser, $serverUrl] = $this->splitUserRemote($cloudId);
64
+                    } catch (\InvalidArgumentException $e) {
65
+                        continue;
66
+                    }
67 67
 
68
-					$localUser = $this->userManager->get($remoteUser);
69
-					/**
70
-					 * Add local share if remote cloud id matches a local user ones
71
-					 */
72
-					if ($localUser !== null && $remoteUser !== $this->userId && $cloudId === $localUser->getCloudId()) {
73
-						$result['wide'][] = [
74
-							'label' => $contact['FN'],
75
-							'uuid' => $contact['UID'],
76
-							'value' => [
77
-								'shareType' => IShare::TYPE_USER,
78
-								'shareWith' => $remoteUser
79
-							],
80
-							'shareWithDisplayNameUnique' => $contact['EMAIL'] !== null && $contact['EMAIL'] !== '' ? $contact['EMAIL'] : $contact['UID'],
81
-						];
82
-					}
68
+                    $localUser = $this->userManager->get($remoteUser);
69
+                    /**
70
+                     * Add local share if remote cloud id matches a local user ones
71
+                     */
72
+                    if ($localUser !== null && $remoteUser !== $this->userId && $cloudId === $localUser->getCloudId()) {
73
+                        $result['wide'][] = [
74
+                            'label' => $contact['FN'],
75
+                            'uuid' => $contact['UID'],
76
+                            'value' => [
77
+                                'shareType' => IShare::TYPE_USER,
78
+                                'shareWith' => $remoteUser
79
+                            ],
80
+                            'shareWithDisplayNameUnique' => $contact['EMAIL'] !== null && $contact['EMAIL'] !== '' ? $contact['EMAIL'] : $contact['UID'],
81
+                        ];
82
+                    }
83 83
 
84
-					if (strtolower($contact['FN']) === $lowerSearch || strtolower($cloudId) === $lowerSearch) {
85
-						if (strtolower($cloudId) === $lowerSearch) {
86
-							$searchResult->markExactIdMatch($resultType);
87
-						}
88
-						$result['exact'][] = [
89
-							'label' => $contact['FN'] . " ($cloudId)",
90
-							'uuid' => $contact['UID'],
91
-							'name' => $contact['FN'],
92
-							'type' => $cloudIdType,
93
-							'value' => [
94
-								'shareType' => IShare::TYPE_REMOTE,
95
-								'shareWith' => $cloudId,
96
-								'server' => $serverUrl,
97
-							],
98
-						];
99
-					} else {
100
-						$result['wide'][] = [
101
-							'label' => $contact['FN'] . " ($cloudId)",
102
-							'uuid' => $contact['UID'],
103
-							'name' => $contact['FN'],
104
-							'type' => $cloudIdType,
105
-							'value' => [
106
-								'shareType' => IShare::TYPE_REMOTE,
107
-								'shareWith' => $cloudId,
108
-								'server' => $serverUrl,
109
-							],
110
-						];
111
-					}
112
-				}
113
-			}
114
-		}
84
+                    if (strtolower($contact['FN']) === $lowerSearch || strtolower($cloudId) === $lowerSearch) {
85
+                        if (strtolower($cloudId) === $lowerSearch) {
86
+                            $searchResult->markExactIdMatch($resultType);
87
+                        }
88
+                        $result['exact'][] = [
89
+                            'label' => $contact['FN'] . " ($cloudId)",
90
+                            'uuid' => $contact['UID'],
91
+                            'name' => $contact['FN'],
92
+                            'type' => $cloudIdType,
93
+                            'value' => [
94
+                                'shareType' => IShare::TYPE_REMOTE,
95
+                                'shareWith' => $cloudId,
96
+                                'server' => $serverUrl,
97
+                            ],
98
+                        ];
99
+                    } else {
100
+                        $result['wide'][] = [
101
+                            'label' => $contact['FN'] . " ($cloudId)",
102
+                            'uuid' => $contact['UID'],
103
+                            'name' => $contact['FN'],
104
+                            'type' => $cloudIdType,
105
+                            'value' => [
106
+                                'shareType' => IShare::TYPE_REMOTE,
107
+                                'shareWith' => $cloudId,
108
+                                'server' => $serverUrl,
109
+                            ],
110
+                        ];
111
+                    }
112
+                }
113
+            }
114
+        }
115 115
 
116
-		if (!$this->shareeEnumeration) {
117
-			$result['wide'] = [];
118
-		} else {
119
-			$result['wide'] = array_slice($result['wide'], $offset, $limit);
120
-		}
116
+        if (!$this->shareeEnumeration) {
117
+            $result['wide'] = [];
118
+        } else {
119
+            $result['wide'] = array_slice($result['wide'], $offset, $limit);
120
+        }
121 121
 
122
-		/**
123
-		 * Add generic share with remote item for valid cloud ids that are not users of the local instance
124
-		 */
125
-		if (!$searchResult->hasExactIdMatch($resultType) && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {
126
-			try {
127
-				[$remoteUser, $serverUrl] = $this->splitUserRemote($search);
128
-				$localUser = $this->userManager->get($remoteUser);
129
-				if ($localUser === null || $search !== $localUser->getCloudId()) {
130
-					$result['exact'][] = [
131
-						'label' => $remoteUser . " ($serverUrl)",
132
-						'uuid' => $remoteUser,
133
-						'name' => $remoteUser,
134
-						'value' => [
135
-							'shareType' => IShare::TYPE_REMOTE,
136
-							'shareWith' => $search,
137
-							'server' => $serverUrl,
138
-						],
139
-					];
140
-				}
141
-			} catch (\InvalidArgumentException $e) {
142
-			}
143
-		}
122
+        /**
123
+         * Add generic share with remote item for valid cloud ids that are not users of the local instance
124
+         */
125
+        if (!$searchResult->hasExactIdMatch($resultType) && $this->cloudIdManager->isValidCloudId($search) && $offset === 0) {
126
+            try {
127
+                [$remoteUser, $serverUrl] = $this->splitUserRemote($search);
128
+                $localUser = $this->userManager->get($remoteUser);
129
+                if ($localUser === null || $search !== $localUser->getCloudId()) {
130
+                    $result['exact'][] = [
131
+                        'label' => $remoteUser . " ($serverUrl)",
132
+                        'uuid' => $remoteUser,
133
+                        'name' => $remoteUser,
134
+                        'value' => [
135
+                            'shareType' => IShare::TYPE_REMOTE,
136
+                            'shareWith' => $search,
137
+                            'server' => $serverUrl,
138
+                        ],
139
+                    ];
140
+                }
141
+            } catch (\InvalidArgumentException $e) {
142
+            }
143
+        }
144 144
 
145
-		$searchResult->addResultSet($resultType, $result['wide'], $result['exact']);
145
+        $searchResult->addResultSet($resultType, $result['wide'], $result['exact']);
146 146
 
147
-		return true;
148
-	}
147
+        return true;
148
+    }
149 149
 
150
-	/**
151
-	 * split user and remote from federated cloud id
152
-	 *
153
-	 * @param string $address federated share address
154
-	 * @return array [user, remoteURL]
155
-	 * @throws \InvalidArgumentException
156
-	 */
157
-	public function splitUserRemote(string $address): array {
158
-		try {
159
-			$cloudId = $this->cloudIdManager->resolveCloudId($address);
160
-			return [$cloudId->getUser(), $this->cloudIdManager->removeProtocolFromUrl($cloudId->getRemote(), true)];
161
-		} catch (\InvalidArgumentException $e) {
162
-			throw new \InvalidArgumentException('Invalid Federated Cloud ID', 0, $e);
163
-		}
164
-	}
150
+    /**
151
+     * split user and remote from federated cloud id
152
+     *
153
+     * @param string $address federated share address
154
+     * @return array [user, remoteURL]
155
+     * @throws \InvalidArgumentException
156
+     */
157
+    public function splitUserRemote(string $address): array {
158
+        try {
159
+            $cloudId = $this->cloudIdManager->resolveCloudId($address);
160
+            return [$cloudId->getUser(), $this->cloudIdManager->removeProtocolFromUrl($cloudId->getRemote(), true)];
161
+        } catch (\InvalidArgumentException $e) {
162
+            throw new \InvalidArgumentException('Invalid Federated Cloud ID', 0, $e);
163
+        }
164
+    }
165 165
 }
Please login to merge, or discard this patch.
lib/private/Color.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
 namespace OC;
25 25
 
26 26
 class Color {
27
-	public $r;
28
-	public $g;
29
-	public $b;
30
-	public function __construct($r, $g, $b) {
31
-		$this->r = $r;
32
-		$this->g = $g;
33
-		$this->b = $b;
34
-	}
27
+    public $r;
28
+    public $g;
29
+    public $b;
30
+    public function __construct($r, $g, $b) {
31
+        $this->r = $r;
32
+        $this->g = $g;
33
+        $this->b = $b;
34
+    }
35 35
 }
Please login to merge, or discard this patch.
lib/private/Lock/MemcacheLockingProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
 		} elseif ($existing === 'exclusive') {
144 144
 			return $existing;
145 145
 		} else {
146
-			return $existing . ' shared locks';
146
+			return $existing.' shared locks';
147 147
 		}
148 148
 	}
149 149
 }
Please login to merge, or discard this patch.
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -14,168 +14,168 @@
 block discarded – undo
14 14
 use OCP\Lock\LockedException;
15 15
 
16 16
 class MemcacheLockingProvider extends AbstractLockingProvider {
17
-	/** @var array<string, array{time: int, ttl: int}> */
18
-	private array $oldTTLs = [];
19
-
20
-	public function __construct(
21
-		private IMemcache $memcache,
22
-		private ITimeFactory $timeFactory,
23
-		int $ttl = 3600,
24
-	) {
25
-		parent::__construct($ttl);
26
-	}
27
-
28
-	private function setTTL(string $path, ?int $ttl = null, mixed $compare = null): void {
29
-		if (is_null($ttl)) {
30
-			$ttl = $this->ttl;
31
-		}
32
-		if ($this->memcache instanceof IMemcacheTTL) {
33
-			if ($compare !== null) {
34
-				$this->memcache->compareSetTTL($path, $compare, $ttl);
35
-			} else {
36
-				$this->memcache->setTTL($path, $ttl);
37
-			}
38
-		}
39
-	}
40
-
41
-	private function getTTL(string $path): int {
42
-		if ($this->memcache instanceof IMemcacheTTL) {
43
-			$ttl = $this->memcache->getTTL($path);
44
-			return $ttl === false ? -1 : $ttl;
45
-		} else {
46
-			return -1;
47
-		}
48
-	}
49
-
50
-	public function isLocked(string $path, int $type): bool {
51
-		$lockValue = $this->memcache->get($path);
52
-		if ($type === self::LOCK_SHARED) {
53
-			return is_int($lockValue) && $lockValue > 0;
54
-		} elseif ($type === self::LOCK_EXCLUSIVE) {
55
-			return $lockValue === 'exclusive';
56
-		} else {
57
-			return false;
58
-		}
59
-	}
60
-
61
-	public function acquireLock(string $path, int $type, ?string $readablePath = null): void {
62
-		if ($type === self::LOCK_SHARED) {
63
-			// save the old TTL to for `restoreTTL`
64
-			$this->oldTTLs[$path] = [
65
-				'ttl' => $this->getTTL($path),
66
-				'time' => $this->timeFactory->getTime()
67
-			];
68
-			if (!$this->memcache->inc($path)) {
69
-				throw new LockedException($path, null, $this->getExistingLockForException($path), $readablePath);
70
-			}
71
-		} else {
72
-			// when getting exclusive locks, we know there are no old TTLs to restore
73
-			$this->memcache->add($path, 0);
74
-			// ttl is updated automatically when the `set` succeeds
75
-			if (!$this->memcache->cas($path, 0, 'exclusive')) {
76
-				throw new LockedException($path, null, $this->getExistingLockForException($path), $readablePath);
77
-			}
78
-			unset($this->oldTTLs[$path]);
79
-		}
80
-		$this->setTTL($path);
81
-		$this->markAcquire($path, $type);
82
-	}
83
-
84
-	public function releaseLock(string $path, int $type): void {
85
-		if ($type === self::LOCK_SHARED) {
86
-			$ownSharedLockCount = $this->getOwnSharedLockCount($path);
87
-			$newValue = 0;
88
-			if ($ownSharedLockCount === 0) { // if we are not holding the lock, don't try to release it
89
-				return;
90
-			}
91
-			if ($ownSharedLockCount === 1) {
92
-				$removed = $this->memcache->cad($path, 1); // if we're the only one having a shared lock we can remove it in one go
93
-				if (!$removed) { //someone else also has a shared lock, decrease only
94
-					$newValue = $this->memcache->dec($path);
95
-				}
96
-			} else {
97
-				// if we own more than one lock ourselves just decrease
98
-				$newValue = $this->memcache->dec($path);
99
-			}
100
-
101
-			if ($newValue > 0) {
102
-				$this->restoreTTL($path);
103
-			} else {
104
-				unset($this->oldTTLs[$path]);
105
-			}
106
-
107
-			// if we somehow release more locks then exists, reset the lock
108
-			if ($newValue < 0) {
109
-				$this->memcache->cad($path, $newValue);
110
-			}
111
-		} elseif ($type === self::LOCK_EXCLUSIVE) {
112
-			$this->memcache->cad($path, 'exclusive');
113
-		}
114
-		$this->markRelease($path, $type);
115
-	}
116
-
117
-	public function changeLock(string $path, int $targetType): void {
118
-		if ($targetType === self::LOCK_SHARED) {
119
-			if (!$this->memcache->cas($path, 'exclusive', 1)) {
120
-				throw new LockedException($path, null, $this->getExistingLockForException($path));
121
-			}
122
-		} elseif ($targetType === self::LOCK_EXCLUSIVE) {
123
-			// we can only change a shared lock to an exclusive if there's only a single owner of the shared lock
124
-			if (!$this->memcache->cas($path, 1, 'exclusive')) {
125
-				$this->restoreTTL($path);
126
-				throw new LockedException($path, null, $this->getExistingLockForException($path));
127
-			}
128
-			unset($this->oldTTLs[$path]);
129
-		}
130
-		$this->setTTL($path);
131
-		$this->markChange($path, $targetType);
132
-	}
133
-
134
-	/**
135
-	 * With shared locks, each time the lock is acquired, the ttl for the path is reset.
136
-	 *
137
-	 * Due to this "ttl extension" when a shared lock isn't freed correctly for any reason
138
-	 * the lock won't expire until no shared locks are required for the path for 1h.
139
-	 * This can lead to a client repeatedly trying to upload a file, and failing forever
140
-	 * because the lock never gets the opportunity to expire.
141
-	 *
142
-	 * To help the lock expire in this case, we lower the TTL back to what it was before we
143
-	 * took the shared lock *only* if nobody else got a shared lock after we did.
144
-	 *
145
-	 * This doesn't handle all cases where multiple requests are acquiring shared locks
146
-	 * but it should handle some of the more common ones and not hurt things further
147
-	 */
148
-	private function restoreTTL(string $path): void {
149
-		if (isset($this->oldTTLs[$path])) {
150
-			$saved = $this->oldTTLs[$path];
151
-			$elapsed = $this->timeFactory->getTime() - $saved['time'];
152
-
153
-			// old value to compare to when setting ttl in case someone else changes the lock in the middle of this function
154
-			$value = $this->memcache->get($path);
155
-
156
-			$currentTtl = $this->getTTL($path);
157
-
158
-			// what the old ttl would be given the time elapsed since we acquired the lock
159
-			// note that if this gets negative the key will be expired directly when we set the ttl
160
-			$remainingOldTtl = $saved['ttl'] - $elapsed;
161
-			// what the currently ttl would be if nobody else acquired a lock since we did (+1 to cover rounding errors)
162
-			$expectedTtl = $this->ttl - $elapsed + 1;
163
-
164
-			// check if another request has acquired a lock (and didn't release it yet)
165
-			if ($currentTtl <= $expectedTtl) {
166
-				$this->setTTL($path, $remainingOldTtl, $value);
167
-			}
168
-		}
169
-	}
170
-
171
-	private function getExistingLockForException(string $path): string {
172
-		$existing = $this->memcache->get($path);
173
-		if (!$existing) {
174
-			return 'none';
175
-		} elseif ($existing === 'exclusive') {
176
-			return $existing;
177
-		} else {
178
-			return $existing . ' shared locks';
179
-		}
180
-	}
17
+    /** @var array<string, array{time: int, ttl: int}> */
18
+    private array $oldTTLs = [];
19
+
20
+    public function __construct(
21
+        private IMemcache $memcache,
22
+        private ITimeFactory $timeFactory,
23
+        int $ttl = 3600,
24
+    ) {
25
+        parent::__construct($ttl);
26
+    }
27
+
28
+    private function setTTL(string $path, ?int $ttl = null, mixed $compare = null): void {
29
+        if (is_null($ttl)) {
30
+            $ttl = $this->ttl;
31
+        }
32
+        if ($this->memcache instanceof IMemcacheTTL) {
33
+            if ($compare !== null) {
34
+                $this->memcache->compareSetTTL($path, $compare, $ttl);
35
+            } else {
36
+                $this->memcache->setTTL($path, $ttl);
37
+            }
38
+        }
39
+    }
40
+
41
+    private function getTTL(string $path): int {
42
+        if ($this->memcache instanceof IMemcacheTTL) {
43
+            $ttl = $this->memcache->getTTL($path);
44
+            return $ttl === false ? -1 : $ttl;
45
+        } else {
46
+            return -1;
47
+        }
48
+    }
49
+
50
+    public function isLocked(string $path, int $type): bool {
51
+        $lockValue = $this->memcache->get($path);
52
+        if ($type === self::LOCK_SHARED) {
53
+            return is_int($lockValue) && $lockValue > 0;
54
+        } elseif ($type === self::LOCK_EXCLUSIVE) {
55
+            return $lockValue === 'exclusive';
56
+        } else {
57
+            return false;
58
+        }
59
+    }
60
+
61
+    public function acquireLock(string $path, int $type, ?string $readablePath = null): void {
62
+        if ($type === self::LOCK_SHARED) {
63
+            // save the old TTL to for `restoreTTL`
64
+            $this->oldTTLs[$path] = [
65
+                'ttl' => $this->getTTL($path),
66
+                'time' => $this->timeFactory->getTime()
67
+            ];
68
+            if (!$this->memcache->inc($path)) {
69
+                throw new LockedException($path, null, $this->getExistingLockForException($path), $readablePath);
70
+            }
71
+        } else {
72
+            // when getting exclusive locks, we know there are no old TTLs to restore
73
+            $this->memcache->add($path, 0);
74
+            // ttl is updated automatically when the `set` succeeds
75
+            if (!$this->memcache->cas($path, 0, 'exclusive')) {
76
+                throw new LockedException($path, null, $this->getExistingLockForException($path), $readablePath);
77
+            }
78
+            unset($this->oldTTLs[$path]);
79
+        }
80
+        $this->setTTL($path);
81
+        $this->markAcquire($path, $type);
82
+    }
83
+
84
+    public function releaseLock(string $path, int $type): void {
85
+        if ($type === self::LOCK_SHARED) {
86
+            $ownSharedLockCount = $this->getOwnSharedLockCount($path);
87
+            $newValue = 0;
88
+            if ($ownSharedLockCount === 0) { // if we are not holding the lock, don't try to release it
89
+                return;
90
+            }
91
+            if ($ownSharedLockCount === 1) {
92
+                $removed = $this->memcache->cad($path, 1); // if we're the only one having a shared lock we can remove it in one go
93
+                if (!$removed) { //someone else also has a shared lock, decrease only
94
+                    $newValue = $this->memcache->dec($path);
95
+                }
96
+            } else {
97
+                // if we own more than one lock ourselves just decrease
98
+                $newValue = $this->memcache->dec($path);
99
+            }
100
+
101
+            if ($newValue > 0) {
102
+                $this->restoreTTL($path);
103
+            } else {
104
+                unset($this->oldTTLs[$path]);
105
+            }
106
+
107
+            // if we somehow release more locks then exists, reset the lock
108
+            if ($newValue < 0) {
109
+                $this->memcache->cad($path, $newValue);
110
+            }
111
+        } elseif ($type === self::LOCK_EXCLUSIVE) {
112
+            $this->memcache->cad($path, 'exclusive');
113
+        }
114
+        $this->markRelease($path, $type);
115
+    }
116
+
117
+    public function changeLock(string $path, int $targetType): void {
118
+        if ($targetType === self::LOCK_SHARED) {
119
+            if (!$this->memcache->cas($path, 'exclusive', 1)) {
120
+                throw new LockedException($path, null, $this->getExistingLockForException($path));
121
+            }
122
+        } elseif ($targetType === self::LOCK_EXCLUSIVE) {
123
+            // we can only change a shared lock to an exclusive if there's only a single owner of the shared lock
124
+            if (!$this->memcache->cas($path, 1, 'exclusive')) {
125
+                $this->restoreTTL($path);
126
+                throw new LockedException($path, null, $this->getExistingLockForException($path));
127
+            }
128
+            unset($this->oldTTLs[$path]);
129
+        }
130
+        $this->setTTL($path);
131
+        $this->markChange($path, $targetType);
132
+    }
133
+
134
+    /**
135
+     * With shared locks, each time the lock is acquired, the ttl for the path is reset.
136
+     *
137
+     * Due to this "ttl extension" when a shared lock isn't freed correctly for any reason
138
+     * the lock won't expire until no shared locks are required for the path for 1h.
139
+     * This can lead to a client repeatedly trying to upload a file, and failing forever
140
+     * because the lock never gets the opportunity to expire.
141
+     *
142
+     * To help the lock expire in this case, we lower the TTL back to what it was before we
143
+     * took the shared lock *only* if nobody else got a shared lock after we did.
144
+     *
145
+     * This doesn't handle all cases where multiple requests are acquiring shared locks
146
+     * but it should handle some of the more common ones and not hurt things further
147
+     */
148
+    private function restoreTTL(string $path): void {
149
+        if (isset($this->oldTTLs[$path])) {
150
+            $saved = $this->oldTTLs[$path];
151
+            $elapsed = $this->timeFactory->getTime() - $saved['time'];
152
+
153
+            // old value to compare to when setting ttl in case someone else changes the lock in the middle of this function
154
+            $value = $this->memcache->get($path);
155
+
156
+            $currentTtl = $this->getTTL($path);
157
+
158
+            // what the old ttl would be given the time elapsed since we acquired the lock
159
+            // note that if this gets negative the key will be expired directly when we set the ttl
160
+            $remainingOldTtl = $saved['ttl'] - $elapsed;
161
+            // what the currently ttl would be if nobody else acquired a lock since we did (+1 to cover rounding errors)
162
+            $expectedTtl = $this->ttl - $elapsed + 1;
163
+
164
+            // check if another request has acquired a lock (and didn't release it yet)
165
+            if ($currentTtl <= $expectedTtl) {
166
+                $this->setTTL($path, $remainingOldTtl, $value);
167
+            }
168
+        }
169
+    }
170
+
171
+    private function getExistingLockForException(string $path): string {
172
+        $existing = $this->memcache->get($path);
173
+        if (!$existing) {
174
+            return 'none';
175
+        } elseif ($existing === 'exclusive') {
176
+            return $existing;
177
+        } else {
178
+            return $existing . ' shared locks';
179
+        }
180
+    }
181 181
 }
Please login to merge, or discard this patch.
lib/public/Collaboration/Collaborators/SearchResultType.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	 * @since 13.0.0
60 60
 	 */
61 61
 	protected function getValidatedType($type) {
62
-		$type = trim((string)$type);
62
+		$type = trim((string) $type);
63 63
 
64 64
 		if ($type === '') {
65 65
 			throw new \InvalidArgumentException('Type must not be empty');
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,44 +12,44 @@
 block discarded – undo
12 12
  * @since 13.0.0
13 13
  */
14 14
 class SearchResultType {
15
-	/** @var string */
16
-	protected $label;
17
-
18
-	/**
19
-	 * SearchResultType constructor.
20
-	 *
21
-	 * @param string $label
22
-	 * @since 13.0.0
23
-	 */
24
-	public function __construct($label) {
25
-		$this->label = $this->getValidatedType($label);
26
-	}
27
-
28
-	/**
29
-	 * @return string
30
-	 * @since 13.0.0
31
-	 */
32
-	public function getLabel() {
33
-		return $this->label;
34
-	}
35
-
36
-	/**
37
-	 * @param $type
38
-	 * @return string
39
-	 * @throws \InvalidArgumentException
40
-	 * @since 13.0.0
41
-	 */
42
-	protected function getValidatedType($type) {
43
-		$type = trim((string)$type);
44
-
45
-		if ($type === '') {
46
-			throw new \InvalidArgumentException('Type must not be empty');
47
-		}
48
-
49
-		if ($type === 'exact') {
50
-			throw new \InvalidArgumentException('Provided type is a reserved word');
51
-		}
52
-
53
-		return $type;
54
-	}
15
+    /** @var string */
16
+    protected $label;
17
+
18
+    /**
19
+     * SearchResultType constructor.
20
+     *
21
+     * @param string $label
22
+     * @since 13.0.0
23
+     */
24
+    public function __construct($label) {
25
+        $this->label = $this->getValidatedType($label);
26
+    }
27
+
28
+    /**
29
+     * @return string
30
+     * @since 13.0.0
31
+     */
32
+    public function getLabel() {
33
+        return $this->label;
34
+    }
35
+
36
+    /**
37
+     * @param $type
38
+     * @return string
39
+     * @throws \InvalidArgumentException
40
+     * @since 13.0.0
41
+     */
42
+    protected function getValidatedType($type) {
43
+        $type = trim((string)$type);
44
+
45
+        if ($type === '') {
46
+            throw new \InvalidArgumentException('Type must not be empty');
47
+        }
48
+
49
+        if ($type === 'exact') {
50
+            throw new \InvalidArgumentException('Provided type is a reserved word');
51
+        }
52
+
53
+        return $type;
54
+    }
55 55
 }
Please login to merge, or discard this patch.
lib/private/IntegrityCheck/Helpers/FileAccessHelper.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -34,57 +34,57 @@
 block discarded – undo
34 34
  * @package OC\IntegrityCheck\Helpers
35 35
  */
36 36
 class FileAccessHelper {
37
-	/**
38
-	 * Wrapper around file_get_contents($filename, $data)
39
-	 *
40
-	 * @param string $filename
41
-	 * @return string|false
42
-	 */
43
-	public function file_get_contents(string $filename) {
44
-		return file_get_contents($filename);
45
-	}
37
+    /**
38
+     * Wrapper around file_get_contents($filename, $data)
39
+     *
40
+     * @param string $filename
41
+     * @return string|false
42
+     */
43
+    public function file_get_contents(string $filename) {
44
+        return file_get_contents($filename);
45
+    }
46 46
 
47
-	/**
48
-	 * Wrapper around file_exists($filename)
49
-	 *
50
-	 * @param string $filename
51
-	 * @return bool
52
-	 */
53
-	public function file_exists(string $filename): bool {
54
-		return file_exists($filename);
55
-	}
47
+    /**
48
+     * Wrapper around file_exists($filename)
49
+     *
50
+     * @param string $filename
51
+     * @return bool
52
+     */
53
+    public function file_exists(string $filename): bool {
54
+        return file_exists($filename);
55
+    }
56 56
 
57
-	/**
58
-	 * Wrapper around file_put_contents($filename, $data)
59
-	 *
60
-	 * @param string $filename
61
-	 * @param string $data
62
-	 * @return int
63
-	 * @throws \Exception
64
-	 */
65
-	public function file_put_contents(string $filename, string $data): int {
66
-		$bytesWritten = @file_put_contents($filename, $data);
67
-		if ($bytesWritten === false || $bytesWritten !== \strlen($data)) {
68
-			throw new \Exception('Failed to write into ' . $filename);
69
-		}
70
-		return $bytesWritten;
71
-	}
57
+    /**
58
+     * Wrapper around file_put_contents($filename, $data)
59
+     *
60
+     * @param string $filename
61
+     * @param string $data
62
+     * @return int
63
+     * @throws \Exception
64
+     */
65
+    public function file_put_contents(string $filename, string $data): int {
66
+        $bytesWritten = @file_put_contents($filename, $data);
67
+        if ($bytesWritten === false || $bytesWritten !== \strlen($data)) {
68
+            throw new \Exception('Failed to write into ' . $filename);
69
+        }
70
+        return $bytesWritten;
71
+    }
72 72
 
73
-	/**
74
-	 * @param string $path
75
-	 * @return bool
76
-	 */
77
-	public function is_writable(string $path): bool {
78
-		return is_writable($path);
79
-	}
73
+    /**
74
+     * @param string $path
75
+     * @return bool
76
+     */
77
+    public function is_writable(string $path): bool {
78
+        return is_writable($path);
79
+    }
80 80
 
81
-	/**
82
-	 * @param string $path
83
-	 * @throws \Exception
84
-	 */
85
-	public function assertDirectoryExists(string $path) {
86
-		if (!is_dir($path)) {
87
-			throw new \Exception('Directory ' . $path . ' does not exist.');
88
-		}
89
-	}
81
+    /**
82
+     * @param string $path
83
+     * @throws \Exception
84
+     */
85
+    public function assertDirectoryExists(string $path) {
86
+        if (!is_dir($path)) {
87
+            throw new \Exception('Directory ' . $path . ' does not exist.');
88
+        }
89
+    }
90 90
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	public function file_put_contents(string $filename, string $data): int {
66 66
 		$bytesWritten = @file_put_contents($filename, $data);
67 67
 		if ($bytesWritten === false || $bytesWritten !== \strlen($data)) {
68
-			throw new \Exception('Failed to write into ' . $filename);
68
+			throw new \Exception('Failed to write into '.$filename);
69 69
 		}
70 70
 		return $bytesWritten;
71 71
 	}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function assertDirectoryExists(string $path) {
86 86
 		if (!is_dir($path)) {
87
-			throw new \Exception('Directory ' . $path . ' does not exist.');
87
+			throw new \Exception('Directory '.$path.' does not exist.');
88 88
 		}
89 89
 	}
90 90
 }
Please login to merge, or discard this patch.
lib/private/Encryption/DecryptAll.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		$this->output = $output;
88 88
 
89 89
 		if ($user !== '' && $this->userManager->userExists($user) === false) {
90
-			$this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again');
90
+			$this->output->writeln('User "'.$user.'" does not exist. Please check the username and try again');
91 91
 			return false;
92 92
 		}
93 93
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 			$this->output->writeln('Files for following users couldn\'t be decrypted, ');
106 106
 			$this->output->writeln('maybe the user is not set up in a way that supports this operation: ');
107 107
 			foreach ($this->failed as $uid => $paths) {
108
-				$this->output->writeln('    ' . $uid);
108
+				$this->output->writeln('    '.$uid);
109 109
 				foreach ($paths as $path) {
110
-					$this->output->writeln('        ' . $path);
110
+					$this->output->writeln('        '.$path);
111 111
 				}
112 112
 			}
113 113
 			$this->output->writeln('');
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 			/** @var IEncryptionModule $module */
130 130
 			$module = call_user_func($moduleDesc['callback']);
131 131
 			$this->output->writeln('');
132
-			$this->output->writeln('Prepare "' . $module->getDisplayName() . '"');
132
+			$this->output->writeln('Prepare "'.$module->getDisplayName().'"');
133 133
 			$this->output->writeln('');
134 134
 			if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) {
135
-				$this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!');
135
+				$this->output->writeln('Module "'.$moduleDesc['displayName'].'" does not support the functionality to decrypt all files again or the initialization of the module failed!');
136 136
 				return false;
137 137
 			}
138 138
 		}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
207 207
 		$this->setupUserFS($uid);
208 208
 		$directories = [];
209
-		$directories[] = '/' . $uid . '/files';
209
+		$directories[] = '/'.$uid.'/files';
210 210
 
211 211
 		while ($root = array_pop($directories)) {
212 212
 			$content = $this->rootView->getDirectoryContent($root);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) {
216 216
 					continue;
217 217
 				}
218
-				$path = $root . '/' . $file['name'];
218
+				$path = $root.'/'.$file['name'];
219 219
 				if ($this->rootView->is_dir($path)) {
220 220
 					$directories[] = $path;
221 221
 					continue;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		}
260 260
 
261 261
 		$source = $path;
262
-		$target = $path . '.decrypted.' . $this->getTimestamp();
262
+		$target = $path.'.decrypted.'.$this->getTimestamp();
263 263
 
264 264
 		try {
265 265
 			$this->rootView->copy($source, $target);
Please login to merge, or discard this patch.
Indentation   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -17,241 +17,241 @@
 block discarded – undo
17 17
 use Symfony\Component\Console\Output\OutputInterface;
18 18
 
19 19
 class DecryptAll {
20
-	/** @var OutputInterface */
21
-	protected $output;
20
+    /** @var OutputInterface */
21
+    protected $output;
22 22
 
23
-	/** @var InputInterface */
24
-	protected $input;
23
+    /** @var InputInterface */
24
+    protected $input;
25 25
 
26
-	/** @var array files which couldn't be decrypted */
27
-	protected $failed;
26
+    /** @var array files which couldn't be decrypted */
27
+    protected $failed;
28 28
 
29
-	public function __construct(
30
-		protected IManager $encryptionManager,
31
-		protected IUserManager $userManager,
32
-		protected View $rootView,
33
-	) {
34
-		$this->failed = [];
35
-	}
29
+    public function __construct(
30
+        protected IManager $encryptionManager,
31
+        protected IUserManager $userManager,
32
+        protected View $rootView,
33
+    ) {
34
+        $this->failed = [];
35
+    }
36 36
 
37
-	/**
38
-	 * start to decrypt all files
39
-	 *
40
-	 * @param InputInterface $input
41
-	 * @param OutputInterface $output
42
-	 * @param string $user which users data folder should be decrypted, default = all users
43
-	 * @return bool
44
-	 * @throws \Exception
45
-	 */
46
-	public function decryptAll(InputInterface $input, OutputInterface $output, $user = '') {
47
-		$this->input = $input;
48
-		$this->output = $output;
37
+    /**
38
+     * start to decrypt all files
39
+     *
40
+     * @param InputInterface $input
41
+     * @param OutputInterface $output
42
+     * @param string $user which users data folder should be decrypted, default = all users
43
+     * @return bool
44
+     * @throws \Exception
45
+     */
46
+    public function decryptAll(InputInterface $input, OutputInterface $output, $user = '') {
47
+        $this->input = $input;
48
+        $this->output = $output;
49 49
 
50
-		if ($user !== '' && $this->userManager->userExists($user) === false) {
51
-			$this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again');
52
-			return false;
53
-		}
50
+        if ($user !== '' && $this->userManager->userExists($user) === false) {
51
+            $this->output->writeln('User "' . $user . '" does not exist. Please check the username and try again');
52
+            return false;
53
+        }
54 54
 
55
-		$this->output->writeln('prepare encryption modules...');
56
-		if ($this->prepareEncryptionModules($user) === false) {
57
-			return false;
58
-		}
59
-		$this->output->writeln(' done.');
55
+        $this->output->writeln('prepare encryption modules...');
56
+        if ($this->prepareEncryptionModules($user) === false) {
57
+            return false;
58
+        }
59
+        $this->output->writeln(' done.');
60 60
 
61
-		$this->decryptAllUsersFiles($user);
61
+        $this->decryptAllUsersFiles($user);
62 62
 
63
-		if (empty($this->failed)) {
64
-			$this->output->writeln('all files could be decrypted successfully!');
65
-		} else {
66
-			$this->output->writeln('Files for following users couldn\'t be decrypted, ');
67
-			$this->output->writeln('maybe the user is not set up in a way that supports this operation: ');
68
-			foreach ($this->failed as $uid => $paths) {
69
-				$this->output->writeln('    ' . $uid);
70
-				foreach ($paths as $path) {
71
-					$this->output->writeln('        ' . $path);
72
-				}
73
-			}
74
-			$this->output->writeln('');
75
-		}
63
+        if (empty($this->failed)) {
64
+            $this->output->writeln('all files could be decrypted successfully!');
65
+        } else {
66
+            $this->output->writeln('Files for following users couldn\'t be decrypted, ');
67
+            $this->output->writeln('maybe the user is not set up in a way that supports this operation: ');
68
+            foreach ($this->failed as $uid => $paths) {
69
+                $this->output->writeln('    ' . $uid);
70
+                foreach ($paths as $path) {
71
+                    $this->output->writeln('        ' . $path);
72
+                }
73
+            }
74
+            $this->output->writeln('');
75
+        }
76 76
 
77
-		return true;
78
-	}
77
+        return true;
78
+    }
79 79
 
80
-	/**
81
-	 * prepare encryption modules to perform the decrypt all function
82
-	 *
83
-	 * @param $user
84
-	 * @return bool
85
-	 */
86
-	protected function prepareEncryptionModules($user) {
87
-		// prepare all encryption modules for decrypt all
88
-		$encryptionModules = $this->encryptionManager->getEncryptionModules();
89
-		foreach ($encryptionModules as $moduleDesc) {
90
-			/** @var IEncryptionModule $module */
91
-			$module = call_user_func($moduleDesc['callback']);
92
-			$this->output->writeln('');
93
-			$this->output->writeln('Prepare "' . $module->getDisplayName() . '"');
94
-			$this->output->writeln('');
95
-			if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) {
96
-				$this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!');
97
-				return false;
98
-			}
99
-		}
80
+    /**
81
+     * prepare encryption modules to perform the decrypt all function
82
+     *
83
+     * @param $user
84
+     * @return bool
85
+     */
86
+    protected function prepareEncryptionModules($user) {
87
+        // prepare all encryption modules for decrypt all
88
+        $encryptionModules = $this->encryptionManager->getEncryptionModules();
89
+        foreach ($encryptionModules as $moduleDesc) {
90
+            /** @var IEncryptionModule $module */
91
+            $module = call_user_func($moduleDesc['callback']);
92
+            $this->output->writeln('');
93
+            $this->output->writeln('Prepare "' . $module->getDisplayName() . '"');
94
+            $this->output->writeln('');
95
+            if ($module->prepareDecryptAll($this->input, $this->output, $user) === false) {
96
+                $this->output->writeln('Module "' . $moduleDesc['displayName'] . '" does not support the functionality to decrypt all files again or the initialization of the module failed!');
97
+                return false;
98
+            }
99
+        }
100 100
 
101
-		return true;
102
-	}
101
+        return true;
102
+    }
103 103
 
104
-	/**
105
-	 * iterate over all user and encrypt their files
106
-	 *
107
-	 * @param string $user which users files should be decrypted, default = all users
108
-	 */
109
-	protected function decryptAllUsersFiles($user = '') {
110
-		$this->output->writeln("\n");
104
+    /**
105
+     * iterate over all user and encrypt their files
106
+     *
107
+     * @param string $user which users files should be decrypted, default = all users
108
+     */
109
+    protected function decryptAllUsersFiles($user = '') {
110
+        $this->output->writeln("\n");
111 111
 
112
-		$userList = [];
113
-		if ($user === '') {
114
-			$fetchUsersProgress = new ProgressBar($this->output);
115
-			$fetchUsersProgress->setFormat(" %message% \n [%bar%]");
116
-			$fetchUsersProgress->start();
117
-			$fetchUsersProgress->setMessage('Fetch list of users...');
118
-			$fetchUsersProgress->advance();
112
+        $userList = [];
113
+        if ($user === '') {
114
+            $fetchUsersProgress = new ProgressBar($this->output);
115
+            $fetchUsersProgress->setFormat(" %message% \n [%bar%]");
116
+            $fetchUsersProgress->start();
117
+            $fetchUsersProgress->setMessage('Fetch list of users...');
118
+            $fetchUsersProgress->advance();
119 119
 
120
-			foreach ($this->userManager->getBackends() as $backend) {
121
-				$limit = 500;
122
-				$offset = 0;
123
-				do {
124
-					$users = $backend->getUsers('', $limit, $offset);
125
-					foreach ($users as $user) {
126
-						$userList[] = $user;
127
-					}
128
-					$offset += $limit;
129
-					$fetchUsersProgress->advance();
130
-				} while (count($users) >= $limit);
131
-				$fetchUsersProgress->setMessage('Fetch list of users... finished');
132
-				$fetchUsersProgress->finish();
133
-			}
134
-		} else {
135
-			$userList[] = $user;
136
-		}
120
+            foreach ($this->userManager->getBackends() as $backend) {
121
+                $limit = 500;
122
+                $offset = 0;
123
+                do {
124
+                    $users = $backend->getUsers('', $limit, $offset);
125
+                    foreach ($users as $user) {
126
+                        $userList[] = $user;
127
+                    }
128
+                    $offset += $limit;
129
+                    $fetchUsersProgress->advance();
130
+                } while (count($users) >= $limit);
131
+                $fetchUsersProgress->setMessage('Fetch list of users... finished');
132
+                $fetchUsersProgress->finish();
133
+            }
134
+        } else {
135
+            $userList[] = $user;
136
+        }
137 137
 
138
-		$this->output->writeln("\n\n");
138
+        $this->output->writeln("\n\n");
139 139
 
140
-		$progress = new ProgressBar($this->output);
141
-		$progress->setFormat(" %message% \n [%bar%]");
142
-		$progress->start();
143
-		$progress->setMessage('starting to decrypt files...');
144
-		$progress->advance();
140
+        $progress = new ProgressBar($this->output);
141
+        $progress->setFormat(" %message% \n [%bar%]");
142
+        $progress->start();
143
+        $progress->setMessage('starting to decrypt files...');
144
+        $progress->advance();
145 145
 
146
-		$numberOfUsers = count($userList);
147
-		$userNo = 1;
148
-		foreach ($userList as $uid) {
149
-			$userCount = "$uid ($userNo of $numberOfUsers)";
150
-			$this->decryptUsersFiles($uid, $progress, $userCount);
151
-			$userNo++;
152
-		}
146
+        $numberOfUsers = count($userList);
147
+        $userNo = 1;
148
+        foreach ($userList as $uid) {
149
+            $userCount = "$uid ($userNo of $numberOfUsers)";
150
+            $this->decryptUsersFiles($uid, $progress, $userCount);
151
+            $userNo++;
152
+        }
153 153
 
154
-		$progress->setMessage('starting to decrypt files... finished');
155
-		$progress->finish();
154
+        $progress->setMessage('starting to decrypt files... finished');
155
+        $progress->finish();
156 156
 
157
-		$this->output->writeln("\n\n");
158
-	}
157
+        $this->output->writeln("\n\n");
158
+    }
159 159
 
160
-	/**
161
-	 * encrypt files from the given user
162
-	 *
163
-	 * @param string $uid
164
-	 * @param ProgressBar $progress
165
-	 * @param string $userCount
166
-	 */
167
-	protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
168
-		$this->setupUserFS($uid);
169
-		$directories = [];
170
-		$directories[] = '/' . $uid . '/files';
160
+    /**
161
+     * encrypt files from the given user
162
+     *
163
+     * @param string $uid
164
+     * @param ProgressBar $progress
165
+     * @param string $userCount
166
+     */
167
+    protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
168
+        $this->setupUserFS($uid);
169
+        $directories = [];
170
+        $directories[] = '/' . $uid . '/files';
171 171
 
172
-		while ($root = array_pop($directories)) {
173
-			$content = $this->rootView->getDirectoryContent($root);
174
-			foreach ($content as $file) {
175
-				// only decrypt files owned by the user
176
-				if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) {
177
-					continue;
178
-				}
179
-				$path = $root . '/' . $file['name'];
180
-				if ($this->rootView->is_dir($path)) {
181
-					$directories[] = $path;
182
-					continue;
183
-				} else {
184
-					try {
185
-						$progress->setMessage("decrypt files for user $userCount: $path");
186
-						$progress->advance();
187
-						if ($file->isEncrypted() === false) {
188
-							$progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
189
-							$progress->advance();
190
-						} else {
191
-							if ($this->decryptFile($path) === false) {
192
-								$progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
193
-								$progress->advance();
194
-							}
195
-						}
196
-					} catch (\Exception $e) {
197
-						if (isset($this->failed[$uid])) {
198
-							$this->failed[$uid][] = $path;
199
-						} else {
200
-							$this->failed[$uid] = [$path];
201
-						}
202
-					}
203
-				}
204
-			}
205
-		}
206
-	}
172
+        while ($root = array_pop($directories)) {
173
+            $content = $this->rootView->getDirectoryContent($root);
174
+            foreach ($content as $file) {
175
+                // only decrypt files owned by the user
176
+                if ($file->getStorage()->instanceOfStorage('OCA\Files_Sharing\SharedStorage')) {
177
+                    continue;
178
+                }
179
+                $path = $root . '/' . $file['name'];
180
+                if ($this->rootView->is_dir($path)) {
181
+                    $directories[] = $path;
182
+                    continue;
183
+                } else {
184
+                    try {
185
+                        $progress->setMessage("decrypt files for user $userCount: $path");
186
+                        $progress->advance();
187
+                        if ($file->isEncrypted() === false) {
188
+                            $progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
189
+                            $progress->advance();
190
+                        } else {
191
+                            if ($this->decryptFile($path) === false) {
192
+                                $progress->setMessage("decrypt files for user $userCount: $path (already decrypted)");
193
+                                $progress->advance();
194
+                            }
195
+                        }
196
+                    } catch (\Exception $e) {
197
+                        if (isset($this->failed[$uid])) {
198
+                            $this->failed[$uid][] = $path;
199
+                        } else {
200
+                            $this->failed[$uid] = [$path];
201
+                        }
202
+                    }
203
+                }
204
+            }
205
+        }
206
+    }
207 207
 
208
-	/**
209
-	 * encrypt file
210
-	 *
211
-	 * @param string $path
212
-	 * @return bool
213
-	 */
214
-	protected function decryptFile($path) {
215
-		// skip already decrypted files
216
-		$fileInfo = $this->rootView->getFileInfo($path);
217
-		if ($fileInfo !== false && !$fileInfo->isEncrypted()) {
218
-			return true;
219
-		}
208
+    /**
209
+     * encrypt file
210
+     *
211
+     * @param string $path
212
+     * @return bool
213
+     */
214
+    protected function decryptFile($path) {
215
+        // skip already decrypted files
216
+        $fileInfo = $this->rootView->getFileInfo($path);
217
+        if ($fileInfo !== false && !$fileInfo->isEncrypted()) {
218
+            return true;
219
+        }
220 220
 
221
-		$source = $path;
222
-		$target = $path . '.decrypted.' . $this->getTimestamp();
221
+        $source = $path;
222
+        $target = $path . '.decrypted.' . $this->getTimestamp();
223 223
 
224
-		try {
225
-			$this->rootView->copy($source, $target);
226
-			$this->rootView->touch($target, $fileInfo->getMTime());
227
-			$this->rootView->rename($target, $source);
228
-		} catch (DecryptionFailedException $e) {
229
-			if ($this->rootView->file_exists($target)) {
230
-				$this->rootView->unlink($target);
231
-			}
232
-			return false;
233
-		}
224
+        try {
225
+            $this->rootView->copy($source, $target);
226
+            $this->rootView->touch($target, $fileInfo->getMTime());
227
+            $this->rootView->rename($target, $source);
228
+        } catch (DecryptionFailedException $e) {
229
+            if ($this->rootView->file_exists($target)) {
230
+                $this->rootView->unlink($target);
231
+            }
232
+            return false;
233
+        }
234 234
 
235
-		return true;
236
-	}
235
+        return true;
236
+    }
237 237
 
238
-	/**
239
-	 * get current timestamp
240
-	 *
241
-	 * @return int
242
-	 */
243
-	protected function getTimestamp() {
244
-		return time();
245
-	}
238
+    /**
239
+     * get current timestamp
240
+     *
241
+     * @return int
242
+     */
243
+    protected function getTimestamp() {
244
+        return time();
245
+    }
246 246
 
247 247
 
248
-	/**
249
-	 * setup user file system
250
-	 *
251
-	 * @param string $uid
252
-	 */
253
-	protected function setupUserFS($uid) {
254
-		\OC_Util::tearDownFS();
255
-		\OC_Util::setupFS($uid);
256
-	}
248
+    /**
249
+     * setup user file system
250
+     *
251
+     * @param string $uid
252
+     */
253
+    protected function setupUserFS($uid) {
254
+        \OC_Util::tearDownFS();
255
+        \OC_Util::setupFS($uid);
256
+    }
257 257
 }
Please login to merge, or discard this patch.