diff --git a/lib/private/Settings/Admin/Server.php b/lib/private/Settings/Admin/Server.php index 6b381ab48e..8b1477a025 100644 --- a/lib/private/Settings/Admin/Server.php +++ b/lib/private/Settings/Admin/Server.php @@ -124,6 +124,8 @@ class Server implements ISettings { 'cron_log' => $this->config->getSystemValue('cron_log', true), 'lastcron' => $this->config->getAppValue('core', 'lastcron', false), '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'] : '', ]; return new TemplateResponse('settings', 'admin/server', $parameters, ''); diff --git a/settings/templates/admin/server.php b/settings/templates/admin/server.php index 02d247e1b1..430ca6ac8e 100644 --- a/settings/templates/admin/server.php +++ b/settings/templates/admin/server.php @@ -201,9 +201,22 @@ > + } + if (!$_['cli_based_cron_possible']) { + print_unescaped('disabled'); + }?>>
- t("Use system's cron service to call the cron.php file every 15 minutes.")); ?> + t("Use system's cron service to call the cron.php file every 15 minutes.")); ?> + t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']])); + } else { + print_unescaped(str_replace( + ['{linkstart}', '{linkend}'], + ['', ' ↗'], + $l->t('To run this you need the PHP posix extension. See {linkstart}PHP documentation{linkend} for more details.') + )); + } ?> +

diff --git a/tests/lib/Settings/Admin/ServerTest.php b/tests/lib/Settings/Admin/ServerTest.php index 874422307e..43892c408b 100644 --- a/tests/lib/Settings/Admin/ServerTest.php +++ b/tests/lib/Settings/Admin/ServerTest.php @@ -136,7 +136,9 @@ class ServerTest extends TestCase { 'backgroundjobs_mode' => 'ajax', 'cron_log' => true, 'lastcron' => false, - 'cronErrors' => '' + 'cronErrors' => '', + 'cli_based_cron_possible' => true, + 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '', // to not explode here because of posix extension not being disabled - which is already checked in the line above ], '' );