Completed
Push — master ( 716874...2e72ef )
by Blizzz
17:30 queued 12s
created
settings/templates/settings/admin/overview.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,39 +28,39 @@
 block discarded – undo
28 28
 ?>
29 29
 
30 30
 <div id="security-warning" class="section">
31
-	<h2><?php p($l->t('Security & setup warnings'));?></h2>
32
-	<p class="settings-hint"><?php p($l->t('It\'s important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the linked documentation for more information.'));?></p>
31
+	<h2><?php p($l->t('Security & setup warnings')); ?></h2>
32
+	<p class="settings-hint"><?php p($l->t('It\'s important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the linked documentation for more information.')); ?></p>
33 33
 
34 34
 	<div id="security-warning-state-ok" class="hidden">
35
-		<span class="icon icon-checkmark-white"></span><span class="message"><?php p($l->t('All checks passed.'));?></span>
35
+		<span class="icon icon-checkmark-white"></span><span class="message"><?php p($l->t('All checks passed.')); ?></span>
36 36
 	</div>
37 37
 	<div id="security-warning-state-failure" class="hidden">
38
-		<span class="icon icon-close-white"></span><span class="message"><?php p($l->t('There are some errors regarding your setup.'));?></span>
38
+		<span class="icon icon-close-white"></span><span class="message"><?php p($l->t('There are some errors regarding your setup.')); ?></span>
39 39
 	</div>
40 40
 	<div id="security-warning-state-warning" class="hidden">
41
-		<span class="icon icon-error-white"></span><span class="message"><?php p($l->t('There are some warnings regarding your setup.'));?></span>
41
+		<span class="icon icon-error-white"></span><span class="message"><?php p($l->t('There are some warnings regarding your setup.')); ?></span>
42 42
 	</div>
43 43
 	<div id="security-warning-state-loading">
44
-		<span class="icon loading"></span><span class="message"><?php p($l->t('Checking for system and security issues.'));?></span>
44
+		<span class="icon loading"></span><span class="message"><?php p($l->t('Checking for system and security issues.')); ?></span>
45 45
 	</div>
46 46
 
47
-	<div id="postsetupchecks" data-check-wellknown="<?php if($_['checkForWorkingWellKnownSetup']) { p('true'); } else { p('false'); } ?>">
47
+	<div id="postsetupchecks" data-check-wellknown="<?php if ($_['checkForWorkingWellKnownSetup']) { p('true'); } else { p('false'); } ?>">
48 48
 		<ul class="errors hidden"></ul>
49 49
 		<ul class="warnings hidden"></ul>
50 50
 		<ul class="info hidden"></ul>
51 51
 	</div>
52 52
 	<p id="postsetupchecks-hint" class="hidden">
53
-		<?php print_unescaped($l->t('Please double check the <a target="_blank" rel="noreferrer noopener" href="%s">installation guides ↗</a>, and check for any errors or warnings in the <a href="%s">log</a>.', [link_to_docs('admin-install'), \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => 'logging'])] )); ?>
53
+		<?php print_unescaped($l->t('Please double check the <a target="_blank" rel="noreferrer noopener" href="%s">installation guides ↗</a>, and check for any errors or warnings in the <a href="%s">log</a>.', [link_to_docs('admin-install'), \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => 'logging'])])); ?>
54 54
 	</p>
55 55
 
56 56
 	<p class="extra-top-margin">
57
-		<?php print_unescaped($l->t('Check the security of your Nextcloud over <a target="_blank" rel="noreferrer noopener" href="%s">our security scan ↗</a>.', ['https://scan.nextcloud.com']));?>
57
+		<?php print_unescaped($l->t('Check the security of your Nextcloud over <a target="_blank" rel="noreferrer noopener" href="%s">our security scan ↗</a>.', ['https://scan.nextcloud.com'])); ?>
58 58
 	</p>
59 59
 
60 60
 </div>
61 61
 
62 62
 <div id="version" class="section">
63 63
 	<!-- should be the last part, so Updater can follow if enabled (it has no heading therefore). -->
64
-	<h2><?php p($l->t('Version'));?></h2>
64
+	<h2><?php p($l->t('Version')); ?></h2>
65 65
 	<p><strong><a href="<?php print_unescaped($theme->getBaseUrl()); ?>" rel="noreferrer noopener" target="_blank"><?php p($theme->getTitle()); ?></a> <?php p(OC_Util::getHumanVersion()) ?></strong></p>
66 66
 </div>
Please login to merge, or discard this patch.
apps/updatenotification/lib/Notification/Notifier.php 2 patches
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -38,141 +38,141 @@
 block discarded – undo
38 38
 
39 39
 class Notifier implements INotifier {
40 40
 
41
-	/** @var IURLGenerator */
42
-	protected $url;
43
-
44
-	/** @var IConfig */
45
-	protected $config;
46
-
47
-	/** @var IManager */
48
-	protected $notificationManager;
49
-
50
-	/** @var IFactory */
51
-	protected $l10NFactory;
52
-
53
-	/** @var IUserSession */
54
-	protected $userSession;
55
-
56
-	/** @var IGroupManager */
57
-	protected $groupManager;
58
-
59
-	/** @var string[] */
60
-	protected $appVersions;
61
-
62
-	/**
63
-	 * Notifier constructor.
64
-	 *
65
-	 * @param IURLGenerator $url
66
-	 * @param IConfig $config
67
-	 * @param IManager $notificationManager
68
-	 * @param IFactory $l10NFactory
69
-	 * @param IUserSession $userSession
70
-	 * @param IGroupManager $groupManager
71
-	 */
72
-	public function __construct(IURLGenerator $url, IConfig $config, IManager $notificationManager, IFactory $l10NFactory, IUserSession $userSession, IGroupManager $groupManager) {
73
-		$this->url = $url;
74
-		$this->notificationManager = $notificationManager;
75
-		$this->config = $config;
76
-		$this->l10NFactory = $l10NFactory;
77
-		$this->userSession = $userSession;
78
-		$this->groupManager = $groupManager;
79
-		$this->appVersions = $this->getAppVersions();
80
-	}
81
-
82
-	/**
83
-	 * @param INotification $notification
84
-	 * @param string $languageCode The code of the language that should be used to prepare the notification
85
-	 * @return INotification
86
-	 * @throws \InvalidArgumentException When the notification was not prepared by a notifier
87
-	 * @since 9.0.0
88
-	 */
89
-	public function prepare(INotification $notification, $languageCode): INotification {
90
-		if ($notification->getApp() !== 'updatenotification') {
91
-			throw new \InvalidArgumentException('Unknown app id');
92
-		}
93
-
94
-		$l = $this->l10NFactory->get('updatenotification', $languageCode);
95
-		if ($notification->getSubject() === 'connection_error') {
96
-			$errors = (int) $this->config->getAppValue('updatenotification', 'update_check_errors', 0);
97
-			if ($errors === 0) {
98
-				$this->notificationManager->markProcessed($notification);
99
-				throw new \InvalidArgumentException('Update checked worked again');
100
-			}
101
-
102
-			$notification->setParsedSubject($l->t('The update server could not be reached since %d days to check for new updates.', [$errors]))
103
-				->setParsedMessage($l->t('Please check the Nextcloud and server log files for errors.'));
104
-		} elseif ($notification->getObjectType() === 'core') {
105
-			$this->updateAlreadyInstalledCheck($notification, $this->getCoreVersions());
106
-
107
-			$parameters = $notification->getSubjectParameters();
108
-			$notification->setParsedSubject($l->t('Update to %1$s is available.', [$parameters['version']]));
109
-
110
-			if ($this->isAdmin()) {
111
-				$notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']) . '#version');
112
-			}
113
-		} else {
114
-			$appInfo = $this->getAppInfo($notification->getObjectType());
115
-			$appName = ($appInfo === null) ? $notification->getObjectType() : $appInfo['name'];
116
-
117
-			if (isset($this->appVersions[$notification->getObjectType()])) {
118
-				$this->updateAlreadyInstalledCheck($notification, $this->appVersions[$notification->getObjectType()]);
119
-			}
120
-
121
-			$notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()]))
122
-				->setRichSubject($l->t('Update for {app} to version %s is available.', [$notification->getObjectId()]), [
123
-					'app' => [
124
-						'type' => 'app',
125
-						'id' => $notification->getObjectType(),
126
-						'name' => $appName,
127
-					]
128
-				]);
129
-
130
-			if ($this->isAdmin()) {
131
-				$notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps', ['category' => 'updates']) . '#app-' . $notification->getObjectType());
132
-			}
133
-		}
134
-
135
-		$notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('updatenotification', 'notification.svg')));
136
-
137
-		return $notification;
138
-	}
139
-
140
-	/**
141
-	 * Remove the notification and prevent rendering, when the update is installed
142
-	 *
143
-	 * @param INotification $notification
144
-	 * @param string $installedVersion
145
-	 * @throws \InvalidArgumentException When the update is already installed
146
-	 */
147
-	protected function updateAlreadyInstalledCheck(INotification $notification, $installedVersion) {
148
-		if (version_compare($notification->getObjectId(), $installedVersion, '<=')) {
149
-			$this->notificationManager->markProcessed($notification);
150
-			throw new \InvalidArgumentException('Update already installed');
151
-		}
152
-	}
153
-
154
-	/**
155
-	 * @return bool
156
-	 */
157
-	protected function isAdmin(): bool {
158
-		$user = $this->userSession->getUser();
159
-
160
-		if ($user instanceof IUser) {
161
-			return $this->groupManager->isAdmin($user->getUID());
162
-		}
163
-
164
-		return false;
165
-	}
166
-
167
-	protected function getCoreVersions(): string {
168
-		return implode('.', Util::getVersion());
169
-	}
170
-
171
-	protected function getAppVersions(): array {
172
-		return \OC_App::getAppVersions();
173
-	}
174
-
175
-	protected function getAppInfo($appId) {
176
-		return \OC_App::getAppInfo($appId);
177
-	}
41
+    /** @var IURLGenerator */
42
+    protected $url;
43
+
44
+    /** @var IConfig */
45
+    protected $config;
46
+
47
+    /** @var IManager */
48
+    protected $notificationManager;
49
+
50
+    /** @var IFactory */
51
+    protected $l10NFactory;
52
+
53
+    /** @var IUserSession */
54
+    protected $userSession;
55
+
56
+    /** @var IGroupManager */
57
+    protected $groupManager;
58
+
59
+    /** @var string[] */
60
+    protected $appVersions;
61
+
62
+    /**
63
+     * Notifier constructor.
64
+     *
65
+     * @param IURLGenerator $url
66
+     * @param IConfig $config
67
+     * @param IManager $notificationManager
68
+     * @param IFactory $l10NFactory
69
+     * @param IUserSession $userSession
70
+     * @param IGroupManager $groupManager
71
+     */
72
+    public function __construct(IURLGenerator $url, IConfig $config, IManager $notificationManager, IFactory $l10NFactory, IUserSession $userSession, IGroupManager $groupManager) {
73
+        $this->url = $url;
74
+        $this->notificationManager = $notificationManager;
75
+        $this->config = $config;
76
+        $this->l10NFactory = $l10NFactory;
77
+        $this->userSession = $userSession;
78
+        $this->groupManager = $groupManager;
79
+        $this->appVersions = $this->getAppVersions();
80
+    }
81
+
82
+    /**
83
+     * @param INotification $notification
84
+     * @param string $languageCode The code of the language that should be used to prepare the notification
85
+     * @return INotification
86
+     * @throws \InvalidArgumentException When the notification was not prepared by a notifier
87
+     * @since 9.0.0
88
+     */
89
+    public function prepare(INotification $notification, $languageCode): INotification {
90
+        if ($notification->getApp() !== 'updatenotification') {
91
+            throw new \InvalidArgumentException('Unknown app id');
92
+        }
93
+
94
+        $l = $this->l10NFactory->get('updatenotification', $languageCode);
95
+        if ($notification->getSubject() === 'connection_error') {
96
+            $errors = (int) $this->config->getAppValue('updatenotification', 'update_check_errors', 0);
97
+            if ($errors === 0) {
98
+                $this->notificationManager->markProcessed($notification);
99
+                throw new \InvalidArgumentException('Update checked worked again');
100
+            }
101
+
102
+            $notification->setParsedSubject($l->t('The update server could not be reached since %d days to check for new updates.', [$errors]))
103
+                ->setParsedMessage($l->t('Please check the Nextcloud and server log files for errors.'));
104
+        } elseif ($notification->getObjectType() === 'core') {
105
+            $this->updateAlreadyInstalledCheck($notification, $this->getCoreVersions());
106
+
107
+            $parameters = $notification->getSubjectParameters();
108
+            $notification->setParsedSubject($l->t('Update to %1$s is available.', [$parameters['version']]));
109
+
110
+            if ($this->isAdmin()) {
111
+                $notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']) . '#version');
112
+            }
113
+        } else {
114
+            $appInfo = $this->getAppInfo($notification->getObjectType());
115
+            $appName = ($appInfo === null) ? $notification->getObjectType() : $appInfo['name'];
116
+
117
+            if (isset($this->appVersions[$notification->getObjectType()])) {
118
+                $this->updateAlreadyInstalledCheck($notification, $this->appVersions[$notification->getObjectType()]);
119
+            }
120
+
121
+            $notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()]))
122
+                ->setRichSubject($l->t('Update for {app} to version %s is available.', [$notification->getObjectId()]), [
123
+                    'app' => [
124
+                        'type' => 'app',
125
+                        'id' => $notification->getObjectType(),
126
+                        'name' => $appName,
127
+                    ]
128
+                ]);
129
+
130
+            if ($this->isAdmin()) {
131
+                $notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps', ['category' => 'updates']) . '#app-' . $notification->getObjectType());
132
+            }
133
+        }
134
+
135
+        $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('updatenotification', 'notification.svg')));
136
+
137
+        return $notification;
138
+    }
139
+
140
+    /**
141
+     * Remove the notification and prevent rendering, when the update is installed
142
+     *
143
+     * @param INotification $notification
144
+     * @param string $installedVersion
145
+     * @throws \InvalidArgumentException When the update is already installed
146
+     */
147
+    protected function updateAlreadyInstalledCheck(INotification $notification, $installedVersion) {
148
+        if (version_compare($notification->getObjectId(), $installedVersion, '<=')) {
149
+            $this->notificationManager->markProcessed($notification);
150
+            throw new \InvalidArgumentException('Update already installed');
151
+        }
152
+    }
153
+
154
+    /**
155
+     * @return bool
156
+     */
157
+    protected function isAdmin(): bool {
158
+        $user = $this->userSession->getUser();
159
+
160
+        if ($user instanceof IUser) {
161
+            return $this->groupManager->isAdmin($user->getUID());
162
+        }
163
+
164
+        return false;
165
+    }
166
+
167
+    protected function getCoreVersions(): string {
168
+        return implode('.', Util::getVersion());
169
+    }
170
+
171
+    protected function getAppVersions(): array {
172
+        return \OC_App::getAppVersions();
173
+    }
174
+
175
+    protected function getAppInfo($appId) {
176
+        return \OC_App::getAppInfo($appId);
177
+    }
178 178
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 			$notification->setParsedSubject($l->t('Update to %1$s is available.', [$parameters['version']]));
109 109
 
110 110
 			if ($this->isAdmin()) {
111
-				$notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']) . '#version');
111
+				$notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']).'#version');
112 112
 			}
113 113
 		} else {
114 114
 			$appInfo = $this->getAppInfo($notification->getObjectType());
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				]);
129 129
 
130 130
 			if ($this->isAdmin()) {
131
-				$notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps', ['category' => 'updates']) . '#app-' . $notification->getObjectType());
131
+				$notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps', ['category' => 'updates']).'#app-'.$notification->getObjectType());
132 132
 			}
133 133
 		}
134 134
 
Please login to merge, or discard this patch.