From 004fcbbcc7609ca83807f2e38967ef54f469bf72 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 23 Jul 2016 21:24:54 +0200 Subject: Move to new directory structure --- lib/Service/StatusService.php | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 lib/Service/StatusService.php (limited to 'lib/Service/StatusService.php') diff --git a/lib/Service/StatusService.php b/lib/Service/StatusService.php new file mode 100644 index 000000000..b36e64c1b --- /dev/null +++ b/lib/Service/StatusService.php @@ -0,0 +1,57 @@ + + * @author Bernhard Posselt + * @copyright Alessandro Cosentino 2012 + * @copyright Bernhard Posselt 2012, 2014 + */ + +namespace OCA\News\Service; + +use OCP\IConfig; + +use OCA\News\Config\Config; + + +class StatusService { + + private $settings; + private $config; + private $appName; + + public function __construct(IConfig $settings, Config $config, $AppName) { + $this->settings = $settings; + $this->config = $config; + $this->appName = $AppName; + } + + public function isProperlyConfigured() { + $cronMode = $this->settings->getAppValue( + 'core', 'backgroundjobs_mode' + ); + $cronOff = !$this->config->getUseCronUpdates(); + + // check for cron modes which may lead to problems + return $cronMode === 'cron' || $cronOff; + } + + + public function getStatus() { + $version = $this->settings->getAppValue( + $this->appName, 'installed_version' + ); + + return [ + 'version' => $version, + 'warnings' => [ + 'improperlyConfiguredCron' => !$this->isProperlyConfigured() + ] + ]; + } + +} \ No newline at end of file -- cgit v1.2.3