summaryrefslogtreecommitdiffstats
path: root/lib/Migration
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Migration')
-rw-r--r--lib/Migration/MigrateConfig.php86
-rw-r--r--lib/Migration/MigrateStatusFlags.php67
2 files changed, 0 insertions, 153 deletions
diff --git a/lib/Migration/MigrateConfig.php b/lib/Migration/MigrateConfig.php
deleted file mode 100644
index 3cf444f50..000000000
--- a/lib/Migration/MigrateConfig.php
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/**
- * Nextcloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Sean Molenaar
- * @copyright Sean Molenaar <sean@seanmolenaar.eu> 2020
- */
-
-namespace OCA\News\Migration;
-
-use OCA\News\Config\LegacyConfig;
-use OCP\IConfig;
-use OCP\Migration\IRepairStep;
-use OCP\Migration\IOutput;
-
-class MigrateConfig implements IRepairStep
-{
-
- /**
- * @var LegacyConfig
- */
- private $config;
-
- /**
- * @var IConfig
- */
- private $iConfig;
-
- /**
- * Array of defaults
- *
- * @var array
- */
- private $defaults;
-
- /**
- * @param LegacyConfig $config
- * @param IConfig $iConfig
- */
- public function __construct(LegacyConfig $config, IConfig $iConfig)
- {
- $this->config = $config;
- $this->iConfig = $iConfig;
-
- // copied from Application::default_settings
- $this->defaults = [
- 'autoPurgeMinimumInterval' => 60,
- 'autoPurgeCount' => 200,
- 'maxRedirects' => 10,
- 'feedFetcherTimeout' => 60,
- 'useCronUpdates' => true,
- 'exploreUrl' => '',
- 'updateInterval' => 3600,
- ];
- }
-
- public function getName()
- {
- return 'Migrate config to nextcloud managed config';
- }
-
- /**
- * @return void
- */
- public function run(IOutput $output)
- {
- $version = $this->iConfig->getAppValue('news', 'installed_version', '0.0.0');
- if (version_compare($version, '15.0.6', '>')) {
- return;
- }
-
- $app_keys = $this->iConfig->getAppKeys('news');
- foreach ($this->config as $key => $value) {
- if (!isset($this->defaults[$key])) {
- continue;
- }
- if (in_array($key, $app_keys)) {
- continue;
- }
- $this->iConfig->setAppValue('news', $key, $value);
- }
- }
-}
diff --git a/lib/Migration/MigrateStatusFlags.php b/lib/Migration/MigrateStatusFlags.php
deleted file mode 100644
index ac5c8ebe4..000000000
--- a/lib/Migration/MigrateStatusFlags.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * Nextcloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Daniel Opitz <dev@copynpaste.de>
- * @copyright Daniel Opitz 2017
- */
-
-namespace OCA\News\Migration;
-
-use OCP\DB\QueryBuilder\IQueryBuilder;
-use OCP\IConfig;
-use OCP\IDBConnection;
-use OCP\Migration\IRepairStep;
-use OCP\Migration\IOutput;
-
-class MigrateStatusFlags implements IRepairStep
-{
-
- /**
- * @var IDBConnection
- */
- private $db;
-
- /**
- * @var IConfig
- */
- private $config;
-
- /**
- * @param IDBConnection $db
- * @param IConfig $config
- */
- public function __construct(IDBConnection $db, IConfig $config)
- {
- $this->db = $db;
- $this->config = $config;
- }
-
- public function getName()
- {
- return 'Migrate binary status into separate boolean fields';
- }
-
- /**
- * @return void
- */
- public function run(IOutput $output)
- {
- $version = $this->config->getAppValue('news', 'installed_version', '0.0.0');
- if (version_compare($version, '11.0.6', '>=')) {
- return;
- }
-
- $sql = 'UPDATE `*PREFIX*news_items` '
- . 'SET `unread` = ((`status` & 2) = 2), '
- . '`starred` = ((`status` & 4) = 4)';
- $query = $this->db->prepare($sql);
-
- if (!$query->execute()) {
- throw new \Exception('Could not migrate status');
- }
- }
-}