Merge pull request #1994 from nextcloud/proper-cron-hints
Show a hint for system based cron user name
This commit is contained in:
commit
7ba7949dc1
|
@ -124,6 +124,8 @@ class Server implements ISettings {
|
||||||
'cron_log' => $this->config->getSystemValue('cron_log', true),
|
'cron_log' => $this->config->getSystemValue('cron_log', true),
|
||||||
'lastcron' => $this->config->getAppValue('core', 'lastcron', false),
|
'lastcron' => $this->config->getAppValue('core', 'lastcron', false),
|
||||||
'cronErrors' => $this->config->getAppValue('core', 'cronErrors'),
|
'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, '');
|
return new TemplateResponse('settings', 'admin/server', $parameters, '');
|
||||||
|
|
|
@ -201,9 +201,22 @@
|
||||||
<input type="radio" name="mode" value="cron" class="radio"
|
<input type="radio" name="mode" value="cron" class="radio"
|
||||||
id="backgroundjobs_cron" <?php if ($_['backgroundjobs_mode'] === "cron") {
|
id="backgroundjobs_cron" <?php if ($_['backgroundjobs_mode'] === "cron") {
|
||||||
print_unescaped('checked="checked"');
|
print_unescaped('checked="checked"');
|
||||||
} ?>>
|
}
|
||||||
|
if (!$_['cli_based_cron_possible']) {
|
||||||
|
print_unescaped('disabled');
|
||||||
|
}?>>
|
||||||
<label for="backgroundjobs_cron">Cron</label><br/>
|
<label for="backgroundjobs_cron">Cron</label><br/>
|
||||||
<em><?php p($l->t("Use system's cron service to call the cron.php file every 15 minutes.")); ?></em>
|
<em><?php p($l->t("Use system's cron service to call the cron.php file every 15 minutes.")); ?>
|
||||||
|
<?php if($_['cli_based_cron_possible']) {
|
||||||
|
p($l->t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']]));
|
||||||
|
} else {
|
||||||
|
print_unescaped(str_replace(
|
||||||
|
['{linkstart}', '{linkend}'],
|
||||||
|
['<a href="http://php.net/manual/en/book.posix.php">', ' ↗</a>'],
|
||||||
|
$l->t('To run this you need the PHP posix extension. See {linkstart}PHP documentation{linkend} for more details.')
|
||||||
|
));
|
||||||
|
} ?></em>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,9 @@ class ServerTest extends TestCase {
|
||||||
'backgroundjobs_mode' => 'ajax',
|
'backgroundjobs_mode' => 'ajax',
|
||||||
'cron_log' => true,
|
'cron_log' => true,
|
||||||
'lastcron' => false,
|
'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
|
||||||
],
|
],
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue