From 816a8beb0b77164aa60a7fe23b4b3d0881985be3 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Tue, 17 Feb 2015 15:17:40 +0100 Subject: add status api route --- service/statusservice.php | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 service/statusservice.php (limited to 'service/statusservice.php') diff --git a/service/statusservice.php b/service/statusservice.php new file mode 100644 index 000000000..b578dd7c5 --- /dev/null +++ b/service/statusservice.php @@ -0,0 +1,59 @@ + + * @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 getStatus() { + $improperlyConfiguredCron = false; + + $version = $this->settings->getAppValue( + $this->appName, 'installed_version' + ); + $cronMode = $this->settings->getAppValue( + 'core', 'backgroundjobs_mode' + ); + $cronOn = $this->config->getUseCronUpdates(); + + // check for cron modes which may lead to problems + if ($cronMode !== 'cron' && $cronMode !== 'webcron' && $cronOn) { + $improperlyConfiguredCron = true; + } + + + return [ + 'version' => $version, + 'warnings' => [ + 'improperlyConfiguredCron' => $improperlyConfiguredCron + ] + ]; + } + +} \ No newline at end of file -- cgit v1.2.3