diff --git a/customer_extras.php b/customer_extras.php index 98fd06cc..9294863c 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -522,17 +522,29 @@ if ($page == 'overview') { if (Settings::Get('system.backupenabled') == 1) { + if ($action == 'abort' && isset($_POST['send']) && $_POST['send'] == 'send') { + $log->logAction(USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob"); + $entry = isset($_POST['backup_job_entry']) ? (int)$_POST['backup_job_entry'] : 0; + if ($entry > 0) { + $del_stmt = Database::prepare("DELETE FROM `".TABLE_PANEL_TASKS."` WHERE `id` = :tid"); + Database::pexecute($del_stmt, array('tid' => $entry)); + standard_success('backupaborted'); + } + redirectTo($filename, array('page' => $page, 'action' => '', 's' => $s)); + } 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); + $existing_backupJob = null; while ($entry = $sel_stmt->fetch()) { $data = unserialize($entry['data']); if ($data['customerid'] == $userinfo['customerid']) { - standard_error('customerhasongoingbackupjob'); + $existing_backupJob = $entry; + break; } } @@ -577,11 +589,24 @@ if ($page == 'overview') { standard_success('backupscheduled'); } else { + if (!empty($existing_backupJob)) { + $action = "abort"; + $row = unserialize($entry['data']); + $row['path'] = makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['destdir'])); + $row['backup_web'] = ($row['backup_web'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no']; + $row['backup_mail'] = ($row['backup_mail'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no']; + $row['backup_dbs'] = ($row['backup_dbs'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no']; + } $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); $title = $backup_data['backup']['title']; $image = $backup_data['backup']['image']; + + if (!empty($existing_backupJob)) { + // overwrite backup_form after we took everything from it we needed + eval("\$backup_form = \"" . getTemplate("extras/backup_listexisting") . "\";"); + } eval("echo \"" . getTemplate("extras/backup") . "\";"); } } diff --git a/lib/classes/phpinterface/class.phpinterface_fpm.php b/lib/classes/phpinterface/class.phpinterface_fpm.php index 211ee4a8..156940ba 100644 --- a/lib/classes/phpinterface/class.phpinterface_fpm.php +++ b/lib/classes/phpinterface/class.phpinterface_fpm.php @@ -113,7 +113,11 @@ class phpinterface_fpm { 'session.gc_probability', 'variables_order', 'opcache.log_verbosity_level', - 'opcache.restrict_api' + 'opcache.restrict_api', + 'opcache.revalidate_freq', + 'opcache.max_accelerated_files', + 'opcache.memory_consumption', + 'opcache.interned_strings_buffer' ), 'php_admin_flag' => array( 'allow_call_time_pass_reference', @@ -137,7 +141,8 @@ class phpinterface_fpm { 'opcache.revalidate_path', 'opcache.save_comments', 'opcache.use_cwd', - 'opcache.validate_timestamps' + 'opcache.validate_timestamps', + 'opcache.fast_shutdown' ) ); diff --git a/lng/english.lng.php b/lng/english.lng.php index 8d84df25..5fdd316d 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1981,6 +1981,7 @@ $lng['extras']['backup_mail'] = 'Backup mail-data'; $lng['extras']['backup_dbs'] = 'Backup databases'; $lng['error']['customerhasongoingbackupjob'] = 'There is already a backup job waiting to be processed, please be patient.'; $lng['success']['backupscheduled'] = 'Your backup job has been scheduled. Please wait for it to be processed'; +$lng['success']['backupaborted'] = 'Your scheduled backup has been cancelled'; $lng['crondesc']['cron_backup'] = 'Process backup jobs'; $lng['error']['backupfunctionnotenabled'] = 'The backup function is not enabled'; $lng['serversettings']['backupenabled']['title'] = "Enable backup for customers"; diff --git a/lng/german.lng.php b/lng/german.lng.php index 056712a3..64593a5a 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1634,6 +1634,7 @@ $lng['extras']['backup_mail'] = 'E-Mail Daten sichern'; $lng['extras']['backup_dbs'] = 'Datenbanken sichern'; $lng['error']['customerhasongoingbackupjob'] = 'Es gibt noch einen austehenden Backup-Job. Bitte haben Sie etwas Geduld.'; $lng['success']['backupscheduled'] = 'Ihre Sicherung wurde erfolgreich geplant. Bitte warten Sie nun, bis diese abgearbeitet wurde.'; +$lng['success']['backupaborted'] = 'Die geplante Sicherung wurde abgebrochen'; $lng['crondesc']['cron_backup'] = 'Ausstehende Sicherungen erstellen'; $lng['error']['backupfunctionnotenabled'] = 'Die Sicherungs-Funktion is nicht aktiviert'; $lng['serversettings']['backupenabled']['title'] = "Backup für Kunden aktivieren"; diff --git a/templates/Sparkle/customer/extras/backup.tpl b/templates/Sparkle/customer/extras/backup.tpl index 6e71243e..09faee56 100644 --- a/templates/Sparkle/customer/extras/backup.tpl +++ b/templates/Sparkle/customer/extras/backup.tpl @@ -7,6 +7,15 @@ $header + +
+
+
{$lng['admin']['warning']}
+
{$lng['error']['customerhasongoingbackupjob']}
+
+
+
+
diff --git a/templates/Sparkle/customer/extras/backup_listexisting.tpl b/templates/Sparkle/customer/extras/backup_listexisting.tpl new file mode 100644 index 00000000..4afa8676 --- /dev/null +++ b/templates/Sparkle/customer/extras/backup_listexisting.tpl @@ -0,0 +1,26 @@ + + + {$lng['panel']['path']} + {$lng['extras']['backup_web']} + {$lng['extras']['backup_mail']} + {$lng['extras']['backup_dbs']} + + + + + {$row['path']} + {$row['backup_web']} + {$row['backup_mail']} + {$row['backup_dbs']} + + + + + +

+ + +

+ + +