diff --git a/customer_extras.php b/customer_extras.php index 6c42196b..98fd06cc 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -525,6 +525,17 @@ if ($page == 'overview') { if ($action == '') { $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup"); + // check whether there is a backup-job for this customer + $sel_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_TASKS."` WHERE `type` = '20'"); + Database::pexecute($sel_stmt); + while ($entry = $sel_stmt->fetch()) + { + $data = unserialize($entry['data']); + if ($data['customerid'] == $userinfo['customerid']) { + standard_error('customerhasongoingbackupjob'); + } + } + if (isset($_POST['send']) && $_POST['send'] == 'send') { if (! $_POST['path']) { @@ -566,16 +577,6 @@ if ($page == 'overview') { standard_success('backupscheduled'); } else { - // check whether there is a backup-job for this customer - $sel_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_TASKS."` WHERE `type` = '20'"); - Database::pexecute($sel_stmt); - while ($entry = $sel_stmt->fetch()) - { - $data = unserialize($entry['data']); - if ($data['customerid'] == $userinfo['customerid']) { - standard_error('customerhasongoingbackupjob'); - } - } $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); $backup_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.backup.php'; $backup_form = htmlform::genHTMLForm($backup_data); diff --git a/lib/cron_init.php b/lib/cron_init.php index b8dacfa2..68166f5e 100644 --- a/lib/cron_init.php +++ b/lib/cron_init.php @@ -129,7 +129,7 @@ while ($fName = readdir($lockDirHandle)) { // fwrite($debugHandler, 'Previous cronjob didn\'t exit clean. PID: ' . $check_pid . "\n"); fwrite($debugHandler, 'Removing lockfile: ' . $lockdir . $fName . "\n"); - unlink($lockdir . $fName); + @unlink($lockdir . $fName); } else { // Result: A Cronscript with this pid diff --git a/lib/functions/filedir/function.createCustomerBackup.php b/lib/functions/filedir/function.createCustomerBackup.php index 2375081d..9c352439 100644 --- a/lib/functions/filedir/function.createCustomerBackup.php +++ b/lib/functions/filedir/function.createCustomerBackup.php @@ -82,13 +82,13 @@ function createCustomerBackup($data = null, $customerdocroot = null, &$cronlog) $tar_file_list = ""; $mail_homedir = ""; while ($row = $sel_stmt->fetch()) { - $tar_file_list .= "./".$row['maildir'] . " "; + $tar_file_list .= escapeshellarg("./".$row['maildir']) . " "; $mail_homedir = $row['homedir']; } if (! empty($tar_file_list)) { - $cronlog->logAction(CRON_ACTION, LOG_DEBUG, 'shell> tar cfvz ' . escapeshellarg(makeCorrectFile($tmpdir . '/mail/' . $data['loginname'] . '-mail.tar.gz')) . ' ' . escapeshellarg(trim($tar_file_list)).' -C '.escapeshellarg($mail_homedir)); - safe_exec('tar cfz ' . escapeshellarg(makeCorrectFile($tmpdir . '/mail/' . $data['loginname'] . '-mail.tar.gz')) . ' ' . escapeshellarg(trim($tar_file_list)).' -C '.escapeshellarg($mail_homedir)); + $cronlog->logAction(CRON_ACTION, LOG_DEBUG, 'shell> tar cfvz ' . escapeshellarg(makeCorrectFile($tmpdir . '/mail/' . $data['loginname'] . '-mail.tar.gz')) . ' -C '.escapeshellarg($mail_homedir) . ' ' . trim($tar_file_list)); + safe_exec('tar cfz ' . escapeshellarg(makeCorrectFile($tmpdir . '/mail/' . $data['loginname'] . '-mail.tar.gz')) . ' -C '.escapeshellarg($mail_homedir) . ' ' . trim($tar_file_list)); $create_backup_tar_data .= './mail '; } } diff --git a/lib/functions/froxlor/function.CronjobFunctions.php b/lib/functions/froxlor/function.CronjobFunctions.php index 4a670819..a2c09785 100644 --- a/lib/functions/froxlor/function.CronjobFunctions.php +++ b/lib/functions/froxlor/function.CronjobFunctions.php @@ -108,6 +108,15 @@ function getOutstandingTasks() { elseif ($row['type'] == '10') { $task_desc = $lng['tasks']['diskspace_set_quota']; } + // deleting user-files + elseif ($row['type'] == '20') { + $loginname = ''; + if (is_array($row['data'])) { + $loginname = $row['data']['loginname']; + } + $task_desc = $lng['tasks']['backup_customerfiles']; + $task_desc = str_replace('%loginname%', $loginname, $task_desc); + } // re-generating of cron.d-file elseif ($row['type'] == '99') { $task_desc = $lng['tasks']['regenerating_crond']; diff --git a/lng/english.lng.php b/lng/english.lng.php index abe69ec0..6783d8a8 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1988,3 +1988,4 @@ $lng['serversettings']['backupenabled']['title'] = "Enable backup for customers" $lng['serversettings']['backupenabled']['description'] = "If activated, the customer will be able to schedule backup jobs (cron-backup) which generates an archive within his docroot (subdirectory chosable by customer)"; $lng['extras']['path_protection_label'] = 'Important'; $lng['extras']['path_protection_info'] = 'We strongly recommend protecting the given path, see "Extras" -> "Directory protection"'; +$lng['tasks']['backup_customerfiles'] = 'Backup job for customer %loginname%'; diff --git a/lng/german.lng.php b/lng/german.lng.php index cf6f2816..671ce6c1 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1641,3 +1641,4 @@ $lng['serversettings']['backupenabled']['title'] = "Backup für Kunden aktiviere $lng['serversettings']['backupenabled']['description'] = "Wenn dies aktiviert ist, kann der Kunde Sicherungen planen (cron-backup) welche ein Archiv in sein Heimatverzeichnis ablegt (Unterordner vom Kunden wählbar)"; $lng['extras']['path_protection_label'] = 'Wichtig'; $lng['extras']['path_protection_info'] = 'Wir raten dringend dazu den angegebenen Pfad zu schützen, siehe "Extras" -> "Verzeichnisschutz"'; +$lng['tasks']['backup_customerfiles'] = 'Datensicherung für Kunde %loginname%';