Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbrantje <brantje@gmail.com>2016-10-16 13:56:48 +0300
committerbrantje <brantje@gmail.com>2016-10-16 14:21:27 +0300
commitbb554a8407f7d696ff1372e34f520175c207b8fb (patch)
tree224acd6c6fa434b63fa87957695c56c27ad57888 /lib
parent7be6f8c0a127f676bb1ec244ee386fa8a7b11e7f (diff)
Remove deprecated cron
Diffstat (limited to 'lib')
-rw-r--r--lib/BackgroundJob/ExpireCredentials.php52
-rw-r--r--lib/Cron/ExpireCredentials.php23
-rw-r--r--lib/Service/CronService.php3
3 files changed, 54 insertions, 24 deletions
diff --git a/lib/BackgroundJob/ExpireCredentials.php b/lib/BackgroundJob/ExpireCredentials.php
new file mode 100644
index 00000000..2c430a10
--- /dev/null
+++ b/lib/BackgroundJob/ExpireCredentials.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ *
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Passman\BackgroundJob;
+
+use OC\BackgroundJob\TimedJob;
+use \OCA\Passman\AppInfo\Application;
+use OCP\IConfig;
+
+/**
+ * Class ExpireCredentials
+ *
+ * @package OCA\Passman\BackgroundJob
+ */
+class ExpireCredentials extends TimedJob {
+ /** @var IConfig */
+ protected $config;
+
+ /**
+ * @param IConfig $config
+ */
+ public function __construct(IConfig $config) {
+ // Run once per minute
+ $this->setInterval(60);
+ $this->config = $config;
+ }
+
+ protected function run($argument) {
+ $app = new Application();
+ $container = $app->getContainer();
+ $container->query('CronService')->expireCredentials();
+ }
+}
diff --git a/lib/Cron/ExpireCredentials.php b/lib/Cron/ExpireCredentials.php
deleted file mode 100644
index d52259cd..00000000
--- a/lib/Cron/ExpireCredentials.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * Nextcloud - passman
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Sander Brand <brantje@gmail.com>
- * @copyright Sander Brand 2016
- */
-
-
-namespace OCA\Passman\Cron;
-use OCA\Passman\Service\CredentialService;
-use OCA\Passman\Utility\Utils;
-use \OCA\Passman\AppInfo\Application;
-class ExpireCredentials {
- public static function run() {
- $app = new Application();
- $container = $app->getContainer();
- $container->query('CronService')->expireCredentials();
- }
-} \ No newline at end of file
diff --git a/lib/Service/CronService.php b/lib/Service/CronService.php
index dd4aa085..75f8f189 100644
--- a/lib/Service/CronService.php
+++ b/lib/Service/CronService.php
@@ -33,7 +33,8 @@ class CronService {
$this->activityService = $activityService;
$this->db = $db;
}
- //@TODO rename to a general name with sub tasks
+
+
public function expireCredentials() {
$this->logger->info('Passman cron test', array('app' => 'passman'));
$expired_credentials = $this->credentialService->getExpiredCredentials($this->utils->getTime());