diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-11-26 19:51:29 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-11-26 19:51:49 +0100 |
commit | 6f48a74ead80c57e291ca2be78645449e99ae5f0 (patch) | |
tree | 783d228246b38fe135f772461958d00f56900ac0 /upgrade | |
parent | 050ca4af5a2c72ecd31305ed7b91afc4f411efa1 (diff) |
add autoupdate for indices
Diffstat (limited to 'upgrade')
-rw-r--r-- | upgrade/upgrade.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/upgrade/upgrade.php b/upgrade/upgrade.php new file mode 100644 index 000000000..45fcadfad --- /dev/null +++ b/upgrade/upgrade.php @@ -0,0 +1,49 @@ +<?php +/** + * ownCloud - 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; + +class Upgrade { + + /** @var IConfig */ + private $config; + + /** @var ItemService */ + private $itemService; + + private $appName; + + /** + * Upgrade constructor. + * @param IConfig $config + * @param $appName + */ + public function __construct(IConfig $config, ItemService $itemService, + $appName) { + $this->config = $config; + $this->appName = $appName; + $this->itemService = $itemService; + } + + public function upgrade() { + $previousVersion = $this->config->getAppValue( + $this->appName, 'installed_version' + ); + + if (version_compare($previousVersion, '7', '<')) { + $this->itemService->generateSearchIndices(); + } + } + +} |