Skip to content

Commit be74c03

Browse files
authored
Merge pull request #39276 from nextcloud/fix/noid/full-upper-const
2 parents e79d426 + 2f41b9c commit be74c03

File tree

9 files changed

+20
-17
lines changed

9 files changed

+20
-17
lines changed

apps/files_external/lib/Command/Applicable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9191
return Response::HTTP_NOT_FOUND;
9292
}
9393

94-
if ($mount->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) {
94+
if ($mount->getType() === StorageConfig::MOUNT_TYPE_PERSONAL) {
9595
$output->writeln('<error>Can\'t change applicables on personal mounts</error>');
9696
return self::FAILURE;
9797
}

apps/files_external/lib/Config/ConfigAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader) {
140140
}, $storages, $storageConfigs);
141141

142142
$mounts = array_map(function (StorageConfig $storageConfig, Storage\IStorage $storage) use ($user, $loader) {
143-
if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) {
143+
if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAL) {
144144
return new PersonalMount(
145145
$this->userStoragesService,
146146
$storageConfig,

apps/files_external/lib/Controller/StoragesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public function show($id, $testOnly = true) {
307307

308308
$data = $storage->jsonSerialize(true);
309309
$isAdmin = $this->groupManager->isAdmin($this->userSession->getUser()->getUID());
310-
$data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAl || $isAdmin;
310+
$data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAL || $isAdmin;
311311

312312
return new DataResponse(
313313
$data,

apps/files_external/lib/Controller/UserGlobalStoragesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function show($id, $testOnly = true) {
138138

139139
$data = $storage->jsonSerialize(true);
140140
$isAdmin = $this->groupManager->isAdmin($this->userSession->getUser()->getUID());
141-
$data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAl || $isAdmin;
141+
$data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAL || $isAdmin;
142142

143143
return new DataResponse(
144144
$data,

apps/files_external/lib/Lib/StorageConfig.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
*/
4141
class StorageConfig implements \JsonSerializable {
4242
public const MOUNT_TYPE_ADMIN = 1;
43+
public const MOUNT_TYPE_PERSONAL = 2;
44+
/** @deprecated use MOUNT_TYPE_PERSONAL (full uppercase) instead */
4345
public const MOUNT_TYPE_PERSONAl = 2;
4446

4547
/**
@@ -384,14 +386,14 @@ public function setStatus($status, $message = null) {
384386
}
385387

386388
/**
387-
* @return int self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAl
389+
* @return int self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAL
388390
*/
389391
public function getType() {
390392
return $this->type;
391393
}
392394

393395
/**
394-
* @param int $type self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAl
396+
* @param int $type self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAL
395397
*/
396398
public function setType($type) {
397399
$this->type = $type;
@@ -435,7 +437,7 @@ public function jsonSerialize(bool $obfuscate = false): array {
435437
$result['statusMessage'] = $this->statusMessage;
436438
}
437439
$result['userProvided'] = $this->authMechanism instanceof IUserProvided;
438-
$result['type'] = ($this->getType() === self::MOUNT_TYPE_PERSONAl) ? 'personal': 'system';
440+
$result['type'] = ($this->getType() === self::MOUNT_TYPE_PERSONAL) ? 'personal': 'system';
439441
return $result;
440442
}
441443

apps/files_external/lib/Service/DBConfigService.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
*/
3838
class DBConfigService {
3939
public const MOUNT_TYPE_ADMIN = 1;
40+
public const MOUNT_TYPE_PERSONAL = 2;
41+
/** @deprecated use MOUNT_TYPE_PERSONAL (full uppercase) instead */
4042
public const MOUNT_TYPE_PERSONAl = 2;
4143

4244
public const APPLICABLE_TYPE_GLOBAL = 1;
@@ -234,7 +236,7 @@ public function getAdminMountsForMultiple($type, array $values) {
234236
public function getUserMountsFor($type, $value) {
235237
$builder = $this->connection->getQueryBuilder();
236238
$query = $this->getForQuery($builder, $type, $value);
237-
$query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_PERSONAl, IQueryBuilder::PARAM_INT)));
239+
$query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_PERSONAL, IQueryBuilder::PARAM_INT)));
238240

239241
return $this->getMountsFromQuery($query);
240242
}

apps/files_external/lib/Service/UserStoragesService.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use OC\Files\Filesystem;
3232
use OCA\Files_External\Lib\StorageConfig;
3333
use OCA\Files_External\NotFoundException;
34-
3534
use OCP\EventDispatcher\IEventDispatcher;
3635
use OCP\Files\Config\IUserMountCache;
3736
use OCP\IUserSession;
@@ -103,7 +102,7 @@ protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $
103102
}
104103

105104
protected function getType() {
106-
return DBConfigService::MOUNT_TYPE_PERSONAl;
105+
return DBConfigService::MOUNT_TYPE_PERSONAL;
107106
}
108107

109108
/**
@@ -144,7 +143,7 @@ public function getVisibilityType() {
144143
}
145144

146145
protected function isApplicable(StorageConfig $config) {
147-
return ($config->getApplicableUsers() === [$this->getUser()->getUID()]) && $config->getType() === StorageConfig::MOUNT_TYPE_PERSONAl;
146+
return ($config->getApplicableUsers() === [$this->getUser()->getUID()]) && $config->getType() === StorageConfig::MOUNT_TYPE_PERSONAL;
148147
}
149148

150149
public function removeStorage($id) {

apps/files_external/tests/Auth/Password/GlobalAuth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function testNoCredentialsPersonal() {
113113
$this->credentialsManager->expects($this->never())
114114
->method('retrieve');
115115

116-
$storage = $this->getStorageConfig(StorageConfig::MOUNT_TYPE_PERSONAl);
116+
$storage = $this->getStorageConfig(StorageConfig::MOUNT_TYPE_PERSONAL);
117117

118118
$this->instance->manipulateStorageConfig($storage);
119119
$this->assertEquals([], $storage->getBackendOptions());

apps/files_external/tests/Service/DBConfigServiceTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function testGetMountsFor() {
198198

199199
public function testGetAdminMounts() {
200200
$id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN);
201-
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
201+
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
202202

203203
$mounts = $this->dbConfig->getAdminMounts();
204204
$this->assertCount(1, $mounts);
@@ -208,7 +208,7 @@ public function testGetAdminMounts() {
208208
public function testGetAdminMountsFor() {
209209
$id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN);
210210
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_ADMIN);
211-
$id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
211+
$id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
212212

213213
$this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_USER, 'test');
214214
$this->dbConfig->addApplicable($id3, DBConfigService::APPLICABLE_TYPE_USER, 'test');
@@ -221,8 +221,8 @@ public function testGetAdminMountsFor() {
221221

222222
public function testGetUserMountsFor() {
223223
$id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN);
224-
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
225-
$id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
224+
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
225+
$id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
226226

227227
$this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_USER, 'test');
228228
$this->dbConfig->addApplicable($id3, DBConfigService::APPLICABLE_TYPE_USER, 'test');
@@ -285,7 +285,7 @@ public function testGetMountsForDuplicateByGroup() {
285285

286286
public function testGetAllMounts() {
287287
$id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN);
288-
$id2 = $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
288+
$id2 = $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
289289

290290
$mounts = $this->dbConfig->getAllMounts();
291291
$this->assertCount(2, $mounts);

0 commit comments

Comments
 (0)