Skip to content

Commit

Permalink
AllConfig.php backport fix to v25
Browse files Browse the repository at this point in the history
  • Loading branch information
rhtot committed Dec 6, 2023
1 parent 13f348b commit 0a7a13a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/private/AllConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,15 @@ public function getUsersForUserValue($appName, $key, $value) {
$this->fixDIInit();

$qb = $this->connection->getQueryBuilder();
$configValueColumn = $this->getSystemValue('dbtype', 'sqlite') === 'oci'
? $qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR)
: 'configvalue';
$result = $qb->select('userid')
->from('preferences')
->where($qb->expr()->eq('appid', $qb->createNamedParameter($appName, IQueryBuilder::PARAM_STR)))
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key, IQueryBuilder::PARAM_STR)))
->andWhere($qb->expr()->eq(
$qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR),
$configValueColumn,
$qb->createNamedParameter($value, IQueryBuilder::PARAM_STR))
)->orderBy('userid')
->executeQuery();
Expand Down Expand Up @@ -524,13 +527,18 @@ public function getUsersForUserValueCaseInsensitive($appName, $key, $value) {
// Email address is always stored lowercase in the database
return $this->getUsersForUserValue($appName, $key, strtolower($value));
}

$qb = $this->connection->getQueryBuilder();
$configValueColumn = $this->getSystemValue('dbtype', 'sqlite') === 'oci'
? $qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR)
: 'configvalue';

$result = $qb->select('userid')
->from('preferences')
->where($qb->expr()->eq('appid', $qb->createNamedParameter($appName, IQueryBuilder::PARAM_STR)))
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key, IQueryBuilder::PARAM_STR)))
->andWhere($qb->expr()->eq(
$qb->func()->lower($qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR)),
$qb->func()->lower($configValueColumn),
$qb->createNamedParameter(strtolower($value), IQueryBuilder::PARAM_STR))
)->orderBy('userid')
->executeQuery();
Expand Down

0 comments on commit 0a7a13a

Please sign in to comment.