@@ -28,39 +28,39 @@ |
||
| 28 | 28 | use OCP\Settings\ISettings; |
| 29 | 29 | |
| 30 | 30 | class Overview implements ISettings { |
| 31 | - /** @var IConfig */ |
|
| 32 | - private $config; |
|
| 31 | + /** @var IConfig */ |
|
| 32 | + private $config; |
|
| 33 | 33 | |
| 34 | - public function __construct(IConfig $config) { |
|
| 35 | - $this->config = $config; |
|
| 36 | - } |
|
| 34 | + public function __construct(IConfig $config) { |
|
| 35 | + $this->config = $config; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @return TemplateResponse |
|
| 40 | - */ |
|
| 41 | - public function getForm() { |
|
| 42 | - $parameters = [ |
|
| 43 | - 'checkForWorkingWellKnownSetup' => $this->config->getSystemValue('check_for_working_wellknown_setup', true), |
|
| 44 | - ]; |
|
| 38 | + /** |
|
| 39 | + * @return TemplateResponse |
|
| 40 | + */ |
|
| 41 | + public function getForm() { |
|
| 42 | + $parameters = [ |
|
| 43 | + 'checkForWorkingWellKnownSetup' => $this->config->getSystemValue('check_for_working_wellknown_setup', true), |
|
| 44 | + ]; |
|
| 45 | 45 | |
| 46 | - return new TemplateResponse('settings', 'settings/admin/overview', $parameters, ''); |
|
| 47 | - } |
|
| 46 | + return new TemplateResponse('settings', 'settings/admin/overview', $parameters, ''); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @return string the section ID, e.g. 'sharing' |
|
| 51 | - */ |
|
| 52 | - public function getSection() { |
|
| 53 | - return 'overview'; |
|
| 54 | - } |
|
| 49 | + /** |
|
| 50 | + * @return string the section ID, e.g. 'sharing' |
|
| 51 | + */ |
|
| 52 | + public function getSection() { |
|
| 53 | + return 'overview'; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @return int whether the form should be rather on the top or bottom of |
|
| 58 | - * the admin section. The forms are arranged in ascending order of the |
|
| 59 | - * priority values. It is required to return a value between 0 and 100. |
|
| 60 | - * |
|
| 61 | - * E.g.: 70 |
|
| 62 | - */ |
|
| 63 | - public function getPriority() { |
|
| 64 | - return 10; |
|
| 65 | - } |
|
| 56 | + /** |
|
| 57 | + * @return int whether the form should be rather on the top or bottom of |
|
| 58 | + * the admin section. The forms are arranged in ascending order of the |
|
| 59 | + * priority values. It is required to return a value between 0 and 100. |
|
| 60 | + * |
|
| 61 | + * E.g.: 70 |
|
| 62 | + */ |
|
| 63 | + public function getPriority() { |
|
| 64 | + return 10; |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -49,353 +49,353 @@ |
||
| 49 | 49 | use OCP\Util; |
| 50 | 50 | |
| 51 | 51 | class Manager implements IManager { |
| 52 | - /** @var ILogger */ |
|
| 53 | - private $log; |
|
| 54 | - /** @var IDBConnection */ |
|
| 55 | - private $dbc; |
|
| 56 | - /** @var IL10N */ |
|
| 57 | - private $l; |
|
| 58 | - /** @var IConfig */ |
|
| 59 | - private $config; |
|
| 60 | - /** @var EncryptionManager */ |
|
| 61 | - private $encryptionManager; |
|
| 62 | - /** @var IUserManager */ |
|
| 63 | - private $userManager; |
|
| 64 | - /** @var ILockingProvider */ |
|
| 65 | - private $lockingProvider; |
|
| 66 | - /** @var IRequest */ |
|
| 67 | - private $request; |
|
| 68 | - /** @var IURLGenerator */ |
|
| 69 | - private $url; |
|
| 70 | - /** @var AccountManager */ |
|
| 71 | - private $accountManager; |
|
| 72 | - /** @var IGroupManager */ |
|
| 73 | - private $groupManager; |
|
| 74 | - /** @var IFactory */ |
|
| 75 | - private $l10nFactory; |
|
| 76 | - /** @var IAppManager */ |
|
| 77 | - private $appManager; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @param ILogger $log |
|
| 81 | - * @param IDBConnection $dbc |
|
| 82 | - * @param IL10N $l |
|
| 83 | - * @param IConfig $config |
|
| 84 | - * @param EncryptionManager $encryptionManager |
|
| 85 | - * @param IUserManager $userManager |
|
| 86 | - * @param ILockingProvider $lockingProvider |
|
| 87 | - * @param IRequest $request |
|
| 88 | - * @param IURLGenerator $url |
|
| 89 | - * @param AccountManager $accountManager |
|
| 90 | - * @param IGroupManager $groupManager |
|
| 91 | - * @param IFactory $l10nFactory |
|
| 92 | - * @param IAppManager $appManager |
|
| 93 | - */ |
|
| 94 | - public function __construct( |
|
| 95 | - ILogger $log, |
|
| 96 | - IDBConnection $dbc, |
|
| 97 | - IL10N $l, |
|
| 98 | - IConfig $config, |
|
| 99 | - EncryptionManager $encryptionManager, |
|
| 100 | - IUserManager $userManager, |
|
| 101 | - ILockingProvider $lockingProvider, |
|
| 102 | - IRequest $request, |
|
| 103 | - IURLGenerator $url, |
|
| 104 | - AccountManager $accountManager, |
|
| 105 | - IGroupManager $groupManager, |
|
| 106 | - IFactory $l10nFactory, |
|
| 107 | - IAppManager $appManager |
|
| 108 | - ) { |
|
| 109 | - $this->log = $log; |
|
| 110 | - $this->dbc = $dbc; |
|
| 111 | - $this->l = $l; |
|
| 112 | - $this->config = $config; |
|
| 113 | - $this->encryptionManager = $encryptionManager; |
|
| 114 | - $this->userManager = $userManager; |
|
| 115 | - $this->lockingProvider = $lockingProvider; |
|
| 116 | - $this->request = $request; |
|
| 117 | - $this->url = $url; |
|
| 118 | - $this->accountManager = $accountManager; |
|
| 119 | - $this->groupManager = $groupManager; |
|
| 120 | - $this->l10nFactory = $l10nFactory; |
|
| 121 | - $this->appManager = $appManager; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** @var array */ |
|
| 125 | - protected $sectionClasses = []; |
|
| 126 | - |
|
| 127 | - /** @var array */ |
|
| 128 | - protected $sections = []; |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * @param string $type 'admin' or 'personal' |
|
| 132 | - * @param string $section Class must implement OCP\Settings\ISection |
|
| 133 | - * @return void |
|
| 134 | - */ |
|
| 135 | - public function registerSection(string $type, string $section) { |
|
| 136 | - $this->sectionClasses[$section] = $type; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * @param string $type 'admin' or 'personal' |
|
| 141 | - * @return ISection[] |
|
| 142 | - */ |
|
| 143 | - protected function getSections(string $type): array { |
|
| 144 | - if (!isset($this->sections[$type])) { |
|
| 145 | - $this->sections[$type] = []; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - foreach ($this->sectionClasses as $class => $sectionType) { |
|
| 149 | - try { |
|
| 150 | - /** @var ISection $section */ |
|
| 151 | - $section = \OC::$server->query($class); |
|
| 152 | - } catch (QueryException $e) { |
|
| 153 | - $this->log->logException($e, ['level' => ILogger::INFO]); |
|
| 154 | - continue; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - if (!$section instanceof ISection) { |
|
| 158 | - $this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]); |
|
| 159 | - continue; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $this->sections[$sectionType][$section->getID()] = $section; |
|
| 163 | - |
|
| 164 | - unset($this->sectionClasses[$class]); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - return $this->sections[$type]; |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** @var array */ |
|
| 171 | - protected $settingClasses = []; |
|
| 172 | - |
|
| 173 | - /** @var array */ |
|
| 174 | - protected $settings = []; |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * @param string $type 'admin' or 'personal' |
|
| 178 | - * @param string $setting Class must implement OCP\Settings\ISetting |
|
| 179 | - * @return void |
|
| 180 | - */ |
|
| 181 | - public function registerSetting(string $type, string $setting) { |
|
| 182 | - $this->settingClasses[$setting] = $type; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * @param string $type 'admin' or 'personal' |
|
| 187 | - * @param string $section |
|
| 188 | - * @return ISettings[] |
|
| 189 | - */ |
|
| 190 | - protected function getSettings(string $type, string $section): array { |
|
| 191 | - if (!isset($this->settings[$type])) { |
|
| 192 | - $this->settings[$type] = []; |
|
| 193 | - } |
|
| 194 | - if (!isset($this->settings[$type][$section])) { |
|
| 195 | - $this->settings[$type][$section] = []; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - foreach ($this->settingClasses as $class => $settingsType) { |
|
| 199 | - try { |
|
| 200 | - /** @var ISettings $setting */ |
|
| 201 | - $setting = \OC::$server->query($class); |
|
| 202 | - } catch (QueryException $e) { |
|
| 203 | - $this->log->logException($e, ['level' => ILogger::INFO]); |
|
| 204 | - continue; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - if (!$setting instanceof ISettings) { |
|
| 208 | - $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => ILogger::INFO]); |
|
| 209 | - continue; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - if (!isset($this->settings[$settingsType][$setting->getSection()])) { |
|
| 213 | - $this->settings[$settingsType][$setting->getSection()] = []; |
|
| 214 | - } |
|
| 215 | - $this->settings[$settingsType][$setting->getSection()][] = $setting; |
|
| 216 | - |
|
| 217 | - unset($this->settingClasses[$class]); |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - return $this->settings[$type][$section]; |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * @inheritdoc |
|
| 225 | - */ |
|
| 226 | - public function getAdminSections(): array { |
|
| 227 | - // built-in sections |
|
| 228 | - $sections = [ |
|
| 229 | - 0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))], |
|
| 230 | - 1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], |
|
| 231 | - 5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))], |
|
| 232 | - 10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))], |
|
| 233 | - 45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))], |
|
| 234 | - 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], |
|
| 235 | - ]; |
|
| 236 | - |
|
| 237 | - $appSections = $this->getSections('admin'); |
|
| 238 | - |
|
| 239 | - foreach ($appSections as $section) { |
|
| 240 | - /** @var ISection $section */ |
|
| 241 | - if (!isset($sections[$section->getPriority()])) { |
|
| 242 | - $sections[$section->getPriority()] = []; |
|
| 243 | - } |
|
| 244 | - |
|
| 245 | - $sections[$section->getPriority()][] = $section; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - ksort($sections); |
|
| 249 | - |
|
| 250 | - return $sections; |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * @param string $section |
|
| 255 | - * @return ISection[] |
|
| 256 | - */ |
|
| 257 | - private function getBuiltInAdminSettings($section): array { |
|
| 258 | - $forms = []; |
|
| 259 | - |
|
| 260 | - if ($section === 'overview') { |
|
| 261 | - /** @var ISettings $form */ |
|
| 262 | - $form = new Admin\Overview($this->config); |
|
| 263 | - $forms[$form->getPriority()] = [$form]; |
|
| 264 | - $form = new Admin\ServerDevNotice(); |
|
| 265 | - $forms[$form->getPriority()] = [$form]; |
|
| 266 | - } |
|
| 267 | - if ($section === 'server') { |
|
| 268 | - /** @var ISettings $form */ |
|
| 269 | - $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l); |
|
| 270 | - $forms[$form->getPriority()] = [$form]; |
|
| 271 | - $form = new Admin\Mail($this->config); |
|
| 272 | - $forms[$form->getPriority()] = [$form]; |
|
| 273 | - } |
|
| 274 | - if ($section === 'encryption') { |
|
| 275 | - /** @var ISettings $form */ |
|
| 276 | - $form = new Admin\Encryption($this->encryptionManager, $this->userManager); |
|
| 277 | - $forms[$form->getPriority()] = [$form]; |
|
| 278 | - } |
|
| 279 | - if ($section === 'sharing') { |
|
| 280 | - /** @var ISettings $form */ |
|
| 281 | - $form = new Admin\Sharing($this->config, $this->l); |
|
| 282 | - $forms[$form->getPriority()] = [$form]; |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - return $forms; |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * @param string $section |
|
| 290 | - * @return ISection[] |
|
| 291 | - */ |
|
| 292 | - private function getBuiltInPersonalSettings($section): array { |
|
| 293 | - $forms = []; |
|
| 294 | - |
|
| 295 | - if ($section === 'personal-info') { |
|
| 296 | - /** @var ISettings $form */ |
|
| 297 | - $form = new Personal\PersonalInfo( |
|
| 298 | - $this->config, |
|
| 299 | - $this->userManager, |
|
| 300 | - $this->groupManager, |
|
| 301 | - $this->accountManager, |
|
| 302 | - $this->appManager, |
|
| 303 | - $this->l10nFactory, |
|
| 304 | - $this->l |
|
| 305 | - ); |
|
| 306 | - $forms[$form->getPriority()] = [$form]; |
|
| 307 | - } |
|
| 308 | - if($section === 'security') { |
|
| 309 | - /** @var ISettings $form */ |
|
| 310 | - $form = new Personal\Security(); |
|
| 311 | - $forms[$form->getPriority()] = [$form]; |
|
| 312 | - } |
|
| 313 | - if ($section === 'additional') { |
|
| 314 | - /** @var ISettings $form */ |
|
| 315 | - $form = new Personal\Additional(); |
|
| 316 | - $forms[$form->getPriority()] = [$form]; |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - return $forms; |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * @inheritdoc |
|
| 324 | - */ |
|
| 325 | - public function getAdminSettings($section): array { |
|
| 326 | - $settings = $this->getBuiltInAdminSettings($section); |
|
| 327 | - $appSettings = $this->getSettings('admin', $section); |
|
| 328 | - |
|
| 329 | - foreach ($appSettings as $setting) { |
|
| 330 | - if (!isset($settings[$setting->getPriority()])) { |
|
| 331 | - $settings[$setting->getPriority()] = []; |
|
| 332 | - } |
|
| 333 | - $settings[$setting->getPriority()][] = $setting; |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - ksort($settings); |
|
| 337 | - return $settings; |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * @inheritdoc |
|
| 342 | - */ |
|
| 343 | - public function getPersonalSections(): array { |
|
| 344 | - $sections = [ |
|
| 345 | - 0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))], |
|
| 346 | - 5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))], |
|
| 347 | - 15 => [new Section('sync-clients', $this->l->t('Mobile & desktop'), 0, $this->url->imagePath('core', 'clients/phone.svg'))], |
|
| 348 | - ]; |
|
| 349 | - |
|
| 350 | - $legacyForms = \OC_App::getForms('personal'); |
|
| 351 | - if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) { |
|
| 352 | - $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))]; |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - $appSections = $this->getSections('personal'); |
|
| 356 | - |
|
| 357 | - foreach ($appSections as $section) { |
|
| 358 | - /** @var ISection $section */ |
|
| 359 | - if (!isset($sections[$section->getPriority()])) { |
|
| 360 | - $sections[$section->getPriority()] = []; |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - $sections[$section->getPriority()][] = $section; |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - ksort($sections); |
|
| 367 | - |
|
| 368 | - return $sections; |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * @param string[] $forms |
|
| 373 | - * @return bool |
|
| 374 | - */ |
|
| 375 | - private function hasLegacyPersonalSettingsToRender(array $forms): bool { |
|
| 376 | - foreach ($forms as $form) { |
|
| 377 | - if(trim($form) !== '') { |
|
| 378 | - return true; |
|
| 379 | - } |
|
| 380 | - } |
|
| 381 | - return false; |
|
| 382 | - } |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * @inheritdoc |
|
| 386 | - */ |
|
| 387 | - public function getPersonalSettings($section): array { |
|
| 388 | - $settings = $this->getBuiltInPersonalSettings($section); |
|
| 389 | - $appSettings = $this->getSettings('personal', $section); |
|
| 390 | - |
|
| 391 | - foreach ($appSettings as $setting) { |
|
| 392 | - if (!isset($settings[$setting->getPriority()])) { |
|
| 393 | - $settings[$setting->getPriority()] = []; |
|
| 394 | - } |
|
| 395 | - $settings[$setting->getPriority()][] = $setting; |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - ksort($settings); |
|
| 399 | - return $settings; |
|
| 400 | - } |
|
| 52 | + /** @var ILogger */ |
|
| 53 | + private $log; |
|
| 54 | + /** @var IDBConnection */ |
|
| 55 | + private $dbc; |
|
| 56 | + /** @var IL10N */ |
|
| 57 | + private $l; |
|
| 58 | + /** @var IConfig */ |
|
| 59 | + private $config; |
|
| 60 | + /** @var EncryptionManager */ |
|
| 61 | + private $encryptionManager; |
|
| 62 | + /** @var IUserManager */ |
|
| 63 | + private $userManager; |
|
| 64 | + /** @var ILockingProvider */ |
|
| 65 | + private $lockingProvider; |
|
| 66 | + /** @var IRequest */ |
|
| 67 | + private $request; |
|
| 68 | + /** @var IURLGenerator */ |
|
| 69 | + private $url; |
|
| 70 | + /** @var AccountManager */ |
|
| 71 | + private $accountManager; |
|
| 72 | + /** @var IGroupManager */ |
|
| 73 | + private $groupManager; |
|
| 74 | + /** @var IFactory */ |
|
| 75 | + private $l10nFactory; |
|
| 76 | + /** @var IAppManager */ |
|
| 77 | + private $appManager; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @param ILogger $log |
|
| 81 | + * @param IDBConnection $dbc |
|
| 82 | + * @param IL10N $l |
|
| 83 | + * @param IConfig $config |
|
| 84 | + * @param EncryptionManager $encryptionManager |
|
| 85 | + * @param IUserManager $userManager |
|
| 86 | + * @param ILockingProvider $lockingProvider |
|
| 87 | + * @param IRequest $request |
|
| 88 | + * @param IURLGenerator $url |
|
| 89 | + * @param AccountManager $accountManager |
|
| 90 | + * @param IGroupManager $groupManager |
|
| 91 | + * @param IFactory $l10nFactory |
|
| 92 | + * @param IAppManager $appManager |
|
| 93 | + */ |
|
| 94 | + public function __construct( |
|
| 95 | + ILogger $log, |
|
| 96 | + IDBConnection $dbc, |
|
| 97 | + IL10N $l, |
|
| 98 | + IConfig $config, |
|
| 99 | + EncryptionManager $encryptionManager, |
|
| 100 | + IUserManager $userManager, |
|
| 101 | + ILockingProvider $lockingProvider, |
|
| 102 | + IRequest $request, |
|
| 103 | + IURLGenerator $url, |
|
| 104 | + AccountManager $accountManager, |
|
| 105 | + IGroupManager $groupManager, |
|
| 106 | + IFactory $l10nFactory, |
|
| 107 | + IAppManager $appManager |
|
| 108 | + ) { |
|
| 109 | + $this->log = $log; |
|
| 110 | + $this->dbc = $dbc; |
|
| 111 | + $this->l = $l; |
|
| 112 | + $this->config = $config; |
|
| 113 | + $this->encryptionManager = $encryptionManager; |
|
| 114 | + $this->userManager = $userManager; |
|
| 115 | + $this->lockingProvider = $lockingProvider; |
|
| 116 | + $this->request = $request; |
|
| 117 | + $this->url = $url; |
|
| 118 | + $this->accountManager = $accountManager; |
|
| 119 | + $this->groupManager = $groupManager; |
|
| 120 | + $this->l10nFactory = $l10nFactory; |
|
| 121 | + $this->appManager = $appManager; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** @var array */ |
|
| 125 | + protected $sectionClasses = []; |
|
| 126 | + |
|
| 127 | + /** @var array */ |
|
| 128 | + protected $sections = []; |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * @param string $type 'admin' or 'personal' |
|
| 132 | + * @param string $section Class must implement OCP\Settings\ISection |
|
| 133 | + * @return void |
|
| 134 | + */ |
|
| 135 | + public function registerSection(string $type, string $section) { |
|
| 136 | + $this->sectionClasses[$section] = $type; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * @param string $type 'admin' or 'personal' |
|
| 141 | + * @return ISection[] |
|
| 142 | + */ |
|
| 143 | + protected function getSections(string $type): array { |
|
| 144 | + if (!isset($this->sections[$type])) { |
|
| 145 | + $this->sections[$type] = []; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + foreach ($this->sectionClasses as $class => $sectionType) { |
|
| 149 | + try { |
|
| 150 | + /** @var ISection $section */ |
|
| 151 | + $section = \OC::$server->query($class); |
|
| 152 | + } catch (QueryException $e) { |
|
| 153 | + $this->log->logException($e, ['level' => ILogger::INFO]); |
|
| 154 | + continue; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + if (!$section instanceof ISection) { |
|
| 158 | + $this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]); |
|
| 159 | + continue; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $this->sections[$sectionType][$section->getID()] = $section; |
|
| 163 | + |
|
| 164 | + unset($this->sectionClasses[$class]); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + return $this->sections[$type]; |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** @var array */ |
|
| 171 | + protected $settingClasses = []; |
|
| 172 | + |
|
| 173 | + /** @var array */ |
|
| 174 | + protected $settings = []; |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * @param string $type 'admin' or 'personal' |
|
| 178 | + * @param string $setting Class must implement OCP\Settings\ISetting |
|
| 179 | + * @return void |
|
| 180 | + */ |
|
| 181 | + public function registerSetting(string $type, string $setting) { |
|
| 182 | + $this->settingClasses[$setting] = $type; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * @param string $type 'admin' or 'personal' |
|
| 187 | + * @param string $section |
|
| 188 | + * @return ISettings[] |
|
| 189 | + */ |
|
| 190 | + protected function getSettings(string $type, string $section): array { |
|
| 191 | + if (!isset($this->settings[$type])) { |
|
| 192 | + $this->settings[$type] = []; |
|
| 193 | + } |
|
| 194 | + if (!isset($this->settings[$type][$section])) { |
|
| 195 | + $this->settings[$type][$section] = []; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + foreach ($this->settingClasses as $class => $settingsType) { |
|
| 199 | + try { |
|
| 200 | + /** @var ISettings $setting */ |
|
| 201 | + $setting = \OC::$server->query($class); |
|
| 202 | + } catch (QueryException $e) { |
|
| 203 | + $this->log->logException($e, ['level' => ILogger::INFO]); |
|
| 204 | + continue; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + if (!$setting instanceof ISettings) { |
|
| 208 | + $this->log->logException(new \InvalidArgumentException('Invalid settings setting registered'), ['level' => ILogger::INFO]); |
|
| 209 | + continue; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + if (!isset($this->settings[$settingsType][$setting->getSection()])) { |
|
| 213 | + $this->settings[$settingsType][$setting->getSection()] = []; |
|
| 214 | + } |
|
| 215 | + $this->settings[$settingsType][$setting->getSection()][] = $setting; |
|
| 216 | + |
|
| 217 | + unset($this->settingClasses[$class]); |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + return $this->settings[$type][$section]; |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * @inheritdoc |
|
| 225 | + */ |
|
| 226 | + public function getAdminSections(): array { |
|
| 227 | + // built-in sections |
|
| 228 | + $sections = [ |
|
| 229 | + 0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))], |
|
| 230 | + 1 => [new Section('server', $this->l->t('Basic settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], |
|
| 231 | + 5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))], |
|
| 232 | + 10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))], |
|
| 233 | + 45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))], |
|
| 234 | + 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], |
|
| 235 | + ]; |
|
| 236 | + |
|
| 237 | + $appSections = $this->getSections('admin'); |
|
| 238 | + |
|
| 239 | + foreach ($appSections as $section) { |
|
| 240 | + /** @var ISection $section */ |
|
| 241 | + if (!isset($sections[$section->getPriority()])) { |
|
| 242 | + $sections[$section->getPriority()] = []; |
|
| 243 | + } |
|
| 244 | + |
|
| 245 | + $sections[$section->getPriority()][] = $section; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + ksort($sections); |
|
| 249 | + |
|
| 250 | + return $sections; |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * @param string $section |
|
| 255 | + * @return ISection[] |
|
| 256 | + */ |
|
| 257 | + private function getBuiltInAdminSettings($section): array { |
|
| 258 | + $forms = []; |
|
| 259 | + |
|
| 260 | + if ($section === 'overview') { |
|
| 261 | + /** @var ISettings $form */ |
|
| 262 | + $form = new Admin\Overview($this->config); |
|
| 263 | + $forms[$form->getPriority()] = [$form]; |
|
| 264 | + $form = new Admin\ServerDevNotice(); |
|
| 265 | + $forms[$form->getPriority()] = [$form]; |
|
| 266 | + } |
|
| 267 | + if ($section === 'server') { |
|
| 268 | + /** @var ISettings $form */ |
|
| 269 | + $form = new Admin\Server($this->dbc, $this->request, $this->config, $this->lockingProvider, $this->l); |
|
| 270 | + $forms[$form->getPriority()] = [$form]; |
|
| 271 | + $form = new Admin\Mail($this->config); |
|
| 272 | + $forms[$form->getPriority()] = [$form]; |
|
| 273 | + } |
|
| 274 | + if ($section === 'encryption') { |
|
| 275 | + /** @var ISettings $form */ |
|
| 276 | + $form = new Admin\Encryption($this->encryptionManager, $this->userManager); |
|
| 277 | + $forms[$form->getPriority()] = [$form]; |
|
| 278 | + } |
|
| 279 | + if ($section === 'sharing') { |
|
| 280 | + /** @var ISettings $form */ |
|
| 281 | + $form = new Admin\Sharing($this->config, $this->l); |
|
| 282 | + $forms[$form->getPriority()] = [$form]; |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + return $forms; |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * @param string $section |
|
| 290 | + * @return ISection[] |
|
| 291 | + */ |
|
| 292 | + private function getBuiltInPersonalSettings($section): array { |
|
| 293 | + $forms = []; |
|
| 294 | + |
|
| 295 | + if ($section === 'personal-info') { |
|
| 296 | + /** @var ISettings $form */ |
|
| 297 | + $form = new Personal\PersonalInfo( |
|
| 298 | + $this->config, |
|
| 299 | + $this->userManager, |
|
| 300 | + $this->groupManager, |
|
| 301 | + $this->accountManager, |
|
| 302 | + $this->appManager, |
|
| 303 | + $this->l10nFactory, |
|
| 304 | + $this->l |
|
| 305 | + ); |
|
| 306 | + $forms[$form->getPriority()] = [$form]; |
|
| 307 | + } |
|
| 308 | + if($section === 'security') { |
|
| 309 | + /** @var ISettings $form */ |
|
| 310 | + $form = new Personal\Security(); |
|
| 311 | + $forms[$form->getPriority()] = [$form]; |
|
| 312 | + } |
|
| 313 | + if ($section === 'additional') { |
|
| 314 | + /** @var ISettings $form */ |
|
| 315 | + $form = new Personal\Additional(); |
|
| 316 | + $forms[$form->getPriority()] = [$form]; |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + return $forms; |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * @inheritdoc |
|
| 324 | + */ |
|
| 325 | + public function getAdminSettings($section): array { |
|
| 326 | + $settings = $this->getBuiltInAdminSettings($section); |
|
| 327 | + $appSettings = $this->getSettings('admin', $section); |
|
| 328 | + |
|
| 329 | + foreach ($appSettings as $setting) { |
|
| 330 | + if (!isset($settings[$setting->getPriority()])) { |
|
| 331 | + $settings[$setting->getPriority()] = []; |
|
| 332 | + } |
|
| 333 | + $settings[$setting->getPriority()][] = $setting; |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + ksort($settings); |
|
| 337 | + return $settings; |
|
| 338 | + } |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * @inheritdoc |
|
| 342 | + */ |
|
| 343 | + public function getPersonalSections(): array { |
|
| 344 | + $sections = [ |
|
| 345 | + 0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))], |
|
| 346 | + 5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))], |
|
| 347 | + 15 => [new Section('sync-clients', $this->l->t('Mobile & desktop'), 0, $this->url->imagePath('core', 'clients/phone.svg'))], |
|
| 348 | + ]; |
|
| 349 | + |
|
| 350 | + $legacyForms = \OC_App::getForms('personal'); |
|
| 351 | + if(!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) { |
|
| 352 | + $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))]; |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + $appSections = $this->getSections('personal'); |
|
| 356 | + |
|
| 357 | + foreach ($appSections as $section) { |
|
| 358 | + /** @var ISection $section */ |
|
| 359 | + if (!isset($sections[$section->getPriority()])) { |
|
| 360 | + $sections[$section->getPriority()] = []; |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + $sections[$section->getPriority()][] = $section; |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + ksort($sections); |
|
| 367 | + |
|
| 368 | + return $sections; |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * @param string[] $forms |
|
| 373 | + * @return bool |
|
| 374 | + */ |
|
| 375 | + private function hasLegacyPersonalSettingsToRender(array $forms): bool { |
|
| 376 | + foreach ($forms as $form) { |
|
| 377 | + if(trim($form) !== '') { |
|
| 378 | + return true; |
|
| 379 | + } |
|
| 380 | + } |
|
| 381 | + return false; |
|
| 382 | + } |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * @inheritdoc |
|
| 386 | + */ |
|
| 387 | + public function getPersonalSettings($section): array { |
|
| 388 | + $settings = $this->getBuiltInPersonalSettings($section); |
|
| 389 | + $appSettings = $this->getSettings('personal', $section); |
|
| 390 | + |
|
| 391 | + foreach ($appSettings as $setting) { |
|
| 392 | + if (!isset($settings[$setting->getPriority()])) { |
|
| 393 | + $settings[$setting->getPriority()] = []; |
|
| 394 | + } |
|
| 395 | + $settings[$setting->getPriority()][] = $setting; |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + ksort($settings); |
|
| 399 | + return $settings; |
|
| 400 | + } |
|
| 401 | 401 | } |
@@ -59,289 +59,289 @@ discard block |
||
| 59 | 59 | * @package OC\Settings\Controller |
| 60 | 60 | */ |
| 61 | 61 | class CheckSetupController extends Controller { |
| 62 | - /** @var IConfig */ |
|
| 63 | - private $config; |
|
| 64 | - /** @var IClientService */ |
|
| 65 | - private $clientService; |
|
| 66 | - /** @var \OC_Util */ |
|
| 67 | - private $util; |
|
| 68 | - /** @var IURLGenerator */ |
|
| 69 | - private $urlGenerator; |
|
| 70 | - /** @var IL10N */ |
|
| 71 | - private $l10n; |
|
| 72 | - /** @var Checker */ |
|
| 73 | - private $checker; |
|
| 74 | - /** @var ILogger */ |
|
| 75 | - private $logger; |
|
| 76 | - /** @var EventDispatcherInterface */ |
|
| 77 | - private $dispatcher; |
|
| 78 | - /** @var IDBConnection|Connection */ |
|
| 79 | - private $db; |
|
| 80 | - /** @var ILockingProvider */ |
|
| 81 | - private $lockingProvider; |
|
| 82 | - /** @var IDateTimeFormatter */ |
|
| 83 | - private $dateTimeFormatter; |
|
| 84 | - |
|
| 85 | - public function __construct($AppName, |
|
| 86 | - IRequest $request, |
|
| 87 | - IConfig $config, |
|
| 88 | - IClientService $clientService, |
|
| 89 | - IURLGenerator $urlGenerator, |
|
| 90 | - \OC_Util $util, |
|
| 91 | - IL10N $l10n, |
|
| 92 | - Checker $checker, |
|
| 93 | - ILogger $logger, |
|
| 94 | - EventDispatcherInterface $dispatcher, |
|
| 95 | - IDBConnection $db, |
|
| 96 | - ILockingProvider $lockingProvider, |
|
| 97 | - IDateTimeFormatter $dateTimeFormatter) { |
|
| 98 | - parent::__construct($AppName, $request); |
|
| 99 | - $this->config = $config; |
|
| 100 | - $this->clientService = $clientService; |
|
| 101 | - $this->util = $util; |
|
| 102 | - $this->urlGenerator = $urlGenerator; |
|
| 103 | - $this->l10n = $l10n; |
|
| 104 | - $this->checker = $checker; |
|
| 105 | - $this->logger = $logger; |
|
| 106 | - $this->dispatcher = $dispatcher; |
|
| 107 | - $this->db = $db; |
|
| 108 | - $this->lockingProvider = $lockingProvider; |
|
| 109 | - $this->dateTimeFormatter = $dateTimeFormatter; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Checks if the server can connect to the internet using HTTPS and HTTP |
|
| 114 | - * @return bool |
|
| 115 | - */ |
|
| 116 | - private function isInternetConnectionWorking() { |
|
| 117 | - if ($this->config->getSystemValue('has_internet_connection', true) === false) { |
|
| 118 | - return false; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - $siteArray = ['www.nextcloud.com', |
|
| 122 | - 'www.startpage.com', |
|
| 123 | - 'www.eff.org', |
|
| 124 | - 'www.edri.org', |
|
| 125 | - ]; |
|
| 126 | - |
|
| 127 | - foreach($siteArray as $site) { |
|
| 128 | - if ($this->isSiteReachable($site)) { |
|
| 129 | - return true; |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - return false; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Checks if the Nextcloud server can connect to a specific URL using both HTTPS and HTTP |
|
| 137 | - * @return bool |
|
| 138 | - */ |
|
| 139 | - private function isSiteReachable($sitename) { |
|
| 140 | - $httpSiteName = 'http://' . $sitename . '/'; |
|
| 141 | - $httpsSiteName = 'https://' . $sitename . '/'; |
|
| 142 | - |
|
| 143 | - try { |
|
| 144 | - $client = $this->clientService->newClient(); |
|
| 145 | - $client->get($httpSiteName); |
|
| 146 | - $client->get($httpsSiteName); |
|
| 147 | - } catch (\Exception $e) { |
|
| 148 | - $this->logger->logException($e, ['app' => 'internet_connection_check']); |
|
| 149 | - return false; |
|
| 150 | - } |
|
| 151 | - return true; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Checks whether a local memcache is installed or not |
|
| 156 | - * @return bool |
|
| 157 | - */ |
|
| 158 | - private function isMemcacheConfigured() { |
|
| 159 | - return $this->config->getSystemValue('memcache.local', null) !== null; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Whether /dev/urandom is available to the PHP controller |
|
| 164 | - * |
|
| 165 | - * @return bool |
|
| 166 | - */ |
|
| 167 | - private function isUrandomAvailable() { |
|
| 168 | - if(@file_exists('/dev/urandom')) { |
|
| 169 | - $file = fopen('/dev/urandom', 'rb'); |
|
| 170 | - if($file) { |
|
| 171 | - fclose($file); |
|
| 172 | - return true; |
|
| 173 | - } |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - return false; |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * Public for the sake of unit-testing |
|
| 181 | - * |
|
| 182 | - * @return array |
|
| 183 | - */ |
|
| 184 | - protected function getCurlVersion() { |
|
| 185 | - return curl_version(); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * Check if the used SSL lib is outdated. Older OpenSSL and NSS versions do |
|
| 190 | - * have multiple bugs which likely lead to problems in combination with |
|
| 191 | - * functionality required by ownCloud such as SNI. |
|
| 192 | - * |
|
| 193 | - * @link https://github.com/owncloud/core/issues/17446#issuecomment-122877546 |
|
| 194 | - * @link https://bugzilla.redhat.com/show_bug.cgi?id=1241172 |
|
| 195 | - * @return string |
|
| 196 | - */ |
|
| 197 | - private function isUsedTlsLibOutdated() { |
|
| 198 | - // Don't run check when: |
|
| 199 | - // 1. Server has `has_internet_connection` set to false |
|
| 200 | - // 2. AppStore AND S2S is disabled |
|
| 201 | - if(!$this->config->getSystemValue('has_internet_connection', true)) { |
|
| 202 | - return ''; |
|
| 203 | - } |
|
| 204 | - if(!$this->config->getSystemValue('appstoreenabled', true) |
|
| 205 | - && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no' |
|
| 206 | - && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') { |
|
| 207 | - return ''; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - $versionString = $this->getCurlVersion(); |
|
| 211 | - if(isset($versionString['ssl_version'])) { |
|
| 212 | - $versionString = $versionString['ssl_version']; |
|
| 213 | - } else { |
|
| 214 | - return ''; |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); |
|
| 218 | - if(!$this->config->getSystemValue('appstoreenabled', true)) { |
|
| 219 | - $features = (string)$this->l10n->t('Federated Cloud Sharing'); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - // Check if at least OpenSSL after 1.01d or 1.0.2b |
|
| 223 | - if(strpos($versionString, 'OpenSSL/') === 0) { |
|
| 224 | - $majorVersion = substr($versionString, 8, 5); |
|
| 225 | - $patchRelease = substr($versionString, 13, 6); |
|
| 226 | - |
|
| 227 | - if(($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || |
|
| 228 | - ($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) { |
|
| 229 | - return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['OpenSSL', $versionString, $features]); |
|
| 230 | - } |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - // Check if NSS and perform heuristic check |
|
| 234 | - if(strpos($versionString, 'NSS/') === 0) { |
|
| 235 | - try { |
|
| 236 | - $firstClient = $this->clientService->newClient(); |
|
| 237 | - $firstClient->get('https://nextcloud.com/'); |
|
| 238 | - |
|
| 239 | - $secondClient = $this->clientService->newClient(); |
|
| 240 | - $secondClient->get('https://nextcloud.com/'); |
|
| 241 | - } catch (ClientException $e) { |
|
| 242 | - if($e->getResponse()->getStatusCode() === 400) { |
|
| 243 | - return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['NSS', $versionString, $features]); |
|
| 244 | - } |
|
| 245 | - } |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - return ''; |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * Whether the version is outdated |
|
| 253 | - * |
|
| 254 | - * @return bool |
|
| 255 | - */ |
|
| 256 | - protected function isPhpOutdated() { |
|
| 257 | - if (version_compare(PHP_VERSION, '7.0.0', '<')) { |
|
| 258 | - return true; |
|
| 259 | - } |
|
| 260 | - |
|
| 261 | - return false; |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Whether the php version is still supported (at time of release) |
|
| 266 | - * according to: https://secure.php.net/supported-versions.php |
|
| 267 | - * |
|
| 268 | - * @return array |
|
| 269 | - */ |
|
| 270 | - private function isPhpSupported() { |
|
| 271 | - return ['eol' => $this->isPhpOutdated(), 'version' => PHP_VERSION]; |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * Check if the reverse proxy configuration is working as expected |
|
| 276 | - * |
|
| 277 | - * @return bool |
|
| 278 | - */ |
|
| 279 | - private function forwardedForHeadersWorking() { |
|
| 280 | - $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); |
|
| 281 | - $remoteAddress = $this->request->getRemoteAddress(); |
|
| 282 | - |
|
| 283 | - if (is_array($trustedProxies) && in_array($remoteAddress, $trustedProxies)) { |
|
| 284 | - return false; |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - // either not enabled or working correctly |
|
| 288 | - return true; |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - /** |
|
| 292 | - * Checks if the correct memcache module for PHP is installed. Only |
|
| 293 | - * fails if memcached is configured and the working module is not installed. |
|
| 294 | - * |
|
| 295 | - * @return bool |
|
| 296 | - */ |
|
| 297 | - private function isCorrectMemcachedPHPModuleInstalled() { |
|
| 298 | - if ($this->config->getSystemValue('memcache.distributed', null) !== '\OC\Memcache\Memcached') { |
|
| 299 | - return true; |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - // there are two different memcached modules for PHP |
|
| 303 | - // we only support memcached and not memcache |
|
| 304 | - // https://code.google.com/p/memcached/wiki/PHPClientComparison |
|
| 305 | - return !(!extension_loaded('memcached') && extension_loaded('memcache')); |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * Checks if set_time_limit is not disabled. |
|
| 310 | - * |
|
| 311 | - * @return bool |
|
| 312 | - */ |
|
| 313 | - private function isSettimelimitAvailable() { |
|
| 314 | - if (function_exists('set_time_limit') |
|
| 315 | - && strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 316 | - return true; |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - return false; |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - /** |
|
| 323 | - * @return RedirectResponse |
|
| 324 | - */ |
|
| 325 | - public function rescanFailedIntegrityCheck() { |
|
| 326 | - $this->checker->runInstanceVerification(); |
|
| 327 | - return new RedirectResponse( |
|
| 328 | - $this->urlGenerator->linkToRoute('settings.AdminSettings.index') |
|
| 329 | - ); |
|
| 330 | - } |
|
| 331 | - |
|
| 332 | - /** |
|
| 333 | - * @NoCSRFRequired |
|
| 334 | - * @return DataResponse |
|
| 335 | - */ |
|
| 336 | - public function getFailedIntegrityCheckFiles() { |
|
| 337 | - if(!$this->checker->isCodeCheckEnforced()) { |
|
| 338 | - return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.'); |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - $completeResults = $this->checker->getResults(); |
|
| 342 | - |
|
| 343 | - if(!empty($completeResults)) { |
|
| 344 | - $formattedTextResponse = 'Technical information |
|
| 62 | + /** @var IConfig */ |
|
| 63 | + private $config; |
|
| 64 | + /** @var IClientService */ |
|
| 65 | + private $clientService; |
|
| 66 | + /** @var \OC_Util */ |
|
| 67 | + private $util; |
|
| 68 | + /** @var IURLGenerator */ |
|
| 69 | + private $urlGenerator; |
|
| 70 | + /** @var IL10N */ |
|
| 71 | + private $l10n; |
|
| 72 | + /** @var Checker */ |
|
| 73 | + private $checker; |
|
| 74 | + /** @var ILogger */ |
|
| 75 | + private $logger; |
|
| 76 | + /** @var EventDispatcherInterface */ |
|
| 77 | + private $dispatcher; |
|
| 78 | + /** @var IDBConnection|Connection */ |
|
| 79 | + private $db; |
|
| 80 | + /** @var ILockingProvider */ |
|
| 81 | + private $lockingProvider; |
|
| 82 | + /** @var IDateTimeFormatter */ |
|
| 83 | + private $dateTimeFormatter; |
|
| 84 | + |
|
| 85 | + public function __construct($AppName, |
|
| 86 | + IRequest $request, |
|
| 87 | + IConfig $config, |
|
| 88 | + IClientService $clientService, |
|
| 89 | + IURLGenerator $urlGenerator, |
|
| 90 | + \OC_Util $util, |
|
| 91 | + IL10N $l10n, |
|
| 92 | + Checker $checker, |
|
| 93 | + ILogger $logger, |
|
| 94 | + EventDispatcherInterface $dispatcher, |
|
| 95 | + IDBConnection $db, |
|
| 96 | + ILockingProvider $lockingProvider, |
|
| 97 | + IDateTimeFormatter $dateTimeFormatter) { |
|
| 98 | + parent::__construct($AppName, $request); |
|
| 99 | + $this->config = $config; |
|
| 100 | + $this->clientService = $clientService; |
|
| 101 | + $this->util = $util; |
|
| 102 | + $this->urlGenerator = $urlGenerator; |
|
| 103 | + $this->l10n = $l10n; |
|
| 104 | + $this->checker = $checker; |
|
| 105 | + $this->logger = $logger; |
|
| 106 | + $this->dispatcher = $dispatcher; |
|
| 107 | + $this->db = $db; |
|
| 108 | + $this->lockingProvider = $lockingProvider; |
|
| 109 | + $this->dateTimeFormatter = $dateTimeFormatter; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Checks if the server can connect to the internet using HTTPS and HTTP |
|
| 114 | + * @return bool |
|
| 115 | + */ |
|
| 116 | + private function isInternetConnectionWorking() { |
|
| 117 | + if ($this->config->getSystemValue('has_internet_connection', true) === false) { |
|
| 118 | + return false; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + $siteArray = ['www.nextcloud.com', |
|
| 122 | + 'www.startpage.com', |
|
| 123 | + 'www.eff.org', |
|
| 124 | + 'www.edri.org', |
|
| 125 | + ]; |
|
| 126 | + |
|
| 127 | + foreach($siteArray as $site) { |
|
| 128 | + if ($this->isSiteReachable($site)) { |
|
| 129 | + return true; |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + return false; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Checks if the Nextcloud server can connect to a specific URL using both HTTPS and HTTP |
|
| 137 | + * @return bool |
|
| 138 | + */ |
|
| 139 | + private function isSiteReachable($sitename) { |
|
| 140 | + $httpSiteName = 'http://' . $sitename . '/'; |
|
| 141 | + $httpsSiteName = 'https://' . $sitename . '/'; |
|
| 142 | + |
|
| 143 | + try { |
|
| 144 | + $client = $this->clientService->newClient(); |
|
| 145 | + $client->get($httpSiteName); |
|
| 146 | + $client->get($httpsSiteName); |
|
| 147 | + } catch (\Exception $e) { |
|
| 148 | + $this->logger->logException($e, ['app' => 'internet_connection_check']); |
|
| 149 | + return false; |
|
| 150 | + } |
|
| 151 | + return true; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Checks whether a local memcache is installed or not |
|
| 156 | + * @return bool |
|
| 157 | + */ |
|
| 158 | + private function isMemcacheConfigured() { |
|
| 159 | + return $this->config->getSystemValue('memcache.local', null) !== null; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Whether /dev/urandom is available to the PHP controller |
|
| 164 | + * |
|
| 165 | + * @return bool |
|
| 166 | + */ |
|
| 167 | + private function isUrandomAvailable() { |
|
| 168 | + if(@file_exists('/dev/urandom')) { |
|
| 169 | + $file = fopen('/dev/urandom', 'rb'); |
|
| 170 | + if($file) { |
|
| 171 | + fclose($file); |
|
| 172 | + return true; |
|
| 173 | + } |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + return false; |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * Public for the sake of unit-testing |
|
| 181 | + * |
|
| 182 | + * @return array |
|
| 183 | + */ |
|
| 184 | + protected function getCurlVersion() { |
|
| 185 | + return curl_version(); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * Check if the used SSL lib is outdated. Older OpenSSL and NSS versions do |
|
| 190 | + * have multiple bugs which likely lead to problems in combination with |
|
| 191 | + * functionality required by ownCloud such as SNI. |
|
| 192 | + * |
|
| 193 | + * @link https://github.com/owncloud/core/issues/17446#issuecomment-122877546 |
|
| 194 | + * @link https://bugzilla.redhat.com/show_bug.cgi?id=1241172 |
|
| 195 | + * @return string |
|
| 196 | + */ |
|
| 197 | + private function isUsedTlsLibOutdated() { |
|
| 198 | + // Don't run check when: |
|
| 199 | + // 1. Server has `has_internet_connection` set to false |
|
| 200 | + // 2. AppStore AND S2S is disabled |
|
| 201 | + if(!$this->config->getSystemValue('has_internet_connection', true)) { |
|
| 202 | + return ''; |
|
| 203 | + } |
|
| 204 | + if(!$this->config->getSystemValue('appstoreenabled', true) |
|
| 205 | + && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no' |
|
| 206 | + && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') { |
|
| 207 | + return ''; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + $versionString = $this->getCurlVersion(); |
|
| 211 | + if(isset($versionString['ssl_version'])) { |
|
| 212 | + $versionString = $versionString['ssl_version']; |
|
| 213 | + } else { |
|
| 214 | + return ''; |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); |
|
| 218 | + if(!$this->config->getSystemValue('appstoreenabled', true)) { |
|
| 219 | + $features = (string)$this->l10n->t('Federated Cloud Sharing'); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + // Check if at least OpenSSL after 1.01d or 1.0.2b |
|
| 223 | + if(strpos($versionString, 'OpenSSL/') === 0) { |
|
| 224 | + $majorVersion = substr($versionString, 8, 5); |
|
| 225 | + $patchRelease = substr($versionString, 13, 6); |
|
| 226 | + |
|
| 227 | + if(($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || |
|
| 228 | + ($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) { |
|
| 229 | + return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['OpenSSL', $versionString, $features]); |
|
| 230 | + } |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + // Check if NSS and perform heuristic check |
|
| 234 | + if(strpos($versionString, 'NSS/') === 0) { |
|
| 235 | + try { |
|
| 236 | + $firstClient = $this->clientService->newClient(); |
|
| 237 | + $firstClient->get('https://nextcloud.com/'); |
|
| 238 | + |
|
| 239 | + $secondClient = $this->clientService->newClient(); |
|
| 240 | + $secondClient->get('https://nextcloud.com/'); |
|
| 241 | + } catch (ClientException $e) { |
|
| 242 | + if($e->getResponse()->getStatusCode() === 400) { |
|
| 243 | + return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['NSS', $versionString, $features]); |
|
| 244 | + } |
|
| 245 | + } |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + return ''; |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * Whether the version is outdated |
|
| 253 | + * |
|
| 254 | + * @return bool |
|
| 255 | + */ |
|
| 256 | + protected function isPhpOutdated() { |
|
| 257 | + if (version_compare(PHP_VERSION, '7.0.0', '<')) { |
|
| 258 | + return true; |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + return false; |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Whether the php version is still supported (at time of release) |
|
| 266 | + * according to: https://secure.php.net/supported-versions.php |
|
| 267 | + * |
|
| 268 | + * @return array |
|
| 269 | + */ |
|
| 270 | + private function isPhpSupported() { |
|
| 271 | + return ['eol' => $this->isPhpOutdated(), 'version' => PHP_VERSION]; |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * Check if the reverse proxy configuration is working as expected |
|
| 276 | + * |
|
| 277 | + * @return bool |
|
| 278 | + */ |
|
| 279 | + private function forwardedForHeadersWorking() { |
|
| 280 | + $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); |
|
| 281 | + $remoteAddress = $this->request->getRemoteAddress(); |
|
| 282 | + |
|
| 283 | + if (is_array($trustedProxies) && in_array($remoteAddress, $trustedProxies)) { |
|
| 284 | + return false; |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + // either not enabled or working correctly |
|
| 288 | + return true; |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + /** |
|
| 292 | + * Checks if the correct memcache module for PHP is installed. Only |
|
| 293 | + * fails if memcached is configured and the working module is not installed. |
|
| 294 | + * |
|
| 295 | + * @return bool |
|
| 296 | + */ |
|
| 297 | + private function isCorrectMemcachedPHPModuleInstalled() { |
|
| 298 | + if ($this->config->getSystemValue('memcache.distributed', null) !== '\OC\Memcache\Memcached') { |
|
| 299 | + return true; |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + // there are two different memcached modules for PHP |
|
| 303 | + // we only support memcached and not memcache |
|
| 304 | + // https://code.google.com/p/memcached/wiki/PHPClientComparison |
|
| 305 | + return !(!extension_loaded('memcached') && extension_loaded('memcache')); |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * Checks if set_time_limit is not disabled. |
|
| 310 | + * |
|
| 311 | + * @return bool |
|
| 312 | + */ |
|
| 313 | + private function isSettimelimitAvailable() { |
|
| 314 | + if (function_exists('set_time_limit') |
|
| 315 | + && strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { |
|
| 316 | + return true; |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + return false; |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * @return RedirectResponse |
|
| 324 | + */ |
|
| 325 | + public function rescanFailedIntegrityCheck() { |
|
| 326 | + $this->checker->runInstanceVerification(); |
|
| 327 | + return new RedirectResponse( |
|
| 328 | + $this->urlGenerator->linkToRoute('settings.AdminSettings.index') |
|
| 329 | + ); |
|
| 330 | + } |
|
| 331 | + |
|
| 332 | + /** |
|
| 333 | + * @NoCSRFRequired |
|
| 334 | + * @return DataResponse |
|
| 335 | + */ |
|
| 336 | + public function getFailedIntegrityCheckFiles() { |
|
| 337 | + if(!$this->checker->isCodeCheckEnforced()) { |
|
| 338 | + return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.'); |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + $completeResults = $this->checker->getResults(); |
|
| 342 | + |
|
| 343 | + if(!empty($completeResults)) { |
|
| 344 | + $formattedTextResponse = 'Technical information |
|
| 345 | 345 | ===================== |
| 346 | 346 | The following list covers which files have failed the integrity check. Please read |
| 347 | 347 | the previous linked documentation to learn more about the errors and how to fix |
@@ -350,204 +350,204 @@ discard block |
||
| 350 | 350 | Results |
| 351 | 351 | ======= |
| 352 | 352 | '; |
| 353 | - foreach($completeResults as $context => $contextResult) { |
|
| 354 | - $formattedTextResponse .= "- $context\n"; |
|
| 355 | - |
|
| 356 | - foreach($contextResult as $category => $result) { |
|
| 357 | - $formattedTextResponse .= "\t- $category\n"; |
|
| 358 | - if($category !== 'EXCEPTION') { |
|
| 359 | - foreach ($result as $key => $results) { |
|
| 360 | - $formattedTextResponse .= "\t\t- $key\n"; |
|
| 361 | - } |
|
| 362 | - } else { |
|
| 363 | - foreach ($result as $key => $results) { |
|
| 364 | - $formattedTextResponse .= "\t\t- $results\n"; |
|
| 365 | - } |
|
| 366 | - } |
|
| 367 | - |
|
| 368 | - } |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - $formattedTextResponse .= ' |
|
| 353 | + foreach($completeResults as $context => $contextResult) { |
|
| 354 | + $formattedTextResponse .= "- $context\n"; |
|
| 355 | + |
|
| 356 | + foreach($contextResult as $category => $result) { |
|
| 357 | + $formattedTextResponse .= "\t- $category\n"; |
|
| 358 | + if($category !== 'EXCEPTION') { |
|
| 359 | + foreach ($result as $key => $results) { |
|
| 360 | + $formattedTextResponse .= "\t\t- $key\n"; |
|
| 361 | + } |
|
| 362 | + } else { |
|
| 363 | + foreach ($result as $key => $results) { |
|
| 364 | + $formattedTextResponse .= "\t\t- $results\n"; |
|
| 365 | + } |
|
| 366 | + } |
|
| 367 | + |
|
| 368 | + } |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + $formattedTextResponse .= ' |
|
| 372 | 372 | Raw output |
| 373 | 373 | ========== |
| 374 | 374 | '; |
| 375 | - $formattedTextResponse .= print_r($completeResults, true); |
|
| 376 | - } else { |
|
| 377 | - $formattedTextResponse = 'No errors have been found.'; |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - |
|
| 381 | - $response = new DataDisplayResponse( |
|
| 382 | - $formattedTextResponse, |
|
| 383 | - Http::STATUS_OK, |
|
| 384 | - [ |
|
| 385 | - 'Content-Type' => 'text/plain', |
|
| 386 | - ] |
|
| 387 | - ); |
|
| 388 | - |
|
| 389 | - return $response; |
|
| 390 | - } |
|
| 391 | - |
|
| 392 | - /** |
|
| 393 | - * Checks whether a PHP opcache is properly set up |
|
| 394 | - * @return bool |
|
| 395 | - */ |
|
| 396 | - protected function isOpcacheProperlySetup() { |
|
| 397 | - $iniWrapper = new IniGetWrapper(); |
|
| 398 | - |
|
| 399 | - $isOpcacheProperlySetUp = true; |
|
| 400 | - |
|
| 401 | - if(!$iniWrapper->getBool('opcache.enable')) { |
|
| 402 | - $isOpcacheProperlySetUp = false; |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - if(!$iniWrapper->getBool('opcache.save_comments')) { |
|
| 406 | - $isOpcacheProperlySetUp = false; |
|
| 407 | - } |
|
| 408 | - |
|
| 409 | - if(!$iniWrapper->getBool('opcache.enable_cli')) { |
|
| 410 | - $isOpcacheProperlySetUp = false; |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - if($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { |
|
| 414 | - $isOpcacheProperlySetUp = false; |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - if($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { |
|
| 418 | - $isOpcacheProperlySetUp = false; |
|
| 419 | - } |
|
| 420 | - |
|
| 421 | - if($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { |
|
| 422 | - $isOpcacheProperlySetUp = false; |
|
| 423 | - } |
|
| 424 | - |
|
| 425 | - return $isOpcacheProperlySetUp; |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - /** |
|
| 429 | - * Check if the required FreeType functions are present |
|
| 430 | - * @return bool |
|
| 431 | - */ |
|
| 432 | - protected function hasFreeTypeSupport() { |
|
| 433 | - return function_exists('imagettfbbox') && function_exists('imagettftext'); |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - protected function hasMissingIndexes(): array { |
|
| 437 | - $indexInfo = new MissingIndexInformation(); |
|
| 438 | - // Dispatch event so apps can also hint for pending index updates if needed |
|
| 439 | - $event = new GenericEvent($indexInfo); |
|
| 440 | - $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_INDEXES_EVENT, $event); |
|
| 441 | - |
|
| 442 | - return $indexInfo->getListOfMissingIndexes(); |
|
| 443 | - } |
|
| 444 | - |
|
| 445 | - /** |
|
| 446 | - * warn if outdated version of a memcache module is used |
|
| 447 | - */ |
|
| 448 | - protected function getOutdatedCaches(): array { |
|
| 449 | - $caches = [ |
|
| 450 | - 'apcu' => ['name' => 'APCu', 'version' => '4.0.6'], |
|
| 451 | - 'redis' => ['name' => 'Redis', 'version' => '2.2.5'], |
|
| 452 | - ]; |
|
| 453 | - $outdatedCaches = []; |
|
| 454 | - foreach ($caches as $php_module => $data) { |
|
| 455 | - $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<'); |
|
| 456 | - if ($isOutdated) { |
|
| 457 | - $outdatedCaches[] = $data; |
|
| 458 | - } |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - return $outdatedCaches; |
|
| 462 | - } |
|
| 463 | - |
|
| 464 | - protected function isSqliteUsed() { |
|
| 465 | - return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false; |
|
| 466 | - } |
|
| 467 | - |
|
| 468 | - protected function isReadOnlyConfig(): bool { |
|
| 469 | - return \OC_Helper::isReadOnlyConfigEnabled(); |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - protected function hasValidTransactionIsolationLevel(): bool { |
|
| 473 | - try { |
|
| 474 | - if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { |
|
| 475 | - return true; |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - return $this->db->getTransactionIsolation() === Connection::TRANSACTION_READ_COMMITTED; |
|
| 479 | - } catch (DBALException $e) { |
|
| 480 | - // ignore |
|
| 481 | - } |
|
| 482 | - |
|
| 483 | - return true; |
|
| 484 | - } |
|
| 485 | - |
|
| 486 | - protected function hasFileinfoInstalled(): bool { |
|
| 487 | - return \OC_Util::fileInfoLoaded(); |
|
| 488 | - } |
|
| 489 | - |
|
| 490 | - protected function hasWorkingFileLocking(): bool { |
|
| 491 | - return !($this->lockingProvider instanceof NoopLockingProvider); |
|
| 492 | - } |
|
| 493 | - |
|
| 494 | - protected function getSuggestedOverwriteCliURL(): string { |
|
| 495 | - $suggestedOverwriteCliUrl = ''; |
|
| 496 | - if ($this->config->getSystemValue('overwrite.cli.url', '') === '') { |
|
| 497 | - $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT; |
|
| 498 | - if (!$this->config->getSystemValue('config_is_read_only', false)) { |
|
| 499 | - // Set the overwrite URL when it was not set yet. |
|
| 500 | - $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl); |
|
| 501 | - $suggestedOverwriteCliUrl = ''; |
|
| 502 | - } |
|
| 503 | - } |
|
| 504 | - return $suggestedOverwriteCliUrl; |
|
| 505 | - } |
|
| 506 | - |
|
| 507 | - protected function getLastCronInfo(): array { |
|
| 508 | - $lastCronRun = $this->config->getAppValue('core', 'lastcron', 0); |
|
| 509 | - return [ |
|
| 510 | - 'diffInSeconds' => time() - $lastCronRun, |
|
| 511 | - 'relativeTime' => $this->dateTimeFormatter->formatTimeSpan($lastCronRun), |
|
| 512 | - 'backgroundJobsUrl' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'server']) . '#backgroundjobs', |
|
| 513 | - ]; |
|
| 514 | - } |
|
| 515 | - |
|
| 516 | - /** |
|
| 517 | - * @return DataResponse |
|
| 518 | - */ |
|
| 519 | - public function check() { |
|
| 520 | - return new DataResponse( |
|
| 521 | - [ |
|
| 522 | - 'isGetenvServerWorking' => !empty(getenv('PATH')), |
|
| 523 | - 'isReadOnlyConfig' => $this->isReadOnlyConfig(), |
|
| 524 | - 'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(), |
|
| 525 | - 'outdatedCaches' => $this->getOutdatedCaches(), |
|
| 526 | - 'hasFileinfoInstalled' => $this->hasFileinfoInstalled(), |
|
| 527 | - 'hasWorkingFileLocking' => $this->hasWorkingFileLocking(), |
|
| 528 | - 'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(), |
|
| 529 | - 'cronInfo' => $this->getLastCronInfo(), |
|
| 530 | - 'cronErrors' => json_decode($this->config->getAppValue('core', 'cronErrors', ''), true), |
|
| 531 | - 'serverHasInternetConnection' => $this->isInternetConnectionWorking(), |
|
| 532 | - 'isMemcacheConfigured' => $this->isMemcacheConfigured(), |
|
| 533 | - 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), |
|
| 534 | - 'isUrandomAvailable' => $this->isUrandomAvailable(), |
|
| 535 | - 'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'), |
|
| 536 | - 'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(), |
|
| 537 | - 'phpSupported' => $this->isPhpSupported(), |
|
| 538 | - 'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(), |
|
| 539 | - 'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'), |
|
| 540 | - 'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(), |
|
| 541 | - 'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(), |
|
| 542 | - 'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'), |
|
| 543 | - 'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(), |
|
| 544 | - 'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'), |
|
| 545 | - 'isSettimelimitAvailable' => $this->isSettimelimitAvailable(), |
|
| 546 | - 'hasFreeTypeSupport' => $this->hasFreeTypeSupport(), |
|
| 547 | - 'missingIndexes' => $this->hasMissingIndexes(), |
|
| 548 | - 'isSqliteUsed' => $this->isSqliteUsed(), |
|
| 549 | - 'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'), |
|
| 550 | - ] |
|
| 551 | - ); |
|
| 552 | - } |
|
| 375 | + $formattedTextResponse .= print_r($completeResults, true); |
|
| 376 | + } else { |
|
| 377 | + $formattedTextResponse = 'No errors have been found.'; |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + |
|
| 381 | + $response = new DataDisplayResponse( |
|
| 382 | + $formattedTextResponse, |
|
| 383 | + Http::STATUS_OK, |
|
| 384 | + [ |
|
| 385 | + 'Content-Type' => 'text/plain', |
|
| 386 | + ] |
|
| 387 | + ); |
|
| 388 | + |
|
| 389 | + return $response; |
|
| 390 | + } |
|
| 391 | + |
|
| 392 | + /** |
|
| 393 | + * Checks whether a PHP opcache is properly set up |
|
| 394 | + * @return bool |
|
| 395 | + */ |
|
| 396 | + protected function isOpcacheProperlySetup() { |
|
| 397 | + $iniWrapper = new IniGetWrapper(); |
|
| 398 | + |
|
| 399 | + $isOpcacheProperlySetUp = true; |
|
| 400 | + |
|
| 401 | + if(!$iniWrapper->getBool('opcache.enable')) { |
|
| 402 | + $isOpcacheProperlySetUp = false; |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + if(!$iniWrapper->getBool('opcache.save_comments')) { |
|
| 406 | + $isOpcacheProperlySetUp = false; |
|
| 407 | + } |
|
| 408 | + |
|
| 409 | + if(!$iniWrapper->getBool('opcache.enable_cli')) { |
|
| 410 | + $isOpcacheProperlySetUp = false; |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + if($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { |
|
| 414 | + $isOpcacheProperlySetUp = false; |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + if($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { |
|
| 418 | + $isOpcacheProperlySetUp = false; |
|
| 419 | + } |
|
| 420 | + |
|
| 421 | + if($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { |
|
| 422 | + $isOpcacheProperlySetUp = false; |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + return $isOpcacheProperlySetUp; |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + /** |
|
| 429 | + * Check if the required FreeType functions are present |
|
| 430 | + * @return bool |
|
| 431 | + */ |
|
| 432 | + protected function hasFreeTypeSupport() { |
|
| 433 | + return function_exists('imagettfbbox') && function_exists('imagettftext'); |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + protected function hasMissingIndexes(): array { |
|
| 437 | + $indexInfo = new MissingIndexInformation(); |
|
| 438 | + // Dispatch event so apps can also hint for pending index updates if needed |
|
| 439 | + $event = new GenericEvent($indexInfo); |
|
| 440 | + $this->dispatcher->dispatch(IDBConnection::CHECK_MISSING_INDEXES_EVENT, $event); |
|
| 441 | + |
|
| 442 | + return $indexInfo->getListOfMissingIndexes(); |
|
| 443 | + } |
|
| 444 | + |
|
| 445 | + /** |
|
| 446 | + * warn if outdated version of a memcache module is used |
|
| 447 | + */ |
|
| 448 | + protected function getOutdatedCaches(): array { |
|
| 449 | + $caches = [ |
|
| 450 | + 'apcu' => ['name' => 'APCu', 'version' => '4.0.6'], |
|
| 451 | + 'redis' => ['name' => 'Redis', 'version' => '2.2.5'], |
|
| 452 | + ]; |
|
| 453 | + $outdatedCaches = []; |
|
| 454 | + foreach ($caches as $php_module => $data) { |
|
| 455 | + $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<'); |
|
| 456 | + if ($isOutdated) { |
|
| 457 | + $outdatedCaches[] = $data; |
|
| 458 | + } |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + return $outdatedCaches; |
|
| 462 | + } |
|
| 463 | + |
|
| 464 | + protected function isSqliteUsed() { |
|
| 465 | + return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false; |
|
| 466 | + } |
|
| 467 | + |
|
| 468 | + protected function isReadOnlyConfig(): bool { |
|
| 469 | + return \OC_Helper::isReadOnlyConfigEnabled(); |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + protected function hasValidTransactionIsolationLevel(): bool { |
|
| 473 | + try { |
|
| 474 | + if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { |
|
| 475 | + return true; |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + return $this->db->getTransactionIsolation() === Connection::TRANSACTION_READ_COMMITTED; |
|
| 479 | + } catch (DBALException $e) { |
|
| 480 | + // ignore |
|
| 481 | + } |
|
| 482 | + |
|
| 483 | + return true; |
|
| 484 | + } |
|
| 485 | + |
|
| 486 | + protected function hasFileinfoInstalled(): bool { |
|
| 487 | + return \OC_Util::fileInfoLoaded(); |
|
| 488 | + } |
|
| 489 | + |
|
| 490 | + protected function hasWorkingFileLocking(): bool { |
|
| 491 | + return !($this->lockingProvider instanceof NoopLockingProvider); |
|
| 492 | + } |
|
| 493 | + |
|
| 494 | + protected function getSuggestedOverwriteCliURL(): string { |
|
| 495 | + $suggestedOverwriteCliUrl = ''; |
|
| 496 | + if ($this->config->getSystemValue('overwrite.cli.url', '') === '') { |
|
| 497 | + $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT; |
|
| 498 | + if (!$this->config->getSystemValue('config_is_read_only', false)) { |
|
| 499 | + // Set the overwrite URL when it was not set yet. |
|
| 500 | + $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl); |
|
| 501 | + $suggestedOverwriteCliUrl = ''; |
|
| 502 | + } |
|
| 503 | + } |
|
| 504 | + return $suggestedOverwriteCliUrl; |
|
| 505 | + } |
|
| 506 | + |
|
| 507 | + protected function getLastCronInfo(): array { |
|
| 508 | + $lastCronRun = $this->config->getAppValue('core', 'lastcron', 0); |
|
| 509 | + return [ |
|
| 510 | + 'diffInSeconds' => time() - $lastCronRun, |
|
| 511 | + 'relativeTime' => $this->dateTimeFormatter->formatTimeSpan($lastCronRun), |
|
| 512 | + 'backgroundJobsUrl' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'server']) . '#backgroundjobs', |
|
| 513 | + ]; |
|
| 514 | + } |
|
| 515 | + |
|
| 516 | + /** |
|
| 517 | + * @return DataResponse |
|
| 518 | + */ |
|
| 519 | + public function check() { |
|
| 520 | + return new DataResponse( |
|
| 521 | + [ |
|
| 522 | + 'isGetenvServerWorking' => !empty(getenv('PATH')), |
|
| 523 | + 'isReadOnlyConfig' => $this->isReadOnlyConfig(), |
|
| 524 | + 'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(), |
|
| 525 | + 'outdatedCaches' => $this->getOutdatedCaches(), |
|
| 526 | + 'hasFileinfoInstalled' => $this->hasFileinfoInstalled(), |
|
| 527 | + 'hasWorkingFileLocking' => $this->hasWorkingFileLocking(), |
|
| 528 | + 'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(), |
|
| 529 | + 'cronInfo' => $this->getLastCronInfo(), |
|
| 530 | + 'cronErrors' => json_decode($this->config->getAppValue('core', 'cronErrors', ''), true), |
|
| 531 | + 'serverHasInternetConnection' => $this->isInternetConnectionWorking(), |
|
| 532 | + 'isMemcacheConfigured' => $this->isMemcacheConfigured(), |
|
| 533 | + 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), |
|
| 534 | + 'isUrandomAvailable' => $this->isUrandomAvailable(), |
|
| 535 | + 'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'), |
|
| 536 | + 'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(), |
|
| 537 | + 'phpSupported' => $this->isPhpSupported(), |
|
| 538 | + 'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(), |
|
| 539 | + 'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'), |
|
| 540 | + 'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(), |
|
| 541 | + 'hasPassedCodeIntegrityCheck' => $this->checker->hasPassedCheck(), |
|
| 542 | + 'codeIntegrityCheckerDocumentation' => $this->urlGenerator->linkToDocs('admin-code-integrity'), |
|
| 543 | + 'isOpcacheProperlySetup' => $this->isOpcacheProperlySetup(), |
|
| 544 | + 'phpOpcacheDocumentation' => $this->urlGenerator->linkToDocs('admin-php-opcache'), |
|
| 545 | + 'isSettimelimitAvailable' => $this->isSettimelimitAvailable(), |
|
| 546 | + 'hasFreeTypeSupport' => $this->hasFreeTypeSupport(), |
|
| 547 | + 'missingIndexes' => $this->hasMissingIndexes(), |
|
| 548 | + 'isSqliteUsed' => $this->isSqliteUsed(), |
|
| 549 | + 'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'), |
|
| 550 | + ] |
|
| 551 | + ); |
|
| 552 | + } |
|
| 553 | 553 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | 'www.edri.org', |
| 125 | 125 | ]; |
| 126 | 126 | |
| 127 | - foreach($siteArray as $site) { |
|
| 127 | + foreach ($siteArray as $site) { |
|
| 128 | 128 | if ($this->isSiteReachable($site)) { |
| 129 | 129 | return true; |
| 130 | 130 | } |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | * @return bool |
| 138 | 138 | */ |
| 139 | 139 | private function isSiteReachable($sitename) { |
| 140 | - $httpSiteName = 'http://' . $sitename . '/'; |
|
| 141 | - $httpsSiteName = 'https://' . $sitename . '/'; |
|
| 140 | + $httpSiteName = 'http://'.$sitename.'/'; |
|
| 141 | + $httpsSiteName = 'https://'.$sitename.'/'; |
|
| 142 | 142 | |
| 143 | 143 | try { |
| 144 | 144 | $client = $this->clientService->newClient(); |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | * @return bool |
| 166 | 166 | */ |
| 167 | 167 | private function isUrandomAvailable() { |
| 168 | - if(@file_exists('/dev/urandom')) { |
|
| 168 | + if (@file_exists('/dev/urandom')) { |
|
| 169 | 169 | $file = fopen('/dev/urandom', 'rb'); |
| 170 | - if($file) { |
|
| 170 | + if ($file) { |
|
| 171 | 171 | fclose($file); |
| 172 | 172 | return true; |
| 173 | 173 | } |
@@ -198,40 +198,40 @@ discard block |
||
| 198 | 198 | // Don't run check when: |
| 199 | 199 | // 1. Server has `has_internet_connection` set to false |
| 200 | 200 | // 2. AppStore AND S2S is disabled |
| 201 | - if(!$this->config->getSystemValue('has_internet_connection', true)) { |
|
| 201 | + if (!$this->config->getSystemValue('has_internet_connection', true)) { |
|
| 202 | 202 | return ''; |
| 203 | 203 | } |
| 204 | - if(!$this->config->getSystemValue('appstoreenabled', true) |
|
| 204 | + if (!$this->config->getSystemValue('appstoreenabled', true) |
|
| 205 | 205 | && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no' |
| 206 | 206 | && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') { |
| 207 | 207 | return ''; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | $versionString = $this->getCurlVersion(); |
| 211 | - if(isset($versionString['ssl_version'])) { |
|
| 211 | + if (isset($versionString['ssl_version'])) { |
|
| 212 | 212 | $versionString = $versionString['ssl_version']; |
| 213 | 213 | } else { |
| 214 | 214 | return ''; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); |
|
| 218 | - if(!$this->config->getSystemValue('appstoreenabled', true)) { |
|
| 219 | - $features = (string)$this->l10n->t('Federated Cloud Sharing'); |
|
| 217 | + $features = (string) $this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); |
|
| 218 | + if (!$this->config->getSystemValue('appstoreenabled', true)) { |
|
| 219 | + $features = (string) $this->l10n->t('Federated Cloud Sharing'); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // Check if at least OpenSSL after 1.01d or 1.0.2b |
| 223 | - if(strpos($versionString, 'OpenSSL/') === 0) { |
|
| 223 | + if (strpos($versionString, 'OpenSSL/') === 0) { |
|
| 224 | 224 | $majorVersion = substr($versionString, 8, 5); |
| 225 | 225 | $patchRelease = substr($versionString, 13, 6); |
| 226 | 226 | |
| 227 | - if(($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || |
|
| 227 | + if (($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || |
|
| 228 | 228 | ($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) { |
| 229 | 229 | return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['OpenSSL', $versionString, $features]); |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // Check if NSS and perform heuristic check |
| 234 | - if(strpos($versionString, 'NSS/') === 0) { |
|
| 234 | + if (strpos($versionString, 'NSS/') === 0) { |
|
| 235 | 235 | try { |
| 236 | 236 | $firstClient = $this->clientService->newClient(); |
| 237 | 237 | $firstClient->get('https://nextcloud.com/'); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $secondClient = $this->clientService->newClient(); |
| 240 | 240 | $secondClient->get('https://nextcloud.com/'); |
| 241 | 241 | } catch (ClientException $e) { |
| 242 | - if($e->getResponse()->getStatusCode() === 400) { |
|
| 242 | + if ($e->getResponse()->getStatusCode() === 400) { |
|
| 243 | 243 | return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['NSS', $versionString, $features]); |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -334,13 +334,13 @@ discard block |
||
| 334 | 334 | * @return DataResponse |
| 335 | 335 | */ |
| 336 | 336 | public function getFailedIntegrityCheckFiles() { |
| 337 | - if(!$this->checker->isCodeCheckEnforced()) { |
|
| 337 | + if (!$this->checker->isCodeCheckEnforced()) { |
|
| 338 | 338 | return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.'); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | $completeResults = $this->checker->getResults(); |
| 342 | 342 | |
| 343 | - if(!empty($completeResults)) { |
|
| 343 | + if (!empty($completeResults)) { |
|
| 344 | 344 | $formattedTextResponse = 'Technical information |
| 345 | 345 | ===================== |
| 346 | 346 | The following list covers which files have failed the integrity check. Please read |
@@ -350,12 +350,12 @@ discard block |
||
| 350 | 350 | Results |
| 351 | 351 | ======= |
| 352 | 352 | '; |
| 353 | - foreach($completeResults as $context => $contextResult) { |
|
| 353 | + foreach ($completeResults as $context => $contextResult) { |
|
| 354 | 354 | $formattedTextResponse .= "- $context\n"; |
| 355 | 355 | |
| 356 | - foreach($contextResult as $category => $result) { |
|
| 356 | + foreach ($contextResult as $category => $result) { |
|
| 357 | 357 | $formattedTextResponse .= "\t- $category\n"; |
| 358 | - if($category !== 'EXCEPTION') { |
|
| 358 | + if ($category !== 'EXCEPTION') { |
|
| 359 | 359 | foreach ($result as $key => $results) { |
| 360 | 360 | $formattedTextResponse .= "\t\t- $key\n"; |
| 361 | 361 | } |
@@ -398,27 +398,27 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | $isOpcacheProperlySetUp = true; |
| 400 | 400 | |
| 401 | - if(!$iniWrapper->getBool('opcache.enable')) { |
|
| 401 | + if (!$iniWrapper->getBool('opcache.enable')) { |
|
| 402 | 402 | $isOpcacheProperlySetUp = false; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - if(!$iniWrapper->getBool('opcache.save_comments')) { |
|
| 405 | + if (!$iniWrapper->getBool('opcache.save_comments')) { |
|
| 406 | 406 | $isOpcacheProperlySetUp = false; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - if(!$iniWrapper->getBool('opcache.enable_cli')) { |
|
| 409 | + if (!$iniWrapper->getBool('opcache.enable_cli')) { |
|
| 410 | 410 | $isOpcacheProperlySetUp = false; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - if($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { |
|
| 413 | + if ($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { |
|
| 414 | 414 | $isOpcacheProperlySetUp = false; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - if($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { |
|
| 417 | + if ($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { |
|
| 418 | 418 | $isOpcacheProperlySetUp = false; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - if($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { |
|
| 421 | + if ($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { |
|
| 422 | 422 | $isOpcacheProperlySetUp = false; |
| 423 | 423 | } |
| 424 | 424 | |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | protected function getSuggestedOverwriteCliURL(): string { |
| 495 | 495 | $suggestedOverwriteCliUrl = ''; |
| 496 | 496 | if ($this->config->getSystemValue('overwrite.cli.url', '') === '') { |
| 497 | - $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT; |
|
| 497 | + $suggestedOverwriteCliUrl = $this->request->getServerProtocol().'://'.$this->request->getInsecureServerHost().\OC::$WEBROOT; |
|
| 498 | 498 | if (!$this->config->getSystemValue('config_is_read_only', false)) { |
| 499 | 499 | // Set the overwrite URL when it was not set yet. |
| 500 | 500 | $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl); |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | return [ |
| 510 | 510 | 'diffInSeconds' => time() - $lastCronRun, |
| 511 | 511 | 'relativeTime' => $this->dateTimeFormatter->formatTimeSpan($lastCronRun), |
| 512 | - 'backgroundJobsUrl' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'server']) . '#backgroundjobs', |
|
| 512 | + 'backgroundJobsUrl' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'server']).'#backgroundjobs', |
|
| 513 | 513 | ]; |
| 514 | 514 | } |
| 515 | 515 | |
@@ -28,39 +28,39 @@ |
||
| 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 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> |