summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appinfo/update.php17
-rw-r--r--lib/Upgrade/Upgrade.php71
-rw-r--r--tests/Unit/Upgrade/UpgradeTest.php72
3 files changed, 0 insertions, 160 deletions
diff --git a/appinfo/update.php b/appinfo/update.php
deleted file mode 100644
index 521fb5ddb..000000000
--- a/appinfo/update.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/**
- * Nextcloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Bernhard Posselt 2015
- */
-
-namespace OCA\News\AppInfo;
-
-use OCA\News\Upgrade\Upgrade;
-
-$app = new Application();
-$app->getContainer()->query(Upgrade::class)->upgrade();
diff --git a/lib/Upgrade/Upgrade.php b/lib/Upgrade/Upgrade.php
deleted file mode 100644
index de2437954..000000000
--- a/lib/Upgrade/Upgrade.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/**
- * Nextcloud - News
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Bernhard Posselt 2015
- */
-
-namespace OCA\News\Upgrade;
-
-use OCP\IConfig;
-use OCA\News\Service\ItemService;
-use OCP\IDBConnection;
-
-class Upgrade {
-
- /** @var IConfig */
- private $config;
-
- /** @var ItemService */
- private $itemService;
-
- private $appName;
- /**
- * @var IDBConnection
- */
- private $db;
-
- /**
- * Upgrade constructor.
- * @param IConfig $config
- * @param $appName
- */
- public function __construct(IConfig $config, ItemService $itemService,
- IDBConnection $db, $appName) {
- $this->config = $config;
- $this->appName = $appName;
- $this->itemService = $itemService;
- $this->db = $db;
- }
-
- public function upgrade() {
- $previousVersion = $this->config->getAppValue(
- $this->appName, 'installed_version'
- );
-
- if (version_compare($previousVersion, '8.9.0', '<=')) {
- $this->itemService->generateSearchIndices();
- }
- }
-
- public function preUpgrade() {
- $previousVersion = $this->config->getAppValue(
- $this->appName, 'installed_version'
- );
-
- $dbType = $this->config->getSystemValue('dbtype');
- if (version_compare($previousVersion, '8.2.2', '<') &&
- $dbType !== 'sqlite3'
- ) {
- $sql = 'ALTER TABLE `*PREFIX*news_feeds` DROP COLUMN
- `last_modified`';
- $query = $this->db->prepare($sql);
- $query->execute();
- }
- }
-
-}
diff --git a/tests/Unit/Upgrade/UpgradeTest.php b/tests/Unit/Upgrade/UpgradeTest.php
deleted file mode 100644
index a3d473b63..000000000
--- a/tests/Unit/Upgrade/UpgradeTest.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/**
- * Created by IntelliJ IDEA.
- * User: bernhard
- * Date: 11/26/15
- * Time: 7:40 PM
- */
-
-namespace OCA\News\Upgrade;
-
-use OCP\IConfig;
-use OCA\News\Service\ItemService;
-
-class UpgradeTest extends \PHPUnit_Framework_TestCase {
-
- /** @var Upgrade */
- private $upgrade;
-
- /** @var ItemService */
- private $service;
-
- /** @var IConfig */
- private $config;
-
- /** @var IDBConnection */
- private $db;
-
- public function setUp() {
- $this->config = $this->getMockBuilder(
- '\OCP\IConfig')
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->db = $this->getMockBuilder(
- '\OCP\IDBConnection')
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->service = $this->getMockBuilder(
- '\OCA\News\Service\ItemService')
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->upgrade = new Upgrade($this->config, $this->service,
- $this->db, 'news');
- }
-
- public function testUpgrade() {
- $this->config->expects($this->once())
- ->method('getAppValue')
- ->with($this->equalTo('news'), $this->equalTo('installed_version'))
- ->will($this->returnValue('8.9.0'));
-
- $this->service->expects($this->once())
- ->method('generateSearchIndices');
-
- $this->upgrade->upgrade();
- }
-
- public function testNoUpgrade() {
- $this->config->expects($this->once())
- ->method('getAppValue')
- ->with($this->equalTo('news'), $this->equalTo('installed_version'))
- ->will($this->returnValue('8.9.1'));
-
- $this->service->expects($this->never())
- ->method('generateSearchIndices');
-
- $this->upgrade->upgrade();
- }
-
-}