|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | +/** |
| 5 | + * @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de> |
| 6 | + * |
| 7 | + * @author Arthur Schiwon <blizzz@arthur-schiwon.de> |
| 8 | + * |
| 9 | + * @license GNU AGPL version 3 or any later version |
| 10 | + * |
| 11 | + * This program is free software: you can redistribute it and/or modify |
| 12 | + * it under the terms of the GNU Affero General Public License as |
| 13 | + * published by the Free Software Foundation, either version 3 of the |
| 14 | + * License, or (at your option) any later version. |
| 15 | + * |
| 16 | + * This program is distributed in the hope that it will be useful, |
| 17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | + * GNU Affero General Public License for more details. |
| 20 | + * |
| 21 | + * You should have received a copy of the GNU Affero General Public License |
| 22 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | + * |
| 24 | + */ |
| 25 | + |
| 26 | +namespace OCA\User_LDAP\Migration; |
| 27 | + |
| 28 | +use OCP\IConfig; |
| 29 | +use OCP\IDBConnection; |
| 30 | +use OCP\Migration\IOutput; |
| 31 | +use OCP\Migration\IRepairStep; |
| 32 | + |
| 33 | +/** |
| 34 | + * Class RmRefreshTime |
| 35 | + * |
| 36 | + * this can be removed with Nextcloud 21 |
| 37 | + * |
| 38 | + * @package OCA\User_LDAP\Migration |
| 39 | + */ |
| 40 | +class RmRefreshTime implements IRepairStep { |
| 41 | + |
| 42 | + /** @var IDBConnection */ |
| 43 | + private $dbc; |
| 44 | + /** @var IConfig */ |
| 45 | + private $config; |
| 46 | + |
| 47 | + public function __construct(IDBConnection $dbc, IConfig $config) { |
| 48 | + $this->dbc = $dbc; |
| 49 | + $this->config = $config; |
| 50 | + } |
| 51 | + |
| 52 | + public function getName() { |
| 53 | + return 'Remove deprecated refresh time markers for LDAP user records'; |
| 54 | + } |
| 55 | + |
| 56 | + public function run(IOutput $output) { |
| 57 | + $this->config->deleteAppValue('user_ldap', 'updateAttributesInterval'); |
| 58 | + |
| 59 | + $qb = $this->dbc->getQueryBuilder(); |
| 60 | + $qb->delete('preferences') |
| 61 | + ->where($qb->expr()->eq('appid', $qb->createNamedParameter('user_ldap'))) |
| 62 | + ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lastFeatureRefresh'))) |
| 63 | + ->execute(); |
| 64 | + } |
| 65 | +} |
0 commit comments