Skip to content

Commit bb02c29

Browse files
committed
add repair step to clean up DB off lastFeatureRefresh entries in user prefs
- also removes related app setting "updateAttributesInterval" Signed-off-by: Arthur Schiwon <[email protected]>
1 parent 699871d commit bb02c29

File tree

4 files changed

+69
-1
lines changed

4 files changed

+69
-1
lines changed

apps/user_ldap/appinfo/info.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
A user logs into Nextcloud with their LDAP or AD credentials, and is granted access based on an authentication request handled by the LDAP or AD server. Nextcloud does not store LDAP or AD passwords, rather these credentials are used to authenticate a user and then Nextcloud uses a session for the user ID. More information is available in the LDAP User and Group Backend documentation.
1010

1111
</description>
12-
<version>1.10.1</version>
12+
<version>1.10.2</version>
1313
<licence>agpl</licence>
1414
<author>Dominik Schmidt</author>
1515
<author>Arthur Schiwon</author>
@@ -36,6 +36,7 @@ A user logs into Nextcloud with their LDAP or AD credentials, and is granted acc
3636
<repair-steps>
3737
<post-migration>
3838
<step>OCA\User_LDAP\Migration\UUIDFixInsert</step>
39+
<step>OCA\User_LDAP\Migration\RmRefreshTime</step>
3940
</post-migration>
4041
</repair-steps>
4142

apps/user_ldap/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
'OCA\\User_LDAP\\Mapping\\AbstractMapping' => $baseDir . '/../lib/Mapping/AbstractMapping.php',
5151
'OCA\\User_LDAP\\Mapping\\GroupMapping' => $baseDir . '/../lib/Mapping/GroupMapping.php',
5252
'OCA\\User_LDAP\\Mapping\\UserMapping' => $baseDir . '/../lib/Mapping/UserMapping.php',
53+
'OCA\\User_LDAP\\Migration\\RmRefreshTime' => $baseDir . '/../lib/Migration/RmRefreshTime.php',
5354
'OCA\\User_LDAP\\Migration\\UUIDFix' => $baseDir . '/../lib/Migration/UUIDFix.php',
5455
'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => $baseDir . '/../lib/Migration/UUIDFixGroup.php',
5556
'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => $baseDir . '/../lib/Migration/UUIDFixInsert.php',

apps/user_ldap/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class ComposerStaticInitUser_LDAP
6565
'OCA\\User_LDAP\\Mapping\\AbstractMapping' => __DIR__ . '/..' . '/../lib/Mapping/AbstractMapping.php',
6666
'OCA\\User_LDAP\\Mapping\\GroupMapping' => __DIR__ . '/..' . '/../lib/Mapping/GroupMapping.php',
6767
'OCA\\User_LDAP\\Mapping\\UserMapping' => __DIR__ . '/..' . '/../lib/Mapping/UserMapping.php',
68+
'OCA\\User_LDAP\\Migration\\RmRefreshTime' => __DIR__ . '/..' . '/../lib/Migration/RmRefreshTime.php',
6869
'OCA\\User_LDAP\\Migration\\UUIDFix' => __DIR__ . '/..' . '/../lib/Migration/UUIDFix.php',
6970
'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixGroup.php',
7071
'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixInsert.php',
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* @copyright Copyright (c) 2020 Arthur Schiwon <[email protected]>
6+
*
7+
* @author Arthur Schiwon <[email protected]>
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

Comments
 (0)