beautification and minor fixes

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-07-26 07:49:17 +02:00
parent dd87a7374e
commit d5e4182878
5 changed files with 28 additions and 23 deletions

View File

@@ -83,7 +83,7 @@ if ($page == 'log' && $userinfo['change_serversettings'] == '1') {
case \Froxlor\FroxlorLogger::LOGIN_ACTION:
$_action = $lng['logger']['login'];
break;
case LOG_ERROR:
case \Froxlor\FroxlorLogger::LOG_ERROR:
$_action = $lng['logger']['intern'];
break;
default:

View File

@@ -96,7 +96,7 @@ if ($page == 'log') {
case \Froxlor\FroxlorLogger::LOGIN_ACTION:
$_action = $lng['logger']['login'];
break;
case LOG_ERROR:
case \Froxlor\FroxlorLogger::LOG_ERROR:
$_action = $lng['logger']['intern'];
break;
default:

View File

@@ -34,7 +34,7 @@ class HttpConfigBase
if (Settings::Get('system.leenabled') == 1) {
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::CRON_ACTION, LOG_INFO, 'Running Let\'s Encrypt cronjob prior to regenerating webserver config files');
\Froxlor\Cron\Http\LetsEncrypt\AcmeSh::$no_inserttask = true;
\Froxlor\Cron\Http\LetsEncrypt\AcmeSh::run();
\Froxlor\Cron\Http\LetsEncrypt\AcmeSh::run(true);
// set last run timestamp of cronjob
\Froxlor\System\Cronjob::updateLastRunOfCron('letsencrypt');
}

View File

@@ -45,10 +45,11 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron
public static $no_inserttask = false;
public static function run()
public static function run($internal = false)
{
if (! defined('CRON_IS_FORCED') && ! defined('CRON_DEBUG_FLAG')) {
FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_WARNING, "Let's Encrypt cronjob is combined with regeneration of webserver configuration files.\nFor debugging purposes you can use the --debug switch and/or the --force switch to run the cron manually.");
if (! defined('CRON_IS_FORCED') && ! defined('CRON_DEBUG_FLAG') && $internal == false) {
//FroxlorLogger::getInstanceOf()->logAction(FroxlorLogger::CRON_ACTION, LOG_WARNING, "Let's Encrypt cronjob is combined with regeneration of webserver configuration files.\nFor debugging purposes you can use the --debug switch and/or the --force switch to run the cron manually.");
return 0;
}
self::checkInstall();

View File

@@ -102,23 +102,7 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
$cronfile::run();
}
}
if ($tasks_cnt['jobcnt'] > 0) {
if (\Froxlor\Settings::Get('system.nssextrausers') == 1) {
\Froxlor\Cron\System\Extrausers::generateFiles(self::$cronlog);
}
// clear NSCD cache if using fcgid or fpm, #1570 - not needed for nss-extrausers
if ((\Froxlor\Settings::Get('system.mod_fcgid') == 1 || (int) \Froxlor\Settings::Get('phpfpm.enabled') == 1) && \Froxlor\Settings::Get('system.nssextrausers') == 0) {
$false_val = false;
\Froxlor\FileDir::safe_exec('nscd -i passwd 1> /dev/null', $false_val, array(
'>'
));
\Froxlor\FileDir::safe_exec('nscd -i group 1> /dev/null', $false_val, array(
'>'
));
}
}
self::refreshUsers($tasks_cnt['jobcnt']);
}
/**
@@ -133,6 +117,26 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
self::shutdown();
}
private static function refreshUsers($jobcount = 0)
{
if ($jobcount > 0) {
if (\Froxlor\Settings::Get('system.nssextrausers') == 1) {
\Froxlor\Cron\System\Extrausers::generateFiles(self::$cronlog);
}
// clear NSCD cache if using fcgid or fpm, #1570 - not needed for nss-extrausers
if ((\Froxlor\Settings::Get('system.mod_fcgid') == 1 || (int) \Froxlor\Settings::Get('phpfpm.enabled') == 1) && \Froxlor\Settings::Get('system.nssextrausers') == 0) {
$false_val = false;
\Froxlor\FileDir::safe_exec('nscd -i passwd 1> /dev/null', $false_val, array(
'>'
));
\Froxlor\FileDir::safe_exec('nscd -i group 1> /dev/null', $false_val, array(
'>'
));
}
}
}
private static function init()
{
if (@php_sapi_name() != 'cli' && @php_sapi_name() != 'cgi' && @php_sapi_name() != 'cgi-fcgi') {