Skip to content

Commit 545f930

Browse files
ArtificialOwlbackportbot[bot]
authored andcommitted
fix(userconfig): crop configvalue at 64 before index
Signed-off-by: Maxence Lange <[email protected]>
1 parent ce5964c commit 545f930

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/private/Config/UserConfig.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,21 +1425,22 @@ public function updateGlobalIndexed(string $app, string $key, bool $indexed): vo
14251425

14261426
$update = $this->connection->getQueryBuilder();
14271427
$update->update('preferences')
1428-
// emptying field 'indexed' if key is not set as indexed anymore
1429-
->set('indexed', ($indexed) ? 'configvalue' : $update->createNamedParameter(''))
14301428
->where(
14311429
$update->expr()->eq('appid', $update->createNamedParameter($app)),
14321430
$update->expr()->eq('configkey', $update->createNamedParameter($key))
14331431
);
14341432

14351433
// switching flags 'indexed' on and off is about adding/removing the bit value on the correct entries
14361434
if ($indexed) {
1435+
$update->set('indexed', $update->func()->substring('configvalue', $update->createNamedParameter(1, IQueryBuilder::PARAM_INT), $update->createNamedParameter(64, IQueryBuilder::PARAM_INT)));
14371436
$update->set('flags', $update->func()->add('flags', $update->createNamedParameter(self::FLAG_INDEXED, IQueryBuilder::PARAM_INT)));
14381437
$update->andWhere(
14391438
$update->expr()->neq($update->expr()->castColumn(
14401439
$update->expr()->bitwiseAnd('flags', self::FLAG_INDEXED), IQueryBuilder::PARAM_INT), $update->createNamedParameter(self::FLAG_INDEXED, IQueryBuilder::PARAM_INT)
14411440
));
14421441
} else {
1442+
// emptying field 'indexed' if key is not set as indexed anymore
1443+
$update->set('indexed', $update->createNamedParameter(''));
14431444
$update->set('flags', $update->func()->subtract('flags', $update->createNamedParameter(self::FLAG_INDEXED, IQueryBuilder::PARAM_INT)));
14441445
$update->andWhere(
14451446
$update->expr()->eq($update->expr()->castColumn(

0 commit comments

Comments
 (0)