Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Sep 2, 2024
1 parent 99516e9 commit 32c209d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions core/Migrations/Version31000Date20240814184402.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#[AddColumn(table: 'preferences', name: 'lazy', type: ColumnType::SMALLINT, description: 'lazy loading to user preferences')]
#[AddColumn(table: 'preferences', name: 'type', type: ColumnType::SMALLINT, description: 'typed values to user preferences')]
#[AddIndex(table: 'preferences', type: IndexType::INDEX, description: 'new index including lazy flag')]
#[AddIndex(table: 'preferences', type: IndexType::INDEX, description: 'new index including config value to improve searchUsersByValue')]
class Version31000Date20240814184402 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
Expand All @@ -34,7 +33,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
$table->addColumn('lazy', Types::SMALLINT, ['notnull' => true, 'default' => 0, 'length' => 1, 'unsigned' => true]);
$table->addColumn('type', Types::INTEGER, ['notnull' => true, 'default' => 2, 'unsigned' => true]);
$table->addIndex(['userid', 'lazy'], 'prefs_uid_lazy_i');
$table->addIndex(['appid', 'configkey', 'configvalue'], 'prefs_app_key_value_i');

return $schema;
}
Expand Down
7 changes: 4 additions & 3 deletions lib/private/UserPreferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,16 +386,17 @@ public function searchUsersByValueString(string $app, string $key, string|array
$qb->where($qb->expr()->eq('appid', $qb->createNamedParameter($app)));
$qb->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key)));

$configValueColumn = ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) ? $qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR) : 'configvalue';
if (is_array($value)) {
$qb->andWhere($qb->expr()->in('configvalue', $qb->createNamedParameter($value, IQueryBuilder::PARAM_STR_ARRAY)));
$qb->andWhere($qb->expr()->in($configValueColumn, $qb->createNamedParameter($value, IQueryBuilder::PARAM_STR_ARRAY)));
} else {
if ($caseInsensitive) {
$qb->andWhere($qb->expr()->eq(
$qb->func()->lower('configvalue'),
$qb->func()->lower($configValueColumn),
$qb->createNamedParameter(strtolower($value)))
);
} else {
$qb->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($value)));
$qb->andWhere($qb->expr()->eq($configValueColumn, $qb->createNamedParameter($value)));
}
}

Expand Down

0 comments on commit 32c209d

Please sign in to comment.