summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/Migration
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-09-04 10:51:41 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-09-04 12:59:57 +0200
commitaa2d754d5cf101ce05ed65e9510246dcde61d07b (patch)
tree3389f0b788911f29c3f08c5ae239900ceca42013 /apps/user_ldap/lib/Migration
parent699871dcb04d1ac64b8b3538083b77f1c937b817 (diff)
downloadnextcloud-server-aa2d754d5cf101ce05ed65e9510246dcde61d07b.tar.gz
nextcloud-server-aa2d754d5cf101ce05ed65e9510246dcde61d07b.zip
add repair step to clean up DB off lastFeatureRefresh entries in user prefs
- also removes related app setting "updateAttributesInterval" Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Migration')
-rw-r--r--apps/user_ldap/lib/Migration/RemoveRefreshTime.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/Migration/RemoveRefreshTime.php b/apps/user_ldap/lib/Migration/RemoveRefreshTime.php
new file mode 100644
index 00000000000..b4b4e2c2628
--- /dev/null
+++ b/apps/user_ldap/lib/Migration/RemoveRefreshTime.php
@@ -0,0 +1,65 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\User_LDAP\Migration;
+
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
+
+/**
+ * Class RmRefreshTime
+ *
+ * this can be removed with Nextcloud 21
+ *
+ * @package OCA\User_LDAP\Migration
+ */
+class RemoveRefreshTime implements IRepairStep {
+
+ /** @var IDBConnection */
+ private $dbc;
+ /** @var IConfig */
+ private $config;
+
+ public function __construct(IDBConnection $dbc, IConfig $config) {
+ $this->dbc = $dbc;
+ $this->config = $config;
+ }
+
+ public function getName() {
+ return 'Remove deprecated refresh time markers for LDAP user records';
+ }
+
+ public function run(IOutput $output) {
+ $this->config->deleteAppValue('user_ldap', 'updateAttributesInterval');
+
+ $qb = $this->dbc->getQueryBuilder();
+ $qb->delete('preferences')
+ ->where($qb->expr()->eq('appid', $qb->createNamedParameter('user_ldap')))
+ ->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lastFeatureRefresh')))
+ ->execute();
+ }
+}