Skip to content

Commit 9f0028c

Browse files
authored
Merge pull request #44182 from nextcloud/backport/43334/stable28
2 parents ea9e01e + 0bea514 commit 9f0028c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/settings/lib/Settings/Admin/Server.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,17 @@ public function __construct(IDBConnection $connection,
6767
* @return TemplateResponse
6868
*/
6969
public function getForm() {
70+
$ownerConfigFile = fileowner(\OC::$configDir . 'config.php');
71+
$cliBasedCronPossible = function_exists('posix_getpwuid') && $ownerConfigFile !== false;
72+
$cliBasedCronUser = $cliBasedCronPossible ? (posix_getpwuid($ownerConfigFile)['name'] ?? '') : '';
73+
7074
// Background jobs
7175
$this->initialStateService->provideInitialState('backgroundJobsMode', $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'));
7276
$this->initialStateService->provideInitialState('lastCron', (int)$this->config->getAppValue('core', 'lastcron', '0'));
7377
$this->initialStateService->provideInitialState('cronMaxAge', $this->cronMaxAge());
7478
$this->initialStateService->provideInitialState('cronErrors', $this->config->getAppValue('core', 'cronErrors'));
75-
$this->initialStateService->provideInitialState('cliBasedCronPossible', function_exists('posix_getpwuid'));
76-
$this->initialStateService->provideInitialState('cliBasedCronUser', function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '');
79+
$this->initialStateService->provideInitialState('cliBasedCronPossible', $cliBasedCronPossible);
80+
$this->initialStateService->provideInitialState('cliBasedCronUser', $cliBasedCronUser);
7781
$this->initialStateService->provideInitialState('backgroundJobsDocUrl', $this->urlGenerator->linkToDocs('admin-background-jobs'));
7882

7983
// Profile page

0 commit comments

Comments
 (0)