set last run of letsencrypt cron when called in webserver-cron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -35,6 +35,8 @@ class HttpConfigBase
|
||||
\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();
|
||||
// set last run timestamp of cronjob
|
||||
\Froxlor\System\Cronjob::updateLastRunOfCron('letsencrypt');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
|
||||
if (count($jobs_to_run) > 0) {
|
||||
// include all jobs we want to execute
|
||||
foreach ($jobs_to_run as $cron) {
|
||||
self::updateLastRunOfCron($cron);
|
||||
\Froxlor\System\Cronjob::updateLastRunOfCron($cron);
|
||||
$cronfile = self::getCronModule($cron);
|
||||
if ($cronfile && class_exists($cronfile)) {
|
||||
$cronfile::run();
|
||||
@@ -336,16 +336,6 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron
|
||||
}
|
||||
}
|
||||
|
||||
private static function updateLastRunOfCron($cronname)
|
||||
{
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = UNIX_TIMESTAMP() WHERE `cronfile` = :cron;
|
||||
");
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'cron' => $cronname
|
||||
));
|
||||
}
|
||||
|
||||
private static function getCronModule($cronname)
|
||||
{
|
||||
$upd_stmt = Database::prepare("
|
||||
|
||||
@@ -361,4 +361,14 @@ class Cronjob
|
||||
|
||||
die($message);
|
||||
}
|
||||
|
||||
public static function updateLastRunOfCron($cronname)
|
||||
{
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = UNIX_TIMESTAMP() WHERE `cronfile` = :cron;
|
||||
");
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'cron' => $cronname
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user