show command to regenerate cron.d-file if previous deletion of old files could not be done automatically, fixes #1076
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -206,9 +206,15 @@ if (Froxlor::isDatabaseVersion('202112310')) {
|
|||||||
if (Froxlor::isDatabaseVersion('202211030')) {
|
if (Froxlor::isDatabaseVersion('202211030')) {
|
||||||
|
|
||||||
Update::showUpdateStep("Creating backward compatibility for cronjob");
|
Update::showUpdateStep("Creating backward compatibility for cronjob");
|
||||||
|
$disabled = explode(',', ini_get('disable_functions'));
|
||||||
|
$exec_allowed = !in_array('exec', $disabled);
|
||||||
|
// check whether old files could be deleted in previous updates and if not,
|
||||||
|
// user should run cron to regenerate cron.d-file manually as he will run
|
||||||
|
// the other commands manually only after the update so this file would be deleted too
|
||||||
|
if ($exec_allowed) {
|
||||||
$complete_filedir = Froxlor::getInstallDir() . '/scripts';
|
$complete_filedir = Froxlor::getInstallDir() . '/scripts';
|
||||||
mkdir($complete_filedir, 0750, true);
|
mkdir($complete_filedir, 0750, true);
|
||||||
$newCronBin = Froxlor::getInstallDir().'/bin/froxlor-cli';
|
$newCronBin = Froxlor::getInstallDir() . '/bin/froxlor-cli';
|
||||||
$compCron = <<<EOF
|
$compCron = <<<EOF
|
||||||
<?php
|
<?php
|
||||||
chmod('$newCronBin', 0755);
|
chmod('$newCronBin', 0755);
|
||||||
@@ -216,8 +222,13 @@ chmod('$newCronBin', 0755);
|
|||||||
exec('$newCronBin froxlor:cron -r 99');
|
exec('$newCronBin froxlor:cron -r 99');
|
||||||
exit;
|
exit;
|
||||||
EOF;
|
EOF;
|
||||||
file_put_contents($complete_filedir.'/froxlor_master_cronjob.php', $compCron);
|
file_put_contents($complete_filedir . '/froxlor_master_cronjob.php', $compCron);
|
||||||
Update::lastStepStatus(0);
|
Update::lastStepStatus(0);
|
||||||
|
} else {
|
||||||
|
$cron_run_cmd = 'chmod +x ' . FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/bin/froxlor-cli') . PHO_EOL;
|
||||||
|
$cron_run_cmd .= FileDir::makeCorrectFile(Froxlor::getInstallDir() . '/bin/froxlor-cli').' froxlor:cron -r 99';
|
||||||
|
Update::lastStepStatus(1, 'manual commands needed', 'Please run the following commands manually:<br><pre>' . $cron_run_cmd . '</pre>');
|
||||||
|
}
|
||||||
|
|
||||||
Froxlor::updateToDbVersion('202212060');
|
Froxlor::updateToDbVersion('202212060');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user