Completed
Push — master ( 0e9aa3...34c6cb )
by
unknown
50:54 queued 25:16
created
apps/updatenotification/lib/BackgroundJob/ResetToken.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -19,49 +19,49 @@
 block discarded – undo
19 19
  */
20 20
 class ResetToken extends TimedJob {
21 21
 
22
-	/**
23
-	 * @param IConfig $config
24
-	 * @param ITimeFactory $timeFactory
25
-	 */
26
-	public function __construct(
27
-		ITimeFactory $time,
28
-		private IConfig $config,
29
-		private IAppConfig $appConfig,
30
-		private LoggerInterface $logger,
31
-	) {
32
-		parent::__construct($time);
33
-		// Run once an hour
34
-		parent::setInterval(60 * 60);
35
-	}
22
+    /**
23
+     * @param IConfig $config
24
+     * @param ITimeFactory $timeFactory
25
+     */
26
+    public function __construct(
27
+        ITimeFactory $time,
28
+        private IConfig $config,
29
+        private IAppConfig $appConfig,
30
+        private LoggerInterface $logger,
31
+    ) {
32
+        parent::__construct($time);
33
+        // Run once an hour
34
+        parent::setInterval(60 * 60);
35
+    }
36 36
 
37
-	/**
38
-	 * @param $argument
39
-	 */
40
-	protected function run($argument) {
41
-		if ($this->config->getSystemValueBool('config_is_read_only')) {
42
-			$this->logger->debug('Skipping `updater.secret` reset since config_is_read_only is set', ['app' => 'updatenotification']);
43
-			return;
44
-		}
37
+    /**
38
+     * @param $argument
39
+     */
40
+    protected function run($argument) {
41
+        if ($this->config->getSystemValueBool('config_is_read_only')) {
42
+            $this->logger->debug('Skipping `updater.secret` reset since config_is_read_only is set', ['app' => 'updatenotification']);
43
+            return;
44
+        }
45 45
 
46
-		$secretCreated = $this->appConfig->getValueInt('core', 'updater.secret.created', 0);
46
+        $secretCreated = $this->appConfig->getValueInt('core', 'updater.secret.created', 0);
47 47
 
48
-		if ($secretCreated === 0) {
49
-			if ($this->config->getSystemValueString('updater.secret') !== '') {
50
-				$this->logger->error('Cleared old `updater.secret` with unknown creation date', ['app' => 'updatenotification']);
51
-				$this->config->deleteSystemValue('updater.secret');
52
-			}
53
-			$this->logger->debug('Skipping `updater.secret` reset since there is none', ['app' => 'updatenotification']);
54
-			return;
55
-		}
48
+        if ($secretCreated === 0) {
49
+            if ($this->config->getSystemValueString('updater.secret') !== '') {
50
+                $this->logger->error('Cleared old `updater.secret` with unknown creation date', ['app' => 'updatenotification']);
51
+                $this->config->deleteSystemValue('updater.secret');
52
+            }
53
+            $this->logger->debug('Skipping `updater.secret` reset since there is none', ['app' => 'updatenotification']);
54
+            return;
55
+        }
56 56
 
57
-		// Delete old tokens after 2 days and also tokens without any created date
58
-		$secretCreatedDiff = $this->time->getTime() - $secretCreated;
59
-		if ($secretCreatedDiff >= 172800) {
60
-			$this->config->deleteSystemValue('updater.secret');
61
-			$this->appConfig->deleteKey('core', 'updater.secret.created');
62
-			$this->logger->warning('Cleared old `updater.secret` that was created ' . $secretCreatedDiff . ' seconds ago', ['app' => 'updatenotification']);
63
-		} else {
64
-			$this->logger->debug('Keeping existing `updater.secret` that was created ' . $secretCreatedDiff . ' seconds ago', ['app' => 'updatenotification']);
65
-		}
66
-	}
57
+        // Delete old tokens after 2 days and also tokens without any created date
58
+        $secretCreatedDiff = $this->time->getTime() - $secretCreated;
59
+        if ($secretCreatedDiff >= 172800) {
60
+            $this->config->deleteSystemValue('updater.secret');
61
+            $this->appConfig->deleteKey('core', 'updater.secret.created');
62
+            $this->logger->warning('Cleared old `updater.secret` that was created ' . $secretCreatedDiff . ' seconds ago', ['app' => 'updatenotification']);
63
+        } else {
64
+            $this->logger->debug('Keeping existing `updater.secret` that was created ' . $secretCreatedDiff . ' seconds ago', ['app' => 'updatenotification']);
65
+        }
66
+    }
67 67
 }
Please login to merge, or discard this patch.