Skip to content

Commit bd589e8

Browse files
committed
Use getSystemValueString to fetch instanceid
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
1 parent 5305ee2 commit bd589e8

9 files changed

Lines changed: 16 additions & 16 deletions

File tree

apps/encryption/lib/Crypto/Crypt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ private function addPadding($data) {
374374
* @return string
375375
*/
376376
protected function generatePasswordHash($password, $cipher, $uid = '') {
377-
$instanceId = $this->config->getSystemValue('instanceid');
377+
$instanceId = $this->config->getSystemValueString('instanceid');
378378
$instanceSecret = $this->config->getSystemValueString('secret');
379379
$salt = hash('sha256', $uid . $instanceId . $instanceSecret, true);
380380
$keySize = $this->getKeySize($cipher);

apps/files/lib/Command/ScanAppData.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ protected function reconnectToDatabase(OutputInterface $output): Connection {
266266
* @throws NotFoundException
267267
*/
268268
private function getAppDataFolder() {
269-
$instanceId = $this->config->getSystemValue('instanceid', null);
269+
$instanceId = $this->config->getSystemValueString('instanceid');
270270

271-
if ($instanceId === null) {
271+
if ($instanceId === '') {
272272
throw new NotFoundException();
273273
}
274274

core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public function __construct(IConfig $config, LoggerInterface $log, ITimeFactory
4646
*/
4747
public function run($arguments) {
4848
$updateDir = $this->config->getSystemValue('updatedirectory', null) ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
49-
$instanceId = $this->config->getSystemValue('instanceid', null);
49+
$instanceId = $this->config->getSystemValueString('instanceid');
5050

51-
if (!is_string($instanceId) || empty($instanceId)) {
51+
if ($instanceId === '') {
5252
return;
5353
}
5454

lib/private/Encryption/Util.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function __construct(
9494
$this->config = $config;
9595

9696
$this->excludedPaths[] = 'files_encryption';
97-
$this->excludedPaths[] = 'appdata_' . $config->getSystemValue('instanceid', null);
97+
$this->excludedPaths[] = 'appdata_' . $config->getSystemValueString('instanceid');
9898
$this->excludedPaths[] = 'files_external';
9999
}
100100

lib/private/Repair/MoveUpdaterStepFile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public function getName() {
4444

4545
public function run(IOutput $output) {
4646
$updateDir = $this->config->getSystemValue('updatedirectory', null) ?? $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
47-
$instanceId = $this->config->getSystemValue('instanceid', null);
47+
$instanceId = $this->config->getSystemValueString('instanceid');
4848

49-
if (!is_string($instanceId) || empty($instanceId)) {
49+
if ($instanceId === '') {
5050
return;
5151
}
5252

lib/private/Repair/NC25/AddMissingSecretJob.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function getName(): string {
4242
}
4343

4444
public function run(IOutput $output): void {
45-
$passwordSalt = $this->config->getSystemValue('passwordsalt', null);
46-
if ($passwordSalt === null || $passwordSalt === '') {
45+
$passwordSalt = $this->config->getSystemValueString('passwordsalt');
46+
if ($passwordSalt === '') {
4747
try {
4848
$this->config->setSystemValue('passwordsalt', $this->random->generate(30));
4949
} catch (HintException $e) {

lib/private/Security/IdentityProof/Manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ public function getKey(IUser $user): Key {
153153
* @throws \RuntimeException
154154
*/
155155
public function getSystemKey(): Key {
156-
$instanceId = $this->config->getSystemValue('instanceid', null);
157-
if ($instanceId === null) {
156+
$instanceId = $this->config->getSystemValueString('instanceid');
157+
if ($instanceId === '') {
158158
throw new \RuntimeException('no instance id!');
159159
}
160160
return $this->retrieveKey('system-' . $instanceId);

lib/private/legacy/OC_Util.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) {
202202
}
203203
}
204204

205-
$instanceId = \OC::$server->getConfig()->getSystemValue('instanceid', '');
205+
$instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid');
206206

207-
if ($instanceId === null) {
207+
if ($instanceId === '') {
208208
throw new \RuntimeException('no instance id!');
209209
}
210210
$appdata = 'appdata_' . $instanceId;

tests/lib/Security/IdentityProof/ManagerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function testGetSystemKey() {
210210
/** @var Key|\PHPUnit\Framework\MockObject\MockObject $key */
211211
$key = $this->createMock(Key::class);
212212

213-
$this->config->expects($this->once())->method('getSystemValue')
213+
$this->config->expects($this->once())->method('getSystemValueString')
214214
->with('instanceid', null)->willReturn('instanceId');
215215

216216
$manager->expects($this->once())->method('retrieveKey')->with('system-instanceId')
@@ -229,7 +229,7 @@ public function testGetSystemKeyFailure() {
229229
/** @var Key|\PHPUnit\Framework\MockObject\MockObject $key */
230230
$key = $this->createMock(Key::class);
231231

232-
$this->config->expects($this->once())->method('getSystemValue')
232+
$this->config->expects($this->once())->method('getSystemValueString')
233233
->with('instanceid', null)->willReturn(null);
234234

235235
$manager->getSystemKey();

0 commit comments

Comments
 (0)