You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Version24000Date20211210141942.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Core\Migrations;
  8. use Closure;
  9. use OCP\IDBConnection;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. /**
  13. * Email addresses are case insensitive
  14. * But previously a user could enter any casing of the email address
  15. * and we would in case of a login lower case the input and the database value.
  16. *
  17. */
  18. class Version24000Date20211210141942 extends SimpleMigrationStep {
  19. public function __construct(
  20. protected IDBConnection $connection,
  21. ) {
  22. }
  23. /**
  24. * @param IOutput $output
  25. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  26. * @param array $options
  27. */
  28. public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
  29. $update = $this->connection->getQueryBuilder();
  30. $update->update('preferences')
  31. ->set('configvalue', $update->func()->lower('configvalue'))
  32. ->where($update->expr()->eq('appid', $update->createNamedParameter('settings')))
  33. ->andWhere($update->expr()->eq('configkey', $update->createNamedParameter('email')));
  34. $update->executeStatement();
  35. }
  36. }