summaryrefslogtreecommitdiffstats
path: root/lib/Settings
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2020-09-20 22:03:05 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2020-09-25 19:18:04 +0200
commit60ab4941cc7e6ede095e9e4aee3c2bf9a5c3bff6 (patch)
treebaf0b07dd1c545efeb59437af46a99f4d9f69425 /lib/Settings
parent2c8b4fa019749113658b9ed8cae211b679e4cbc0 (diff)
Move to nextcloud config and update phpunit
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'lib/Settings')
-rw-r--r--lib/Settings/Admin.php44
-rw-r--r--lib/Settings/AdminSettings.php47
2 files changed, 47 insertions, 44 deletions
diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php
deleted file mode 100644
index e8c9a0cb2..000000000
--- a/lib/Settings/Admin.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-namespace OCA\News\Settings;
-
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Settings\ISettings;
-
-use OCA\News\Config\Config;
-
-class Admin implements ISettings
-{
- private $config;
-
- public function __construct(Config $config)
- {
- $this->config = $config;
- }
-
- public function getForm()
- {
- $data = [
- 'autoPurgeMinimumInterval' =>
- $this->config->getAutoPurgeMinimumInterval(),
- 'autoPurgeCount' => $this->config->getAutoPurgeCount(),
- 'maxRedirects' => $this->config->getMaxRedirects(),
- 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(),
- 'useCronUpdates' => $this->config->getUseCronUpdates(),
- 'maxSize' => $this->config->getMaxSize(),
- 'exploreUrl' => $this->config->getExploreUrl(),
- 'updateInterval' => $this->config->getUpdateInterval(),
- ];
- return new TemplateResponse('news', 'admin', $data, '');
- }
-
- public function getSection()
- {
- return 'news';
- }
-
- public function getPriority()
- {
- return 40;
- }
-}
diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php
new file mode 100644
index 000000000..1f3d98c08
--- /dev/null
+++ b/lib/Settings/AdminSettings.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace OCA\News\Settings;
+
+use OCA\News\AppInfo\Application;
+use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IConfig;
+use OCP\Settings\ISettings;
+
+class AdminSettings implements ISettings
+{
+
+ /**
+ * @var IConfig
+ */
+ private $config;
+
+ public function __construct(IConfig $config)
+ {
+ $this->config = $config;
+ }
+
+ public function getForm()
+ {
+ $data = [];
+
+ foreach (array_keys(Application::DEFAULT_SETTINGS) as $setting) {
+ $data[$setting] = $this->config->getAppValue(
+ Application::NAME,
+ $setting,
+ Application::DEFAULT_SETTINGS[$setting]
+ );
+ }
+
+ return new TemplateResponse(Application::NAME, 'admin', $data);
+ }
+
+ public function getSection()
+ {
+ return 'news';
+ }
+
+ public function getPriority()
+ {
+ return 40;
+ }
+}