Passed
Push — master ( 138f47...88fcc0 )
by Blizzz
10:57 queued 11s
created
lib/private/Repair/RepairInvalidShares.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 		$updatedEntries = $builder->execute();
73 73
 		if ($updatedEntries > 0) {
74
-			$out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
+			$out->info('Fixed file share permissions for '.$updatedEntries.' shares');
75 75
 		}
76 76
 	}
77 77
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		}
108 108
 
109 109
 		if ($deletedEntries) {
110
-			$out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
+			$out->info('Removed '.$deletedEntries.' shares where the parent did not exist');
111 111
 		}
112 112
 	}
113 113
 
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -32,90 +32,90 @@
 block discarded – undo
32 32
  * Repairs shares with invalid data
33 33
  */
34 34
 class RepairInvalidShares implements IRepairStep {
35
-	public const CHUNK_SIZE = 200;
36
-
37
-	/** @var \OCP\IConfig */
38
-	protected $config;
39
-
40
-	/** @var \OCP\IDBConnection */
41
-	protected $connection;
42
-
43
-	/**
44
-	 * @param \OCP\IConfig $config
45
-	 * @param \OCP\IDBConnection $connection
46
-	 */
47
-	public function __construct($config, $connection) {
48
-		$this->connection = $connection;
49
-		$this->config = $config;
50
-	}
51
-
52
-	public function getName() {
53
-		return 'Repair invalid shares';
54
-	}
55
-
56
-	/**
57
-	 * Adjust file share permissions
58
-	 * @suppress SqlInjectionChecker
59
-	 */
60
-	private function adjustFileSharePermissions(IOutput $out) {
61
-		$mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
62
-		$builder = $this->connection->getQueryBuilder();
63
-
64
-		$permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask);
65
-		$builder
66
-			->update('share')
67
-			->set('permissions', $permsFunc)
68
-			->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
69
-			->andWhere($builder->expr()->neq('permissions', $permsFunc));
70
-
71
-		$updatedEntries = $builder->execute();
72
-		if ($updatedEntries > 0) {
73
-			$out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
-		}
75
-	}
76
-
77
-	/**
78
-	 * Remove shares where the parent share does not exist anymore
79
-	 */
80
-	private function removeSharesNonExistingParent(IOutput $out) {
81
-		$deletedEntries = 0;
82
-
83
-		$query = $this->connection->getQueryBuilder();
84
-		$query->select('s1.parent')
85
-			->from('share', 's1')
86
-			->where($query->expr()->isNotNull('s1.parent'))
87
-				->andWhere($query->expr()->isNull('s2.id'))
88
-			->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'))
89
-			->groupBy('s1.parent')
90
-			->setMaxResults(self::CHUNK_SIZE);
91
-
92
-		$deleteQuery = $this->connection->getQueryBuilder();
93
-		$deleteQuery->delete('share')
94
-			->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent')));
95
-
96
-		$deletedInLastChunk = self::CHUNK_SIZE;
97
-		while ($deletedInLastChunk === self::CHUNK_SIZE) {
98
-			$deletedInLastChunk = 0;
99
-			$result = $query->execute();
100
-			while ($row = $result->fetch()) {
101
-				$deletedInLastChunk++;
102
-				$deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent'])
103
-					->execute();
104
-			}
105
-			$result->closeCursor();
106
-		}
107
-
108
-		if ($deletedEntries) {
109
-			$out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
-		}
111
-	}
112
-
113
-	public function run(IOutput $out) {
114
-		$ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
115
-		if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
116
-			$this->adjustFileSharePermissions($out);
117
-		}
118
-
119
-		$this->removeSharesNonExistingParent($out);
120
-	}
35
+    public const CHUNK_SIZE = 200;
36
+
37
+    /** @var \OCP\IConfig */
38
+    protected $config;
39
+
40
+    /** @var \OCP\IDBConnection */
41
+    protected $connection;
42
+
43
+    /**
44
+     * @param \OCP\IConfig $config
45
+     * @param \OCP\IDBConnection $connection
46
+     */
47
+    public function __construct($config, $connection) {
48
+        $this->connection = $connection;
49
+        $this->config = $config;
50
+    }
51
+
52
+    public function getName() {
53
+        return 'Repair invalid shares';
54
+    }
55
+
56
+    /**
57
+     * Adjust file share permissions
58
+     * @suppress SqlInjectionChecker
59
+     */
60
+    private function adjustFileSharePermissions(IOutput $out) {
61
+        $mask = \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE;
62
+        $builder = $this->connection->getQueryBuilder();
63
+
64
+        $permsFunc = $builder->expr()->bitwiseAnd('permissions', $mask);
65
+        $builder
66
+            ->update('share')
67
+            ->set('permissions', $permsFunc)
68
+            ->where($builder->expr()->eq('item_type', $builder->expr()->literal('file')))
69
+            ->andWhere($builder->expr()->neq('permissions', $permsFunc));
70
+
71
+        $updatedEntries = $builder->execute();
72
+        if ($updatedEntries > 0) {
73
+            $out->info('Fixed file share permissions for ' . $updatedEntries . ' shares');
74
+        }
75
+    }
76
+
77
+    /**
78
+     * Remove shares where the parent share does not exist anymore
79
+     */
80
+    private function removeSharesNonExistingParent(IOutput $out) {
81
+        $deletedEntries = 0;
82
+
83
+        $query = $this->connection->getQueryBuilder();
84
+        $query->select('s1.parent')
85
+            ->from('share', 's1')
86
+            ->where($query->expr()->isNotNull('s1.parent'))
87
+                ->andWhere($query->expr()->isNull('s2.id'))
88
+            ->leftJoin('s1', 'share', 's2', $query->expr()->eq('s1.parent', 's2.id'))
89
+            ->groupBy('s1.parent')
90
+            ->setMaxResults(self::CHUNK_SIZE);
91
+
92
+        $deleteQuery = $this->connection->getQueryBuilder();
93
+        $deleteQuery->delete('share')
94
+            ->where($deleteQuery->expr()->eq('parent', $deleteQuery->createParameter('parent')));
95
+
96
+        $deletedInLastChunk = self::CHUNK_SIZE;
97
+        while ($deletedInLastChunk === self::CHUNK_SIZE) {
98
+            $deletedInLastChunk = 0;
99
+            $result = $query->execute();
100
+            while ($row = $result->fetch()) {
101
+                $deletedInLastChunk++;
102
+                $deletedEntries += $deleteQuery->setParameter('parent', (int) $row['parent'])
103
+                    ->execute();
104
+            }
105
+            $result->closeCursor();
106
+        }
107
+
108
+        if ($deletedEntries) {
109
+            $out->info('Removed ' . $deletedEntries . ' shares where the parent did not exist');
110
+        }
111
+    }
112
+
113
+    public function run(IOutput $out) {
114
+        $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
115
+        if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.11', '<')) {
116
+            $this->adjustFileSharePermissions($out);
117
+        }
118
+
119
+        $this->removeSharesNonExistingParent($out);
120
+    }
121 121
 }
Please login to merge, or discard this patch.
apps/federatedfilesharing/appinfo/routes.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@
 block discarded – undo
23 23
  */
24 24
 
25 25
 return [
26
-	'routes' => [
27
-		['name' => 'MountPublicLink#createFederatedShare', 'url' => '/createFederatedShare', 'verb' => 'POST'],
28
-		['name' => 'MountPublicLink#askForFederatedShare', 'url' => '/askForFederatedShare', 'verb' => 'POST'],
29
-	],
30
-	'ocs' => [
31
-		['root' => '/cloud', 'name' => 'RequestHandler#createShare', 'url' => '/shares', 'verb' => 'POST'],
32
-		['root' => '/cloud', 'name' => 'RequestHandler#reShare', 'url' => '/shares/{id}/reshare', 'verb' => 'POST'],
33
-		['root' => '/cloud', 'name' => 'RequestHandler#updatePermissions', 'url' => '/shares/{id}/permissions', 'verb' => 'POST'],
34
-		['root' => '/cloud', 'name' => 'RequestHandler#acceptShare', 'url' => '/shares/{id}/accept', 'verb' => 'POST'],
35
-		['root' => '/cloud', 'name' => 'RequestHandler#declineShare', 'url' => '/shares/{id}/decline', 'verb' => 'POST'],
36
-		['root' => '/cloud', 'name' => 'RequestHandler#unshare', 'url' => '/shares/{id}/unshare', 'verb' => 'POST'],
37
-		['root' => '/cloud', 'name' => 'RequestHandler#revoke', 'url' => '/shares/{id}/revoke', 'verb' => 'POST'],
38
-		['root' => '/cloud', 'name' => 'RequestHandler#move', 'url' => '/shares/{id}/move', 'verb' => 'POST'],
39
-	],
26
+    'routes' => [
27
+        ['name' => 'MountPublicLink#createFederatedShare', 'url' => '/createFederatedShare', 'verb' => 'POST'],
28
+        ['name' => 'MountPublicLink#askForFederatedShare', 'url' => '/askForFederatedShare', 'verb' => 'POST'],
29
+    ],
30
+    'ocs' => [
31
+        ['root' => '/cloud', 'name' => 'RequestHandler#createShare', 'url' => '/shares', 'verb' => 'POST'],
32
+        ['root' => '/cloud', 'name' => 'RequestHandler#reShare', 'url' => '/shares/{id}/reshare', 'verb' => 'POST'],
33
+        ['root' => '/cloud', 'name' => 'RequestHandler#updatePermissions', 'url' => '/shares/{id}/permissions', 'verb' => 'POST'],
34
+        ['root' => '/cloud', 'name' => 'RequestHandler#acceptShare', 'url' => '/shares/{id}/accept', 'verb' => 'POST'],
35
+        ['root' => '/cloud', 'name' => 'RequestHandler#declineShare', 'url' => '/shares/{id}/decline', 'verb' => 'POST'],
36
+        ['root' => '/cloud', 'name' => 'RequestHandler#unshare', 'url' => '/shares/{id}/unshare', 'verb' => 'POST'],
37
+        ['root' => '/cloud', 'name' => 'RequestHandler#revoke', 'url' => '/shares/{id}/revoke', 'verb' => 'POST'],
38
+        ['root' => '/cloud', 'name' => 'RequestHandler#move', 'url' => '/shares/{id}/move', 'verb' => 'POST'],
39
+    ],
40 40
 ];
Please login to merge, or discard this patch.
apps/dav/appinfo/v2/remote.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  */
22 22
 // no php execution timeout for webdav
23 23
 if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
24
-	@set_time_limit(0);
24
+    @set_time_limit(0);
25 25
 }
26 26
 ignore_user_abort(true);
27 27
 
Please login to merge, or discard this patch.
lib/private/Share20/ProviderFactory.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		}
215 215
 
216 216
 		if ($provider === null) {
217
-			throw new ProviderException('No provider with id .' . $id . ' found.');
217
+			throw new ProviderException('No provider with id .'.$id.' found.');
218 218
 		}
219 219
 
220 220
 		return $provider;
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 
243 243
 		if ($provider === null) {
244
-			throw new ProviderException('No share provider for share type ' . $shareType);
244
+			throw new ProviderException('No share provider for share type '.$shareType);
245 245
 		}
246 246
 
247 247
 		return $provider;
Please login to merge, or discard this patch.
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -50,274 +50,274 @@
 block discarded – undo
50 50
  */
51 51
 class ProviderFactory implements IProviderFactory {
52 52
 
53
-	/** @var IServerContainer */
54
-	private $serverContainer;
55
-	/** @var DefaultShareProvider */
56
-	private $defaultProvider = null;
57
-	/** @var FederatedShareProvider */
58
-	private $federatedProvider = null;
59
-	/** @var  ShareByMailProvider */
60
-	private $shareByMailProvider;
61
-	/** @var  \OCA\Circles\ShareByCircleProvider */
62
-	private $shareByCircleProvider = null;
63
-	/** @var bool */
64
-	private $circlesAreNotAvailable = false;
65
-	/** @var \OCA\Talk\Share\RoomShareProvider */
66
-	private $roomShareProvider = null;
67
-
68
-	/**
69
-	 * IProviderFactory constructor.
70
-	 *
71
-	 * @param IServerContainer $serverContainer
72
-	 */
73
-	public function __construct(IServerContainer $serverContainer) {
74
-		$this->serverContainer = $serverContainer;
75
-	}
76
-
77
-	/**
78
-	 * Create the default share provider.
79
-	 *
80
-	 * @return DefaultShareProvider
81
-	 */
82
-	protected function defaultShareProvider() {
83
-		if ($this->defaultProvider === null) {
84
-			$this->defaultProvider = new DefaultShareProvider(
85
-				$this->serverContainer->getDatabaseConnection(),
86
-				$this->serverContainer->getUserManager(),
87
-				$this->serverContainer->getGroupManager(),
88
-				$this->serverContainer->getLazyRootFolder(),
89
-				$this->serverContainer->getMailer(),
90
-				$this->serverContainer->query(Defaults::class),
91
-				$this->serverContainer->getL10NFactory(),
92
-				$this->serverContainer->getURLGenerator(),
93
-				$this->serverContainer->getConfig()
94
-			);
95
-		}
96
-
97
-		return $this->defaultProvider;
98
-	}
99
-
100
-	/**
101
-	 * Create the federated share provider
102
-	 *
103
-	 * @return FederatedShareProvider
104
-	 */
105
-	protected function federatedShareProvider() {
106
-		if ($this->federatedProvider === null) {
107
-			/*
53
+    /** @var IServerContainer */
54
+    private $serverContainer;
55
+    /** @var DefaultShareProvider */
56
+    private $defaultProvider = null;
57
+    /** @var FederatedShareProvider */
58
+    private $federatedProvider = null;
59
+    /** @var  ShareByMailProvider */
60
+    private $shareByMailProvider;
61
+    /** @var  \OCA\Circles\ShareByCircleProvider */
62
+    private $shareByCircleProvider = null;
63
+    /** @var bool */
64
+    private $circlesAreNotAvailable = false;
65
+    /** @var \OCA\Talk\Share\RoomShareProvider */
66
+    private $roomShareProvider = null;
67
+
68
+    /**
69
+     * IProviderFactory constructor.
70
+     *
71
+     * @param IServerContainer $serverContainer
72
+     */
73
+    public function __construct(IServerContainer $serverContainer) {
74
+        $this->serverContainer = $serverContainer;
75
+    }
76
+
77
+    /**
78
+     * Create the default share provider.
79
+     *
80
+     * @return DefaultShareProvider
81
+     */
82
+    protected function defaultShareProvider() {
83
+        if ($this->defaultProvider === null) {
84
+            $this->defaultProvider = new DefaultShareProvider(
85
+                $this->serverContainer->getDatabaseConnection(),
86
+                $this->serverContainer->getUserManager(),
87
+                $this->serverContainer->getGroupManager(),
88
+                $this->serverContainer->getLazyRootFolder(),
89
+                $this->serverContainer->getMailer(),
90
+                $this->serverContainer->query(Defaults::class),
91
+                $this->serverContainer->getL10NFactory(),
92
+                $this->serverContainer->getURLGenerator(),
93
+                $this->serverContainer->getConfig()
94
+            );
95
+        }
96
+
97
+        return $this->defaultProvider;
98
+    }
99
+
100
+    /**
101
+     * Create the federated share provider
102
+     *
103
+     * @return FederatedShareProvider
104
+     */
105
+    protected function federatedShareProvider() {
106
+        if ($this->federatedProvider === null) {
107
+            /*
108 108
 			 * Check if the app is enabled
109 109
 			 */
110
-			$appManager = $this->serverContainer->getAppManager();
111
-			if (!$appManager->isEnabledForUser('federatedfilesharing')) {
112
-				return null;
113
-			}
110
+            $appManager = $this->serverContainer->getAppManager();
111
+            if (!$appManager->isEnabledForUser('federatedfilesharing')) {
112
+                return null;
113
+            }
114 114
 
115
-			/*
115
+            /*
116 116
 			 * TODO: add factory to federated sharing app
117 117
 			 */
118
-			$l = $this->serverContainer->getL10N('federatedfilesharing');
119
-			$addressHandler = new AddressHandler(
120
-				$this->serverContainer->getURLGenerator(),
121
-				$l,
122
-				$this->serverContainer->getCloudIdManager()
123
-			);
124
-			$notifications = new Notifications(
125
-				$addressHandler,
126
-				$this->serverContainer->getHTTPClientService(),
127
-				$this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
128
-				$this->serverContainer->getJobList(),
129
-				\OC::$server->getCloudFederationProviderManager(),
130
-				\OC::$server->getCloudFederationFactory(),
131
-				$this->serverContainer->query(IEventDispatcher::class)
132
-			);
133
-			$tokenHandler = new TokenHandler(
134
-				$this->serverContainer->getSecureRandom()
135
-			);
136
-
137
-			$this->federatedProvider = new FederatedShareProvider(
138
-				$this->serverContainer->getDatabaseConnection(),
139
-				$addressHandler,
140
-				$notifications,
141
-				$tokenHandler,
142
-				$l,
143
-				$this->serverContainer->getLogger(),
144
-				$this->serverContainer->getLazyRootFolder(),
145
-				$this->serverContainer->getConfig(),
146
-				$this->serverContainer->getUserManager(),
147
-				$this->serverContainer->getCloudIdManager(),
148
-				$this->serverContainer->getGlobalScaleConfig(),
149
-				$this->serverContainer->getCloudFederationProviderManager()
150
-			);
151
-		}
152
-
153
-		return $this->federatedProvider;
154
-	}
155
-
156
-	/**
157
-	 * Create the federated share provider
158
-	 *
159
-	 * @return ShareByMailProvider
160
-	 */
161
-	protected function getShareByMailProvider() {
162
-		if ($this->shareByMailProvider === null) {
163
-			/*
118
+            $l = $this->serverContainer->getL10N('federatedfilesharing');
119
+            $addressHandler = new AddressHandler(
120
+                $this->serverContainer->getURLGenerator(),
121
+                $l,
122
+                $this->serverContainer->getCloudIdManager()
123
+            );
124
+            $notifications = new Notifications(
125
+                $addressHandler,
126
+                $this->serverContainer->getHTTPClientService(),
127
+                $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
128
+                $this->serverContainer->getJobList(),
129
+                \OC::$server->getCloudFederationProviderManager(),
130
+                \OC::$server->getCloudFederationFactory(),
131
+                $this->serverContainer->query(IEventDispatcher::class)
132
+            );
133
+            $tokenHandler = new TokenHandler(
134
+                $this->serverContainer->getSecureRandom()
135
+            );
136
+
137
+            $this->federatedProvider = new FederatedShareProvider(
138
+                $this->serverContainer->getDatabaseConnection(),
139
+                $addressHandler,
140
+                $notifications,
141
+                $tokenHandler,
142
+                $l,
143
+                $this->serverContainer->getLogger(),
144
+                $this->serverContainer->getLazyRootFolder(),
145
+                $this->serverContainer->getConfig(),
146
+                $this->serverContainer->getUserManager(),
147
+                $this->serverContainer->getCloudIdManager(),
148
+                $this->serverContainer->getGlobalScaleConfig(),
149
+                $this->serverContainer->getCloudFederationProviderManager()
150
+            );
151
+        }
152
+
153
+        return $this->federatedProvider;
154
+    }
155
+
156
+    /**
157
+     * Create the federated share provider
158
+     *
159
+     * @return ShareByMailProvider
160
+     */
161
+    protected function getShareByMailProvider() {
162
+        if ($this->shareByMailProvider === null) {
163
+            /*
164 164
 			 * Check if the app is enabled
165 165
 			 */
166
-			$appManager = $this->serverContainer->getAppManager();
167
-			if (!$appManager->isEnabledForUser('sharebymail')) {
168
-				return null;
169
-			}
170
-
171
-			$settingsManager = new SettingsManager($this->serverContainer->getConfig());
172
-
173
-			$this->shareByMailProvider = new ShareByMailProvider(
174
-				$this->serverContainer->getDatabaseConnection(),
175
-				$this->serverContainer->getSecureRandom(),
176
-				$this->serverContainer->getUserManager(),
177
-				$this->serverContainer->getLazyRootFolder(),
178
-				$this->serverContainer->getL10N('sharebymail'),
179
-				$this->serverContainer->getLogger(),
180
-				$this->serverContainer->getMailer(),
181
-				$this->serverContainer->getURLGenerator(),
182
-				$this->serverContainer->getActivityManager(),
183
-				$settingsManager,
184
-				$this->serverContainer->query(Defaults::class),
185
-				$this->serverContainer->getHasher(),
186
-				$this->serverContainer->get(IEventDispatcher::class)
187
-			);
188
-		}
189
-
190
-		return $this->shareByMailProvider;
191
-	}
192
-
193
-
194
-	/**
195
-	 * Create the circle share provider
196
-	 *
197
-	 * @return FederatedShareProvider
198
-	 *
199
-	 * @suppress PhanUndeclaredClassMethod
200
-	 */
201
-	protected function getShareByCircleProvider() {
202
-		if ($this->circlesAreNotAvailable) {
203
-			return null;
204
-		}
205
-
206
-		if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
207
-			!class_exists('\OCA\Circles\ShareByCircleProvider')
208
-		) {
209
-			$this->circlesAreNotAvailable = true;
210
-			return null;
211
-		}
212
-
213
-		if ($this->shareByCircleProvider === null) {
214
-			$this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
215
-				$this->serverContainer->getDatabaseConnection(),
216
-				$this->serverContainer->getSecureRandom(),
217
-				$this->serverContainer->getUserManager(),
218
-				$this->serverContainer->getLazyRootFolder(),
219
-				$this->serverContainer->getL10N('circles'),
220
-				$this->serverContainer->getLogger(),
221
-				$this->serverContainer->getURLGenerator()
222
-			);
223
-		}
224
-
225
-		return $this->shareByCircleProvider;
226
-	}
227
-
228
-	/**
229
-	 * Create the room share provider
230
-	 *
231
-	 * @return RoomShareProvider
232
-	 */
233
-	protected function getRoomShareProvider() {
234
-		if ($this->roomShareProvider === null) {
235
-			/*
166
+            $appManager = $this->serverContainer->getAppManager();
167
+            if (!$appManager->isEnabledForUser('sharebymail')) {
168
+                return null;
169
+            }
170
+
171
+            $settingsManager = new SettingsManager($this->serverContainer->getConfig());
172
+
173
+            $this->shareByMailProvider = new ShareByMailProvider(
174
+                $this->serverContainer->getDatabaseConnection(),
175
+                $this->serverContainer->getSecureRandom(),
176
+                $this->serverContainer->getUserManager(),
177
+                $this->serverContainer->getLazyRootFolder(),
178
+                $this->serverContainer->getL10N('sharebymail'),
179
+                $this->serverContainer->getLogger(),
180
+                $this->serverContainer->getMailer(),
181
+                $this->serverContainer->getURLGenerator(),
182
+                $this->serverContainer->getActivityManager(),
183
+                $settingsManager,
184
+                $this->serverContainer->query(Defaults::class),
185
+                $this->serverContainer->getHasher(),
186
+                $this->serverContainer->get(IEventDispatcher::class)
187
+            );
188
+        }
189
+
190
+        return $this->shareByMailProvider;
191
+    }
192
+
193
+
194
+    /**
195
+     * Create the circle share provider
196
+     *
197
+     * @return FederatedShareProvider
198
+     *
199
+     * @suppress PhanUndeclaredClassMethod
200
+     */
201
+    protected function getShareByCircleProvider() {
202
+        if ($this->circlesAreNotAvailable) {
203
+            return null;
204
+        }
205
+
206
+        if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
207
+            !class_exists('\OCA\Circles\ShareByCircleProvider')
208
+        ) {
209
+            $this->circlesAreNotAvailable = true;
210
+            return null;
211
+        }
212
+
213
+        if ($this->shareByCircleProvider === null) {
214
+            $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
215
+                $this->serverContainer->getDatabaseConnection(),
216
+                $this->serverContainer->getSecureRandom(),
217
+                $this->serverContainer->getUserManager(),
218
+                $this->serverContainer->getLazyRootFolder(),
219
+                $this->serverContainer->getL10N('circles'),
220
+                $this->serverContainer->getLogger(),
221
+                $this->serverContainer->getURLGenerator()
222
+            );
223
+        }
224
+
225
+        return $this->shareByCircleProvider;
226
+    }
227
+
228
+    /**
229
+     * Create the room share provider
230
+     *
231
+     * @return RoomShareProvider
232
+     */
233
+    protected function getRoomShareProvider() {
234
+        if ($this->roomShareProvider === null) {
235
+            /*
236 236
 			 * Check if the app is enabled
237 237
 			 */
238
-			$appManager = $this->serverContainer->getAppManager();
239
-			if (!$appManager->isEnabledForUser('spreed')) {
240
-				return null;
241
-			}
242
-
243
-			try {
244
-				$this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
245
-			} catch (\OCP\AppFramework\QueryException $e) {
246
-				return null;
247
-			}
248
-		}
249
-
250
-		return $this->roomShareProvider;
251
-	}
252
-
253
-	/**
254
-	 * @inheritdoc
255
-	 */
256
-	public function getProvider($id) {
257
-		$provider = null;
258
-		if ($id === 'ocinternal') {
259
-			$provider = $this->defaultShareProvider();
260
-		} elseif ($id === 'ocFederatedSharing') {
261
-			$provider = $this->federatedShareProvider();
262
-		} elseif ($id === 'ocMailShare') {
263
-			$provider = $this->getShareByMailProvider();
264
-		} elseif ($id === 'ocCircleShare') {
265
-			$provider = $this->getShareByCircleProvider();
266
-		} elseif ($id === 'ocRoomShare') {
267
-			$provider = $this->getRoomShareProvider();
268
-		}
269
-
270
-		if ($provider === null) {
271
-			throw new ProviderException('No provider with id .' . $id . ' found.');
272
-		}
273
-
274
-		return $provider;
275
-	}
276
-
277
-	/**
278
-	 * @inheritdoc
279
-	 */
280
-	public function getProviderForType($shareType) {
281
-		$provider = null;
282
-
283
-		if ($shareType === IShare::TYPE_USER ||
284
-			$shareType === IShare::TYPE_GROUP ||
285
-			$shareType === IShare::TYPE_LINK
286
-		) {
287
-			$provider = $this->defaultShareProvider();
288
-		} elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
289
-			$provider = $this->federatedShareProvider();
290
-		} elseif ($shareType === IShare::TYPE_EMAIL) {
291
-			$provider = $this->getShareByMailProvider();
292
-		} elseif ($shareType === IShare::TYPE_CIRCLE) {
293
-			$provider = $this->getShareByCircleProvider();
294
-		} elseif ($shareType === IShare::TYPE_ROOM) {
295
-			$provider = $this->getRoomShareProvider();
296
-		}
297
-
298
-
299
-		if ($provider === null) {
300
-			throw new ProviderException('No share provider for share type ' . $shareType);
301
-		}
302
-
303
-		return $provider;
304
-	}
305
-
306
-	public function getAllProviders() {
307
-		$shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
308
-		$shareByMail = $this->getShareByMailProvider();
309
-		if ($shareByMail !== null) {
310
-			$shares[] = $shareByMail;
311
-		}
312
-		$shareByCircle = $this->getShareByCircleProvider();
313
-		if ($shareByCircle !== null) {
314
-			$shares[] = $shareByCircle;
315
-		}
316
-		$roomShare = $this->getRoomShareProvider();
317
-		if ($roomShare !== null) {
318
-			$shares[] = $roomShare;
319
-		}
320
-
321
-		return $shares;
322
-	}
238
+            $appManager = $this->serverContainer->getAppManager();
239
+            if (!$appManager->isEnabledForUser('spreed')) {
240
+                return null;
241
+            }
242
+
243
+            try {
244
+                $this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
245
+            } catch (\OCP\AppFramework\QueryException $e) {
246
+                return null;
247
+            }
248
+        }
249
+
250
+        return $this->roomShareProvider;
251
+    }
252
+
253
+    /**
254
+     * @inheritdoc
255
+     */
256
+    public function getProvider($id) {
257
+        $provider = null;
258
+        if ($id === 'ocinternal') {
259
+            $provider = $this->defaultShareProvider();
260
+        } elseif ($id === 'ocFederatedSharing') {
261
+            $provider = $this->federatedShareProvider();
262
+        } elseif ($id === 'ocMailShare') {
263
+            $provider = $this->getShareByMailProvider();
264
+        } elseif ($id === 'ocCircleShare') {
265
+            $provider = $this->getShareByCircleProvider();
266
+        } elseif ($id === 'ocRoomShare') {
267
+            $provider = $this->getRoomShareProvider();
268
+        }
269
+
270
+        if ($provider === null) {
271
+            throw new ProviderException('No provider with id .' . $id . ' found.');
272
+        }
273
+
274
+        return $provider;
275
+    }
276
+
277
+    /**
278
+     * @inheritdoc
279
+     */
280
+    public function getProviderForType($shareType) {
281
+        $provider = null;
282
+
283
+        if ($shareType === IShare::TYPE_USER ||
284
+            $shareType === IShare::TYPE_GROUP ||
285
+            $shareType === IShare::TYPE_LINK
286
+        ) {
287
+            $provider = $this->defaultShareProvider();
288
+        } elseif ($shareType === IShare::TYPE_REMOTE || $shareType === IShare::TYPE_REMOTE_GROUP) {
289
+            $provider = $this->federatedShareProvider();
290
+        } elseif ($shareType === IShare::TYPE_EMAIL) {
291
+            $provider = $this->getShareByMailProvider();
292
+        } elseif ($shareType === IShare::TYPE_CIRCLE) {
293
+            $provider = $this->getShareByCircleProvider();
294
+        } elseif ($shareType === IShare::TYPE_ROOM) {
295
+            $provider = $this->getRoomShareProvider();
296
+        }
297
+
298
+
299
+        if ($provider === null) {
300
+            throw new ProviderException('No share provider for share type ' . $shareType);
301
+        }
302
+
303
+        return $provider;
304
+    }
305
+
306
+    public function getAllProviders() {
307
+        $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
308
+        $shareByMail = $this->getShareByMailProvider();
309
+        if ($shareByMail !== null) {
310
+            $shares[] = $shareByMail;
311
+        }
312
+        $shareByCircle = $this->getShareByCircleProvider();
313
+        if ($shareByCircle !== null) {
314
+            $shares[] = $shareByCircle;
315
+        }
316
+        $roomShare = $this->getRoomShareProvider();
317
+        if ($roomShare !== null) {
318
+            $shares[] = $roomShare;
319
+        }
320
+
321
+        return $shares;
322
+    }
323 323
 }
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/Converter.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,9 +119,9 @@
 block discarded – undo
119 119
 		$elements = explode(' ', $fullName);
120 120
 		$result = ['', '', '', '', ''];
121 121
 		if (count($elements) > 2) {
122
-			$result[0] = implode(' ', array_slice($elements, count($elements)-1));
122
+			$result[0] = implode(' ', array_slice($elements, count($elements) - 1));
123 123
 			$result[1] = $elements[0];
124
-			$result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
124
+			$result[2] = implode(' ', array_slice($elements, 1, count($elements) - 2));
125 125
 		} elseif (count($elements) === 2) {
126 126
 			$result[0] = $elements[1];
127 127
 			$result[1] = $elements[0];
Please login to merge, or discard this patch.
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -33,119 +33,119 @@
 block discarded – undo
33 33
 
34 34
 class Converter {
35 35
 
36
-	/** @var AccountManager */
37
-	private $accountManager;
38
-
39
-	/**
40
-	 * Converter constructor.
41
-	 *
42
-	 * @param AccountManager $accountManager
43
-	 */
44
-	public function __construct(AccountManager $accountManager) {
45
-		$this->accountManager = $accountManager;
46
-	}
47
-
48
-	/**
49
-	 * @param IUser $user
50
-	 * @return VCard|null
51
-	 */
52
-	public function createCardFromUser(IUser $user) {
53
-		$userData = $this->accountManager->getUser($user);
54
-
55
-		$uid = $user->getUID();
56
-		$cloudId = $user->getCloudId();
57
-		$image = $this->getAvatarImage($user);
58
-
59
-		$vCard = new VCard();
60
-		$vCard->VERSION = '3.0';
61
-		$vCard->UID = $uid;
62
-
63
-		$publish = false;
64
-
65
-		if ($image !== null && isset($userData[AccountManager::PROPERTY_AVATAR])) {
66
-			$userData[AccountManager::PROPERTY_AVATAR]['value'] = true;
67
-		}
68
-
69
-		foreach ($userData as $property => $value) {
70
-			$shareWithTrustedServers =
71
-				$value['scope'] === AccountManager::VISIBILITY_CONTACTS_ONLY ||
72
-				$value['scope'] === AccountManager::VISIBILITY_PUBLIC;
73
-
74
-			$emptyValue = !isset($value['value']) || $value['value'] === '';
75
-
76
-			if ($shareWithTrustedServers && !$emptyValue) {
77
-				$publish = true;
78
-				switch ($property) {
79
-					case AccountManager::PROPERTY_DISPLAYNAME:
80
-						$vCard->add(new Text($vCard, 'FN', $value['value']));
81
-						$vCard->add(new Text($vCard, 'N', $this->splitFullName($value['value'])));
82
-						break;
83
-					case AccountManager::PROPERTY_AVATAR:
84
-						if ($image !== null) {
85
-							$vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
86
-						}
87
-						break;
88
-					case AccountManager::PROPERTY_EMAIL:
89
-						$vCard->add(new Text($vCard, 'EMAIL', $value['value'], ['TYPE' => 'OTHER']));
90
-						break;
91
-					case AccountManager::PROPERTY_WEBSITE:
92
-						$vCard->add(new Text($vCard, 'URL', $value['value']));
93
-						break;
94
-					case AccountManager::PROPERTY_PHONE:
95
-						$vCard->add(new Text($vCard, 'TEL', $value['value'], ['TYPE' => 'OTHER']));
96
-						break;
97
-					case AccountManager::PROPERTY_ADDRESS:
98
-						$vCard->add(new Text($vCard, 'ADR', $value['value'], ['TYPE' => 'OTHER']));
99
-						break;
100
-					case AccountManager::PROPERTY_TWITTER:
101
-						$vCard->add(new Text($vCard, 'X-SOCIALPROFILE', $value['value'], ['TYPE' => 'TWITTER']));
102
-						break;
103
-				}
104
-			}
105
-		}
106
-
107
-		if ($publish && !empty($cloudId)) {
108
-			$vCard->add(new Text($vCard, 'CLOUD', $cloudId));
109
-			$vCard->validate();
110
-			return $vCard;
111
-		}
112
-
113
-		return null;
114
-	}
115
-
116
-	/**
117
-	 * @param string $fullName
118
-	 * @return string[]
119
-	 */
120
-	public function splitFullName($fullName) {
121
-		// Very basic western style parsing. I'm not gonna implement
122
-		// https://github.com/android/platform_packages_providers_contactsprovider/blob/master/src/com/android/providers/contacts/NameSplitter.java ;)
123
-
124
-		$elements = explode(' ', $fullName);
125
-		$result = ['', '', '', '', ''];
126
-		if (count($elements) > 2) {
127
-			$result[0] = implode(' ', array_slice($elements, count($elements)-1));
128
-			$result[1] = $elements[0];
129
-			$result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
130
-		} elseif (count($elements) === 2) {
131
-			$result[0] = $elements[1];
132
-			$result[1] = $elements[0];
133
-		} else {
134
-			$result[0] = $elements[0];
135
-		}
136
-
137
-		return $result;
138
-	}
139
-
140
-	/**
141
-	 * @param IUser $user
142
-	 * @return null|IImage
143
-	 */
144
-	private function getAvatarImage(IUser $user) {
145
-		try {
146
-			return $user->getAvatarImage(-1);
147
-		} catch (\Exception $ex) {
148
-			return null;
149
-		}
150
-	}
36
+    /** @var AccountManager */
37
+    private $accountManager;
38
+
39
+    /**
40
+     * Converter constructor.
41
+     *
42
+     * @param AccountManager $accountManager
43
+     */
44
+    public function __construct(AccountManager $accountManager) {
45
+        $this->accountManager = $accountManager;
46
+    }
47
+
48
+    /**
49
+     * @param IUser $user
50
+     * @return VCard|null
51
+     */
52
+    public function createCardFromUser(IUser $user) {
53
+        $userData = $this->accountManager->getUser($user);
54
+
55
+        $uid = $user->getUID();
56
+        $cloudId = $user->getCloudId();
57
+        $image = $this->getAvatarImage($user);
58
+
59
+        $vCard = new VCard();
60
+        $vCard->VERSION = '3.0';
61
+        $vCard->UID = $uid;
62
+
63
+        $publish = false;
64
+
65
+        if ($image !== null && isset($userData[AccountManager::PROPERTY_AVATAR])) {
66
+            $userData[AccountManager::PROPERTY_AVATAR]['value'] = true;
67
+        }
68
+
69
+        foreach ($userData as $property => $value) {
70
+            $shareWithTrustedServers =
71
+                $value['scope'] === AccountManager::VISIBILITY_CONTACTS_ONLY ||
72
+                $value['scope'] === AccountManager::VISIBILITY_PUBLIC;
73
+
74
+            $emptyValue = !isset($value['value']) || $value['value'] === '';
75
+
76
+            if ($shareWithTrustedServers && !$emptyValue) {
77
+                $publish = true;
78
+                switch ($property) {
79
+                    case AccountManager::PROPERTY_DISPLAYNAME:
80
+                        $vCard->add(new Text($vCard, 'FN', $value['value']));
81
+                        $vCard->add(new Text($vCard, 'N', $this->splitFullName($value['value'])));
82
+                        break;
83
+                    case AccountManager::PROPERTY_AVATAR:
84
+                        if ($image !== null) {
85
+                            $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
86
+                        }
87
+                        break;
88
+                    case AccountManager::PROPERTY_EMAIL:
89
+                        $vCard->add(new Text($vCard, 'EMAIL', $value['value'], ['TYPE' => 'OTHER']));
90
+                        break;
91
+                    case AccountManager::PROPERTY_WEBSITE:
92
+                        $vCard->add(new Text($vCard, 'URL', $value['value']));
93
+                        break;
94
+                    case AccountManager::PROPERTY_PHONE:
95
+                        $vCard->add(new Text($vCard, 'TEL', $value['value'], ['TYPE' => 'OTHER']));
96
+                        break;
97
+                    case AccountManager::PROPERTY_ADDRESS:
98
+                        $vCard->add(new Text($vCard, 'ADR', $value['value'], ['TYPE' => 'OTHER']));
99
+                        break;
100
+                    case AccountManager::PROPERTY_TWITTER:
101
+                        $vCard->add(new Text($vCard, 'X-SOCIALPROFILE', $value['value'], ['TYPE' => 'TWITTER']));
102
+                        break;
103
+                }
104
+            }
105
+        }
106
+
107
+        if ($publish && !empty($cloudId)) {
108
+            $vCard->add(new Text($vCard, 'CLOUD', $cloudId));
109
+            $vCard->validate();
110
+            return $vCard;
111
+        }
112
+
113
+        return null;
114
+    }
115
+
116
+    /**
117
+     * @param string $fullName
118
+     * @return string[]
119
+     */
120
+    public function splitFullName($fullName) {
121
+        // Very basic western style parsing. I'm not gonna implement
122
+        // https://github.com/android/platform_packages_providers_contactsprovider/blob/master/src/com/android/providers/contacts/NameSplitter.java ;)
123
+
124
+        $elements = explode(' ', $fullName);
125
+        $result = ['', '', '', '', ''];
126
+        if (count($elements) > 2) {
127
+            $result[0] = implode(' ', array_slice($elements, count($elements)-1));
128
+            $result[1] = $elements[0];
129
+            $result[2] = implode(' ', array_slice($elements, 1, count($elements)-2));
130
+        } elseif (count($elements) === 2) {
131
+            $result[0] = $elements[1];
132
+            $result[1] = $elements[0];
133
+        } else {
134
+            $result[0] = $elements[0];
135
+        }
136
+
137
+        return $result;
138
+    }
139
+
140
+    /**
141
+     * @param IUser $user
142
+     * @return null|IImage
143
+     */
144
+    private function getAvatarImage(IUser $user) {
145
+        try {
146
+            return $user->getAvatarImage(-1);
147
+        } catch (\Exception $ex) {
148
+            return null;
149
+        }
150
+    }
151 151
 }
Please login to merge, or discard this patch.
lib/private/Migration/ConsoleOutput.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -37,57 +37,57 @@
 block discarded – undo
37 37
  */
38 38
 class ConsoleOutput implements IOutput {
39 39
 
40
-	/** @var OutputInterface */
41
-	private $output;
40
+    /** @var OutputInterface */
41
+    private $output;
42 42
 
43
-	/** @var ProgressBar */
44
-	private $progressBar;
43
+    /** @var ProgressBar */
44
+    private $progressBar;
45 45
 
46
-	public function __construct(OutputInterface $output) {
47
-		$this->output = $output;
48
-	}
46
+    public function __construct(OutputInterface $output) {
47
+        $this->output = $output;
48
+    }
49 49
 
50
-	/**
51
-	 * @param string $message
52
-	 */
53
-	public function info($message) {
54
-		$this->output->writeln("<info>$message</info>");
55
-	}
50
+    /**
51
+     * @param string $message
52
+     */
53
+    public function info($message) {
54
+        $this->output->writeln("<info>$message</info>");
55
+    }
56 56
 
57
-	/**
58
-	 * @param string $message
59
-	 */
60
-	public function warning($message) {
61
-		$this->output->writeln("<comment>$message</comment>");
62
-	}
57
+    /**
58
+     * @param string $message
59
+     */
60
+    public function warning($message) {
61
+        $this->output->writeln("<comment>$message</comment>");
62
+    }
63 63
 
64
-	/**
65
-	 * @param int $max
66
-	 */
67
-	public function startProgress($max = 0) {
68
-		if (!is_null($this->progressBar)) {
69
-			$this->progressBar->finish();
70
-		}
71
-		$this->progressBar = new ProgressBar($this->output);
72
-		$this->progressBar->start($max);
73
-	}
64
+    /**
65
+     * @param int $max
66
+     */
67
+    public function startProgress($max = 0) {
68
+        if (!is_null($this->progressBar)) {
69
+            $this->progressBar->finish();
70
+        }
71
+        $this->progressBar = new ProgressBar($this->output);
72
+        $this->progressBar->start($max);
73
+    }
74 74
 
75
-	/**
76
-	 * @param int $step
77
-	 * @param string $description
78
-	 */
79
-	public function advance($step = 1, $description = '') {
80
-		if (!is_null($this->progressBar)) {
81
-			$this->progressBar = new ProgressBar($this->output);
82
-			$this->progressBar->start();
83
-		}
84
-		$this->progressBar->advance($step);
85
-	}
75
+    /**
76
+     * @param int $step
77
+     * @param string $description
78
+     */
79
+    public function advance($step = 1, $description = '') {
80
+        if (!is_null($this->progressBar)) {
81
+            $this->progressBar = new ProgressBar($this->output);
82
+            $this->progressBar->start();
83
+        }
84
+        $this->progressBar->advance($step);
85
+    }
86 86
 
87
-	public function finishProgress() {
88
-		if (is_null($this->progressBar)) {
89
-			return;
90
-		}
91
-		$this->progressBar->finish();
92
-	}
87
+    public function finishProgress() {
88
+        if (is_null($this->progressBar)) {
89
+            return;
90
+        }
91
+        $this->progressBar->finish();
92
+    }
93 93
 }
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IEntry.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -31,36 +31,36 @@
 block discarded – undo
31 31
  */
32 32
 interface IEntry extends JsonSerializable {
33 33
 
34
-	/**
35
-	 * @since 12.0
36
-	 * @return string
37
-	 */
38
-	public function getFullName();
34
+    /**
35
+     * @since 12.0
36
+     * @return string
37
+     */
38
+    public function getFullName();
39 39
 
40
-	/**
41
-	 * @since 12.0
42
-	 * @return string[]
43
-	 */
44
-	public function getEMailAddresses();
40
+    /**
41
+     * @since 12.0
42
+     * @return string[]
43
+     */
44
+    public function getEMailAddresses();
45 45
 
46
-	/**
47
-	 * @since 12.0
48
-	 * @return string|null image URI
49
-	 */
50
-	public function getAvatar();
46
+    /**
47
+     * @since 12.0
48
+     * @return string|null image URI
49
+     */
50
+    public function getAvatar();
51 51
 
52
-	/**
53
-	 * @since 12.0
54
-	 * @param IAction $action an action to show in the contacts menu
55
-	 */
56
-	public function addAction(IAction $action);
52
+    /**
53
+     * @since 12.0
54
+     * @param IAction $action an action to show in the contacts menu
55
+     */
56
+    public function addAction(IAction $action);
57 57
 
58
-	/**
59
-	 * Get an arbitrary property from the contact
60
-	 *
61
-	 * @since 12.0
62
-	 * @param string $key
63
-	 * @return mixed the value of the property or null
64
-	 */
65
-	public function getProperty($key);
58
+    /**
59
+     * Get an arbitrary property from the contact
60
+     *
61
+     * @since 12.0
62
+     * @param string $key
63
+     * @return mixed the value of the property or null
64
+     */
65
+    public function getProperty($key);
66 66
 }
Please login to merge, or discard this patch.
lib/private/Files/FileInfo.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param \OCP\Files\Mount\IMountPoint $mount
88 88
 	 * @param \OCP\IUser|null $owner
89 89
 	 */
90
-	public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
90
+	public function __construct($path, $storage, $internalPath, $data, $mount, $owner = null) {
91 91
 		$this->path = $path;
92 92
 		$this->storage = $storage;
93 93
 		$this->internalPath = $internalPath;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return int|null
154 154
 	 */
155 155
 	public function getId() {
156
-		return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
156
+		return isset($this->data['fileid']) ? (int) $this->data['fileid'] : null;
157 157
 	}
158 158
 
159 159
 	/**
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	public function getEtag() {
184 184
 		$this->updateEntryfromSubMounts();
185 185
 		if (count($this->childEtags) > 0) {
186
-			$combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
186
+			$combinedEtag = $this->data['etag'].'::'.implode('::', $this->childEtags);
187 187
 			return md5($combinedEtag);
188 188
 		} else {
189 189
 			return $this->data['etag'];
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 			$relativeEntryPath = substr($entryPath, strlen($this->getPath()));
380 380
 			// attach the permissions to propagate etag on permision changes of submounts
381 381
 			$permissions = isset($data['permissions']) ? $data['permissions'] : 0;
382
-			$this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
382
+			$this->childEtags[] = $relativeEntryPath.'/'.$data['etag'].$permissions;
383 383
 		}
384 384
 	}
385 385
 
Please login to merge, or discard this patch.
Indentation   +376 added lines, -376 removed lines patch added patch discarded remove patch
@@ -37,380 +37,380 @@
 block discarded – undo
37 37
 use OCP\IUser;
38 38
 
39 39
 class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
40
-	/**
41
-	 * @var array $data
42
-	 */
43
-	private $data;
44
-
45
-	/**
46
-	 * @var string $path
47
-	 */
48
-	private $path;
49
-
50
-	/**
51
-	 * @var \OC\Files\Storage\Storage $storage
52
-	 */
53
-	private $storage;
54
-
55
-	/**
56
-	 * @var string $internalPath
57
-	 */
58
-	private $internalPath;
59
-
60
-	/**
61
-	 * @var \OCP\Files\Mount\IMountPoint
62
-	 */
63
-	private $mount;
64
-
65
-	/**
66
-	 * @var IUser
67
-	 */
68
-	private $owner;
69
-
70
-	/**
71
-	 * @var string[]
72
-	 */
73
-	private $childEtags = [];
74
-
75
-	/**
76
-	 * @var IMountPoint[]
77
-	 */
78
-	private $subMounts = [];
79
-
80
-	private $subMountsUsed = false;
81
-
82
-	/**
83
-	 * The size of the file/folder without any sub mount
84
-	 *
85
-	 * @var int
86
-	 */
87
-	private $rawSize = 0;
88
-
89
-	/**
90
-	 * @param string|boolean $path
91
-	 * @param Storage\Storage $storage
92
-	 * @param string $internalPath
93
-	 * @param array|ICacheEntry $data
94
-	 * @param \OCP\Files\Mount\IMountPoint $mount
95
-	 * @param \OCP\IUser|null $owner
96
-	 */
97
-	public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
98
-		$this->path = $path;
99
-		$this->storage = $storage;
100
-		$this->internalPath = $internalPath;
101
-		$this->data = $data;
102
-		$this->mount = $mount;
103
-		$this->owner = $owner;
104
-		$this->rawSize = $this->data['size'] ?? 0;
105
-	}
106
-
107
-	public function offsetSet($offset, $value) {
108
-		$this->data[$offset] = $value;
109
-	}
110
-
111
-	public function offsetExists($offset) {
112
-		return isset($this->data[$offset]);
113
-	}
114
-
115
-	public function offsetUnset($offset) {
116
-		unset($this->data[$offset]);
117
-	}
118
-
119
-	public function offsetGet($offset) {
120
-		if ($offset === 'type') {
121
-			return $this->getType();
122
-		} elseif ($offset === 'etag') {
123
-			return $this->getEtag();
124
-		} elseif ($offset === 'size') {
125
-			return $this->getSize();
126
-		} elseif ($offset === 'mtime') {
127
-			return $this->getMTime();
128
-		} elseif ($offset === 'permissions') {
129
-			return $this->getPermissions();
130
-		} elseif (isset($this->data[$offset])) {
131
-			return $this->data[$offset];
132
-		} else {
133
-			return null;
134
-		}
135
-	}
136
-
137
-	/**
138
-	 * @return string
139
-	 */
140
-	public function getPath() {
141
-		return $this->path;
142
-	}
143
-
144
-	/**
145
-	 * @return \OCP\Files\Storage
146
-	 */
147
-	public function getStorage() {
148
-		return $this->storage;
149
-	}
150
-
151
-	/**
152
-	 * @return string
153
-	 */
154
-	public function getInternalPath() {
155
-		return $this->internalPath;
156
-	}
157
-
158
-	/**
159
-	 * Get FileInfo ID or null in case of part file
160
-	 *
161
-	 * @return int|null
162
-	 */
163
-	public function getId() {
164
-		return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
165
-	}
166
-
167
-	/**
168
-	 * @return string
169
-	 */
170
-	public function getMimetype() {
171
-		return $this->data['mimetype'];
172
-	}
173
-
174
-	/**
175
-	 * @return string
176
-	 */
177
-	public function getMimePart() {
178
-		return $this->data['mimepart'];
179
-	}
180
-
181
-	/**
182
-	 * @return string
183
-	 */
184
-	public function getName() {
185
-		return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath());
186
-	}
187
-
188
-	/**
189
-	 * @return string
190
-	 */
191
-	public function getEtag() {
192
-		$this->updateEntryfromSubMounts();
193
-		if (count($this->childEtags) > 0) {
194
-			$combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
195
-			return md5($combinedEtag);
196
-		} else {
197
-			return $this->data['etag'];
198
-		}
199
-	}
200
-
201
-	/**
202
-	 * @return int
203
-	 */
204
-	public function getSize($includeMounts = true) {
205
-		if ($includeMounts) {
206
-			$this->updateEntryfromSubMounts();
207
-			return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
208
-		} else {
209
-			return $this->rawSize;
210
-		}
211
-	}
212
-
213
-	/**
214
-	 * @return int
215
-	 */
216
-	public function getMTime() {
217
-		$this->updateEntryfromSubMounts();
218
-		return (int) $this->data['mtime'];
219
-	}
220
-
221
-	/**
222
-	 * @return bool
223
-	 */
224
-	public function isEncrypted() {
225
-		return $this->data['encrypted'];
226
-	}
227
-
228
-	/**
229
-	 * Return the currently version used for the HMAC in the encryption app
230
-	 *
231
-	 * @return int
232
-	 */
233
-	public function getEncryptedVersion() {
234
-		return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
235
-	}
236
-
237
-	/**
238
-	 * @return int
239
-	 */
240
-	public function getPermissions() {
241
-		$perms = (int) $this->data['permissions'];
242
-		if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
243
-			$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
244
-		}
245
-		return (int) $perms;
246
-	}
247
-
248
-	/**
249
-	 * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
250
-	 */
251
-	public function getType() {
252
-		if (!isset($this->data['type'])) {
253
-			$this->data['type'] = ($this->getMimetype() === 'httpd/unix-directory') ? self::TYPE_FOLDER : self::TYPE_FILE;
254
-		}
255
-		return $this->data['type'];
256
-	}
257
-
258
-	public function getData() {
259
-		return $this->data;
260
-	}
261
-
262
-	/**
263
-	 * @param int $permissions
264
-	 * @return bool
265
-	 */
266
-	protected function checkPermissions($permissions) {
267
-		return ($this->getPermissions() & $permissions) === $permissions;
268
-	}
269
-
270
-	/**
271
-	 * @return bool
272
-	 */
273
-	public function isReadable() {
274
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
275
-	}
276
-
277
-	/**
278
-	 * @return bool
279
-	 */
280
-	public function isUpdateable() {
281
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
282
-	}
283
-
284
-	/**
285
-	 * Check whether new files or folders can be created inside this folder
286
-	 *
287
-	 * @return bool
288
-	 */
289
-	public function isCreatable() {
290
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
291
-	}
292
-
293
-	/**
294
-	 * @return bool
295
-	 */
296
-	public function isDeletable() {
297
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
298
-	}
299
-
300
-	/**
301
-	 * @return bool
302
-	 */
303
-	public function isShareable() {
304
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
305
-	}
306
-
307
-	/**
308
-	 * Check if a file or folder is shared
309
-	 *
310
-	 * @return bool
311
-	 */
312
-	public function isShared() {
313
-		$sid = $this->getStorage()->getId();
314
-		if (!is_null($sid)) {
315
-			$sid = explode(':', $sid);
316
-			return ($sid[0] === 'shared');
317
-		}
318
-
319
-		return false;
320
-	}
321
-
322
-	public function isMounted() {
323
-		$storage = $this->getStorage();
324
-		if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
325
-			return false;
326
-		}
327
-		$sid = $storage->getId();
328
-		if (!is_null($sid)) {
329
-			$sid = explode(':', $sid);
330
-			return ($sid[0] !== 'home' and $sid[0] !== 'shared');
331
-		}
332
-
333
-		return false;
334
-	}
335
-
336
-	/**
337
-	 * Get the mountpoint the file belongs to
338
-	 *
339
-	 * @return \OCP\Files\Mount\IMountPoint
340
-	 */
341
-	public function getMountPoint() {
342
-		return $this->mount;
343
-	}
344
-
345
-	/**
346
-	 * Get the owner of the file
347
-	 *
348
-	 * @return \OCP\IUser
349
-	 */
350
-	public function getOwner() {
351
-		return $this->owner;
352
-	}
353
-
354
-	/**
355
-	 * @param IMountPoint[] $mounts
356
-	 */
357
-	public function setSubMounts(array $mounts) {
358
-		$this->subMounts = $mounts;
359
-	}
360
-
361
-	private function updateEntryfromSubMounts() {
362
-		if ($this->subMountsUsed) {
363
-			return;
364
-		}
365
-		$this->subMountsUsed = true;
366
-		foreach ($this->subMounts as $mount) {
367
-			$subStorage = $mount->getStorage();
368
-			if ($subStorage) {
369
-				$subCache = $subStorage->getCache('');
370
-				$rootEntry = $subCache->get('');
371
-				$this->addSubEntry($rootEntry, $mount->getMountPoint());
372
-			}
373
-		}
374
-	}
375
-
376
-	/**
377
-	 * Add a cache entry which is the child of this folder
378
-	 *
379
-	 * Sets the size, etag and size to for cross-storage childs
380
-	 *
381
-	 * @param array|ICacheEntry $data cache entry for the child
382
-	 * @param string $entryPath full path of the child entry
383
-	 */
384
-	public function addSubEntry($data, $entryPath) {
385
-		$this->data['size'] += isset($data['size']) ? $data['size'] : 0;
386
-		if (isset($data['mtime'])) {
387
-			$this->data['mtime'] = max($this->data['mtime'], $data['mtime']);
388
-		}
389
-		if (isset($data['etag'])) {
390
-			// prefix the etag with the relative path of the subentry to propagate etag on mount moves
391
-			$relativeEntryPath = substr($entryPath, strlen($this->getPath()));
392
-			// attach the permissions to propagate etag on permision changes of submounts
393
-			$permissions = isset($data['permissions']) ? $data['permissions'] : 0;
394
-			$this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
395
-		}
396
-	}
397
-
398
-	/**
399
-	 * @inheritdoc
400
-	 */
401
-	public function getChecksum() {
402
-		return $this->data['checksum'];
403
-	}
404
-
405
-	public function getExtension(): string {
406
-		return pathinfo($this->getName(), PATHINFO_EXTENSION);
407
-	}
408
-
409
-	public function getCreationTime(): int {
410
-		return (int) $this->data['creation_time'];
411
-	}
412
-
413
-	public function getUploadTime(): int {
414
-		return (int) $this->data['upload_time'];
415
-	}
40
+    /**
41
+     * @var array $data
42
+     */
43
+    private $data;
44
+
45
+    /**
46
+     * @var string $path
47
+     */
48
+    private $path;
49
+
50
+    /**
51
+     * @var \OC\Files\Storage\Storage $storage
52
+     */
53
+    private $storage;
54
+
55
+    /**
56
+     * @var string $internalPath
57
+     */
58
+    private $internalPath;
59
+
60
+    /**
61
+     * @var \OCP\Files\Mount\IMountPoint
62
+     */
63
+    private $mount;
64
+
65
+    /**
66
+     * @var IUser
67
+     */
68
+    private $owner;
69
+
70
+    /**
71
+     * @var string[]
72
+     */
73
+    private $childEtags = [];
74
+
75
+    /**
76
+     * @var IMountPoint[]
77
+     */
78
+    private $subMounts = [];
79
+
80
+    private $subMountsUsed = false;
81
+
82
+    /**
83
+     * The size of the file/folder without any sub mount
84
+     *
85
+     * @var int
86
+     */
87
+    private $rawSize = 0;
88
+
89
+    /**
90
+     * @param string|boolean $path
91
+     * @param Storage\Storage $storage
92
+     * @param string $internalPath
93
+     * @param array|ICacheEntry $data
94
+     * @param \OCP\Files\Mount\IMountPoint $mount
95
+     * @param \OCP\IUser|null $owner
96
+     */
97
+    public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
98
+        $this->path = $path;
99
+        $this->storage = $storage;
100
+        $this->internalPath = $internalPath;
101
+        $this->data = $data;
102
+        $this->mount = $mount;
103
+        $this->owner = $owner;
104
+        $this->rawSize = $this->data['size'] ?? 0;
105
+    }
106
+
107
+    public function offsetSet($offset, $value) {
108
+        $this->data[$offset] = $value;
109
+    }
110
+
111
+    public function offsetExists($offset) {
112
+        return isset($this->data[$offset]);
113
+    }
114
+
115
+    public function offsetUnset($offset) {
116
+        unset($this->data[$offset]);
117
+    }
118
+
119
+    public function offsetGet($offset) {
120
+        if ($offset === 'type') {
121
+            return $this->getType();
122
+        } elseif ($offset === 'etag') {
123
+            return $this->getEtag();
124
+        } elseif ($offset === 'size') {
125
+            return $this->getSize();
126
+        } elseif ($offset === 'mtime') {
127
+            return $this->getMTime();
128
+        } elseif ($offset === 'permissions') {
129
+            return $this->getPermissions();
130
+        } elseif (isset($this->data[$offset])) {
131
+            return $this->data[$offset];
132
+        } else {
133
+            return null;
134
+        }
135
+    }
136
+
137
+    /**
138
+     * @return string
139
+     */
140
+    public function getPath() {
141
+        return $this->path;
142
+    }
143
+
144
+    /**
145
+     * @return \OCP\Files\Storage
146
+     */
147
+    public function getStorage() {
148
+        return $this->storage;
149
+    }
150
+
151
+    /**
152
+     * @return string
153
+     */
154
+    public function getInternalPath() {
155
+        return $this->internalPath;
156
+    }
157
+
158
+    /**
159
+     * Get FileInfo ID or null in case of part file
160
+     *
161
+     * @return int|null
162
+     */
163
+    public function getId() {
164
+        return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
165
+    }
166
+
167
+    /**
168
+     * @return string
169
+     */
170
+    public function getMimetype() {
171
+        return $this->data['mimetype'];
172
+    }
173
+
174
+    /**
175
+     * @return string
176
+     */
177
+    public function getMimePart() {
178
+        return $this->data['mimepart'];
179
+    }
180
+
181
+    /**
182
+     * @return string
183
+     */
184
+    public function getName() {
185
+        return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath());
186
+    }
187
+
188
+    /**
189
+     * @return string
190
+     */
191
+    public function getEtag() {
192
+        $this->updateEntryfromSubMounts();
193
+        if (count($this->childEtags) > 0) {
194
+            $combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
195
+            return md5($combinedEtag);
196
+        } else {
197
+            return $this->data['etag'];
198
+        }
199
+    }
200
+
201
+    /**
202
+     * @return int
203
+     */
204
+    public function getSize($includeMounts = true) {
205
+        if ($includeMounts) {
206
+            $this->updateEntryfromSubMounts();
207
+            return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
208
+        } else {
209
+            return $this->rawSize;
210
+        }
211
+    }
212
+
213
+    /**
214
+     * @return int
215
+     */
216
+    public function getMTime() {
217
+        $this->updateEntryfromSubMounts();
218
+        return (int) $this->data['mtime'];
219
+    }
220
+
221
+    /**
222
+     * @return bool
223
+     */
224
+    public function isEncrypted() {
225
+        return $this->data['encrypted'];
226
+    }
227
+
228
+    /**
229
+     * Return the currently version used for the HMAC in the encryption app
230
+     *
231
+     * @return int
232
+     */
233
+    public function getEncryptedVersion() {
234
+        return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
235
+    }
236
+
237
+    /**
238
+     * @return int
239
+     */
240
+    public function getPermissions() {
241
+        $perms = (int) $this->data['permissions'];
242
+        if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
243
+            $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
244
+        }
245
+        return (int) $perms;
246
+    }
247
+
248
+    /**
249
+     * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
250
+     */
251
+    public function getType() {
252
+        if (!isset($this->data['type'])) {
253
+            $this->data['type'] = ($this->getMimetype() === 'httpd/unix-directory') ? self::TYPE_FOLDER : self::TYPE_FILE;
254
+        }
255
+        return $this->data['type'];
256
+    }
257
+
258
+    public function getData() {
259
+        return $this->data;
260
+    }
261
+
262
+    /**
263
+     * @param int $permissions
264
+     * @return bool
265
+     */
266
+    protected function checkPermissions($permissions) {
267
+        return ($this->getPermissions() & $permissions) === $permissions;
268
+    }
269
+
270
+    /**
271
+     * @return bool
272
+     */
273
+    public function isReadable() {
274
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
275
+    }
276
+
277
+    /**
278
+     * @return bool
279
+     */
280
+    public function isUpdateable() {
281
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
282
+    }
283
+
284
+    /**
285
+     * Check whether new files or folders can be created inside this folder
286
+     *
287
+     * @return bool
288
+     */
289
+    public function isCreatable() {
290
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
291
+    }
292
+
293
+    /**
294
+     * @return bool
295
+     */
296
+    public function isDeletable() {
297
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
298
+    }
299
+
300
+    /**
301
+     * @return bool
302
+     */
303
+    public function isShareable() {
304
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
305
+    }
306
+
307
+    /**
308
+     * Check if a file or folder is shared
309
+     *
310
+     * @return bool
311
+     */
312
+    public function isShared() {
313
+        $sid = $this->getStorage()->getId();
314
+        if (!is_null($sid)) {
315
+            $sid = explode(':', $sid);
316
+            return ($sid[0] === 'shared');
317
+        }
318
+
319
+        return false;
320
+    }
321
+
322
+    public function isMounted() {
323
+        $storage = $this->getStorage();
324
+        if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
325
+            return false;
326
+        }
327
+        $sid = $storage->getId();
328
+        if (!is_null($sid)) {
329
+            $sid = explode(':', $sid);
330
+            return ($sid[0] !== 'home' and $sid[0] !== 'shared');
331
+        }
332
+
333
+        return false;
334
+    }
335
+
336
+    /**
337
+     * Get the mountpoint the file belongs to
338
+     *
339
+     * @return \OCP\Files\Mount\IMountPoint
340
+     */
341
+    public function getMountPoint() {
342
+        return $this->mount;
343
+    }
344
+
345
+    /**
346
+     * Get the owner of the file
347
+     *
348
+     * @return \OCP\IUser
349
+     */
350
+    public function getOwner() {
351
+        return $this->owner;
352
+    }
353
+
354
+    /**
355
+     * @param IMountPoint[] $mounts
356
+     */
357
+    public function setSubMounts(array $mounts) {
358
+        $this->subMounts = $mounts;
359
+    }
360
+
361
+    private function updateEntryfromSubMounts() {
362
+        if ($this->subMountsUsed) {
363
+            return;
364
+        }
365
+        $this->subMountsUsed = true;
366
+        foreach ($this->subMounts as $mount) {
367
+            $subStorage = $mount->getStorage();
368
+            if ($subStorage) {
369
+                $subCache = $subStorage->getCache('');
370
+                $rootEntry = $subCache->get('');
371
+                $this->addSubEntry($rootEntry, $mount->getMountPoint());
372
+            }
373
+        }
374
+    }
375
+
376
+    /**
377
+     * Add a cache entry which is the child of this folder
378
+     *
379
+     * Sets the size, etag and size to for cross-storage childs
380
+     *
381
+     * @param array|ICacheEntry $data cache entry for the child
382
+     * @param string $entryPath full path of the child entry
383
+     */
384
+    public function addSubEntry($data, $entryPath) {
385
+        $this->data['size'] += isset($data['size']) ? $data['size'] : 0;
386
+        if (isset($data['mtime'])) {
387
+            $this->data['mtime'] = max($this->data['mtime'], $data['mtime']);
388
+        }
389
+        if (isset($data['etag'])) {
390
+            // prefix the etag with the relative path of the subentry to propagate etag on mount moves
391
+            $relativeEntryPath = substr($entryPath, strlen($this->getPath()));
392
+            // attach the permissions to propagate etag on permision changes of submounts
393
+            $permissions = isset($data['permissions']) ? $data['permissions'] : 0;
394
+            $this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
395
+        }
396
+    }
397
+
398
+    /**
399
+     * @inheritdoc
400
+     */
401
+    public function getChecksum() {
402
+        return $this->data['checksum'];
403
+    }
404
+
405
+    public function getExtension(): string {
406
+        return pathinfo($this->getName(), PATHINFO_EXTENSION);
407
+    }
408
+
409
+    public function getCreationTime(): int {
410
+        return (int) $this->data['creation_time'];
411
+    }
412
+
413
+    public function getUploadTime(): int {
414
+        return (int) $this->data['upload_time'];
415
+    }
416 416
 }
Please login to merge, or discard this patch.
apps/dav/lib/Avatars/RootCollection.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@
 block discarded – undo
7 7
 
8 8
 class RootCollection extends AbstractPrincipalCollection {
9 9
 
10
-	/**
11
-	 * This method returns a node for a principal.
12
-	 *
13
-	 * The passed array contains principal information, and is guaranteed to
14
-	 * at least contain a uri item. Other properties may or may not be
15
-	 * supplied by the authentication backend.
16
-	 *
17
-	 * @param array $principalInfo
18
-	 * @return AvatarHome
19
-	 */
20
-	public function getChildForPrincipal(array $principalInfo) {
21
-		$avatarManager = \OC::$server->getAvatarManager();
22
-		return new AvatarHome($principalInfo, $avatarManager);
23
-	}
10
+    /**
11
+     * This method returns a node for a principal.
12
+     *
13
+     * The passed array contains principal information, and is guaranteed to
14
+     * at least contain a uri item. Other properties may or may not be
15
+     * supplied by the authentication backend.
16
+     *
17
+     * @param array $principalInfo
18
+     * @return AvatarHome
19
+     */
20
+    public function getChildForPrincipal(array $principalInfo) {
21
+        $avatarManager = \OC::$server->getAvatarManager();
22
+        return new AvatarHome($principalInfo, $avatarManager);
23
+    }
24 24
 
25
-	public function getName() {
26
-		return 'avatars';
27
-	}
25
+    public function getName() {
26
+        return 'avatars';
27
+    }
28 28
 
29 29
 }
Please login to merge, or discard this patch.