diff options
Diffstat (limited to 'apps/settings/lib/Settings/Admin/Server.php')
-rw-r--r-- | apps/settings/lib/Settings/Admin/Server.php | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/apps/settings/lib/Settings/Admin/Server.php b/apps/settings/lib/Settings/Admin/Server.php index 0fe98f21c8f..0d8ef00a1fd 100644 --- a/apps/settings/lib/Settings/Admin/Server.php +++ b/apps/settings/lib/Settings/Admin/Server.php @@ -33,28 +33,25 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; +use OCP\IURLGenerator; use OCP\Settings\IDelegatedSettings; class Server implements IDelegatedSettings { use TProfileHelper; - /** @var IDBConnection */ - private $connection; - /** @var IInitialState */ - private $initialStateService; - /** @var ProfileManager */ - private $profileManager; - /** @var ITimeFactory */ - private $timeFactory; - /** @var IConfig */ - private $config; - /** @var IL10N $l */ - private $l; + private IDBConnection $connection; + private IInitialState $initialStateService; + private ProfileManager $profileManager; + private ITimeFactory $timeFactory; + private IConfig $config; + private IL10N $l; + private IURLGenerator $urlGenerator; public function __construct(IDBConnection $connection, IInitialState $initialStateService, ProfileManager $profileManager, ITimeFactory $timeFactory, + IURLGenerator $urlGenerator, IConfig $config, IL10N $l) { $this->connection = $connection; @@ -63,27 +60,29 @@ class Server implements IDelegatedSettings { $this->timeFactory = $timeFactory; $this->config = $config; $this->l = $l; + $this->urlGenerator = $urlGenerator; } /** * @return TemplateResponse */ public function getForm() { - $parameters = [ - // Background jobs - 'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'), - 'lastcron' => $this->config->getAppValue('core', 'lastcron', false), - 'cronMaxAge' => $this->cronMaxAge(), - 'cronErrors' => $this->config->getAppValue('core', 'cronErrors'), - 'cli_based_cron_possible' => function_exists('posix_getpwuid'), - 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '', - 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), - ]; + // Background jobs + $this->initialStateService->provideInitialState('backgroundJobsMode', $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax')); + $this->initialStateService->provideInitialState('lastCron', (int)$this->config->getAppValue('core', 'lastcron', '0')); + $this->initialStateService->provideInitialState('cronMaxAge', $this->cronMaxAge()); + $this->initialStateService->provideInitialState('cronErrors', $this->config->getAppValue('core', 'cronErrors')); + $this->initialStateService->provideInitialState('cliBasedCronPossible', function_exists('posix_getpwuid')); + $this->initialStateService->provideInitialState('cliBasedCronUser', function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : ''); + $this->initialStateService->provideInitialState('backgroundJobsDocUrl', $this->urlGenerator->linkToDocs('admin-background-jobs')); + // Profile page $this->initialStateService->provideInitialState('profileEnabledGlobally', $this->profileManager->isProfileEnabled()); $this->initialStateService->provideInitialState('profileEnabledByDefault', $this->isProfileEnabledByDefault($this->config)); - return new TemplateResponse('settings', 'settings/admin/server', $parameters, ''); + return new TemplateResponse('settings', 'settings/admin/server', [ + 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), + ], ''); } protected function cronMaxAge(): int { |