mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Backup: Added ability to generate a cron script for automated backups.
This commit is contained in:
@@ -10,16 +10,41 @@
|
||||
$text['header-backup']['pt-pt'] = "Backup";
|
||||
$text['header-backup']['fr-fr'] = "Sauvegarde";
|
||||
|
||||
$text['description-backup']['en-us'] = "To create a backup of paths defined in Default Settings, click the 'Backup' button below and then choose a location on your local system to save the file.";
|
||||
$text['description-backup']['es-cl'] = "Para crear una copia de seguridad de rutas definidas en la configuración predeterminada, haga clic en el botón 'Copia de seguridad' a continuación y luego elija una ubicación en el sistema local para guardar el archivo.";
|
||||
$text['description-backup']['pt-pt'] = "Para criar uma cópia de segurança dos caminhos definidos em configurações padrão, clique no botão 'Backup' abaixo e, em seguida, escolher um local em seu sistema local para salvar o arquivo.";
|
||||
$text['description-backup']['fr-fr'] = "Pour créer une sauvegarde de chemins définis dans les paramètres par défaut, cliquez sur le bouton 'Sauvegarder' ci-dessous, puis choisissez un emplacement sur votre système local pour enregistrer le fichier.";
|
||||
$text['description-backup']['en-us'] = "To create a backup of the Source Paths below (defined in Default Settings), select the desired File Format and Target Type.";
|
||||
$text['description-backup']['es-cl'] = "Para crear una copia de seguridad de las rutas de origen siguientes (definidos en la configuración predeterminada), seleccione el formato de archivo deseado y tipo de destino.";
|
||||
$text['description-backup']['pt-pt'] = "Para criar uma cópia de segurança dos caminhos de origem abaixo (definidos em Default Settings), selecione o formato de arquivo desejado e Target Type.";
|
||||
$text['description-backup']['fr-fr'] = "Pour créer une sauvegarde des chemins source ci-dessous (défini dans les paramètres par défaut), sélectionnez le format de fichier désiré et Type de cible.";
|
||||
|
||||
$text['label-source_paths']['en-us'] = "Source Paths";
|
||||
$text['label-source_paths']['es-cl'] = "Fuente Caminos";
|
||||
$text['label-source_paths']['pt-pt'] = "Fonte Caminhos";
|
||||
$text['label-source_paths']['fr-fr'] = "Chemins Source";
|
||||
|
||||
$text['label-file_format']['en-us'] = "File Format";
|
||||
$text['label-file_format']['es-cl'] = "Formato de Archivo";
|
||||
$text['label-file_format']['pt-pt'] = "Formato de arquivo";
|
||||
$text['label-file_format']['fr-fr'] = "Format de Fichier";
|
||||
|
||||
$text['label-target_type']['en-us'] = "Target Type";
|
||||
$text['label-target_type']['es-cl'] = "Tipo de destino";
|
||||
$text['label-target_type']['pt-pt'] = "Tipo de Destino";
|
||||
$text['label-target_type']['fr-fr'] = "type de cible";
|
||||
|
||||
$text['option-file_download']['en-us'] = "File Download";
|
||||
$text['option-file_download']['es-cl'] = "Descarga de archivos";
|
||||
$text['option-file_download']['pt-pt'] = "download do arquivo";
|
||||
$text['option-file_download']['fr-fr'] = "Télécharger le fichier";
|
||||
|
||||
$text['option-cron_script']['en-us'] = "Cron Script";
|
||||
$text['option-cron_script']['es-cl'] = "Cron Guión";
|
||||
$text['option-cron_script']['pt-pt'] = "Cron Script";
|
||||
$text['option-cron_script']['fr-fr'] = "Cron Script";
|
||||
|
||||
$text['label-cron_script']['en-us'] = "Cron Script";
|
||||
$text['label-cron_script']['es-cl'] = "Cron Guión";
|
||||
$text['label-cron_script']['pt-pt'] = "Cron Script";
|
||||
$text['label-cron_script']['fr-fr'] = "Cron Script";
|
||||
|
||||
$text['header-restore']['en-us'] = "Restore";
|
||||
$text['header-restore']['es-cl'] = "Restaurar";
|
||||
$text['header-restore']['pt-pt'] = "Restaurar";
|
||||
@@ -40,10 +65,15 @@
|
||||
$text['label-select_backup']['pt-pt'] = "Selecione Backup";
|
||||
$text['label-select_backup']['fr-fr'] = "Sélectionnez le Fichier de Sauvegarde";
|
||||
|
||||
$text['button-backup']['en-us'] = "Backup";
|
||||
$text['button-backup']['es-cl'] = "Copia de Seguridad";
|
||||
$text['button-backup']['pt-pt'] = "Backup";
|
||||
$text['button-backup']['fr-fr'] = "Sauvegarde";
|
||||
$text['button-download']['en-us'] = "Download";
|
||||
$text['button-download']['es-cl'] = "Descargar";
|
||||
$text['button-download']['pt-pt'] = "Baixar";
|
||||
$text['button-download']['fr-fr'] = "Télécharger";
|
||||
|
||||
$text['button-generate']['en-us'] = "Generate";
|
||||
$text['button-generate']['es-cl'] = "Generar";
|
||||
$text['button-generate']['pt-pt'] = "Gerar";
|
||||
$text['button-generate']['fr-fr'] = "Générer";
|
||||
|
||||
$text['button-restore']['en-us'] = "Restore";
|
||||
$text['button-restore']['es-cl'] = "Restaurar";
|
||||
|
||||
@@ -41,7 +41,7 @@ else {
|
||||
}
|
||||
|
||||
//download the backup
|
||||
if ($_GET['a'] == "backup" && permission_exists('backup_download')) {
|
||||
if ($_GET['a'] == "download" && permission_exists('backup_download')) {
|
||||
$file_format = $_GET['file_format'];
|
||||
$file_format = ($file_format != '') ? $file_format : 'tgz';
|
||||
|
||||
@@ -94,6 +94,14 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
//script a backup (cron)
|
||||
if ($_GET['a'] == "script" && permission_exists('backup_download')) {
|
||||
$file_format = $_GET['file_format'];
|
||||
$target_type = "script";
|
||||
|
||||
$backup = new backup;
|
||||
$cron_script = $backup->command("backup", $file_format);
|
||||
}
|
||||
|
||||
//restore a backup
|
||||
if ($_POST['a'] == "restore" && permission_exists('backup_upload')) {
|
||||
@@ -140,67 +148,111 @@ else {
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-destinations'];
|
||||
|
||||
// backup type switch javascript
|
||||
echo "<script language='javascript' type='text/javascript'>";
|
||||
echo " var fade_speed = 400;";
|
||||
echo " function toggle_target(first_elem, second_elem) {";
|
||||
echo " $('#cron_script').fadeOut(fade_speed);";
|
||||
echo " $('#'+first_elem).fadeToggle(fade_speed, function() {";
|
||||
echo " $('#cron_script').slideUp(fade_speed, function() {";
|
||||
echo " $('#'+second_elem).fadeToggle(fade_speed);";
|
||||
echo " });";
|
||||
echo " });";
|
||||
echo " }";
|
||||
echo "</script>";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' valign='top'>\n";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-backup']."</b></td>\n";
|
||||
echo " <td width='50%' align='right'></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>".$text['description-backup']."</td>\n";
|
||||
echo "<b>".$text['header-backup']."</b>\n";
|
||||
echo "<br><br>";
|
||||
echo $text['description-backup']."\n";
|
||||
echo "<br><br><br>";
|
||||
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-source_paths']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
foreach ($_SESSION['backup']['path'] as $backup_path) {
|
||||
echo $backup_path."<br>\n";
|
||||
}
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-file_format']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='file_format' id='file_format'>";
|
||||
echo " <option value='tgz' ".(($file_format == 'tgz') ? 'selected' : null).">TAR GZIP</option>";
|
||||
echo " <option value='tbz' ".(($file_format == 'tbz') ? 'selected' : null).">TAR BZIP</option>";
|
||||
echo " <option value='rar' ".(($file_format == 'rar') ? 'selected' : null).">RAR</option>";
|
||||
echo " <option value='zip' ".(($file_format == 'zip') ? 'selected' : null).">ZIP</option>";
|
||||
echo " </select>";
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-target_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='target_type' id='target_type' onchange=\"(this.selectedIndex == 0) ? toggle_target('btn_script','btn_download') : toggle_target('btn_download','btn_script');\">";
|
||||
echo " <option value='download'>".$text['option-file_download']."</option>";
|
||||
echo " <option value='script' ".(($target_type == 'script') ? 'selected' : null).">".$text['option-cron_script']."</option>";
|
||||
echo " </select>";
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "<div id='cron_script' ".(($cron_script == '') ? "style='display: none;'" : null).">";
|
||||
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-cron_script']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <textarea class='formfld' style='width: 100%; height: 200px; font-family: courier;'>".$cron_script."</textarea>";
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br>";
|
||||
echo "<div align='right'>";
|
||||
echo "<input type='button' id='btn_script' class='btn' ".(($target_type != 'script') ? "style='display: none;'" : null)." value='".$text['button-generate']."' onclick=\"document.location.href='".PROJECT_PATH."/app/backup/index.php?a=script&file_format='+document.getElementById('file_format').options[document.getElementById('file_format').selectedIndex].value;\">";
|
||||
echo "<input type='button' id='btn_download' class='btn' ".(($target_type == 'script') ? "style='display: none;'" : null)." value='".$text['button-download']."' onclick=\"document.location.href='".PROJECT_PATH."/app/backup/index.php?a=download&file_format='+document.getElementById('file_format').options[document.getElementById('file_format').selectedIndex].value;\">";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo " </td>\n";
|
||||
echo " <td width='20'> </td>\n";
|
||||
echo " <td width='50%' valign='top'>\n";
|
||||
|
||||
echo "<b>".$text['header-restore']."</b>\n";
|
||||
echo "<br><br>";
|
||||
echo $text['description-restore']."\n";
|
||||
echo "<br><br><br>";
|
||||
echo "<div align='center'>";
|
||||
echo "<form name='frmrestore' method='post' enctype='multipart/form-data' action=''>";
|
||||
echo "<input type='hidden' name='a' value='restore'>";
|
||||
echo "<table>";
|
||||
echo " <tr>";
|
||||
echo " <td nowrap>".$text['label-select_backup']." </td>";
|
||||
echo " <td><input type='file' class='formfld fileinput' name='backup_file'></td>";
|
||||
echo " <td><input type='submit' class='btn' value='".$text['button-restore']."'></td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "<br>";
|
||||
echo "<span style='font-weight: bold; text-decoration: underline; color: #000;'>".$text['description-restore_warning']."</span>";
|
||||
echo "</form>\n";
|
||||
echo "</div>";
|
||||
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<table>";
|
||||
echo " <tr>";
|
||||
echo " <td>".$text['label-file_format']." </td>";
|
||||
echo " <td>";
|
||||
echo " <select class='formfld' name='file_format' id='file_format'>";
|
||||
echo " <option value='tgz' ".(($file_format == 'tgz') ? 'selected' : null).">TAR GZIP</option>";
|
||||
echo " <option value='tbz' ".(($file_format == 'tbz') ? 'selected' : null).">TAR BZIP</option>";
|
||||
echo " <option value='rar' ".(($file_format == 'rar') ? 'selected' : null).">RAR</option>";
|
||||
echo " <option value='zip' ".(($file_format == 'zip') ? 'selected' : null).">ZIP</option>";
|
||||
echo " </select>";
|
||||
echo " </td>";
|
||||
echo " <td><input type='button' class='btn' value='".$text['button-backup']."' onclick=\"document.location.href='".PROJECT_PATH."/app/backup/index.php?a=backup&file_format='+document.getElementById('file_format').options[document.getElementById('file_format').selectedIndex].value;\"></td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-restore']."</b></td>\n";
|
||||
echo " <td width='50%' align='right'></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>".$text['description-restore']."</td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<form name='frmrestore' method='post' enctype='multipart/form-data' action=''>";
|
||||
echo "<input type='hidden' name='a' value='restore'>";
|
||||
echo "<table>";
|
||||
echo " <tr>";
|
||||
echo " <td>".$text['label-select_backup']." </td>";
|
||||
echo " <td><input type='file' class='formfld fileinput' name='backup_file'></td>";
|
||||
echo " <td><input type='submit' class='btn' value='".$text['button-restore']."'></td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "<br>";
|
||||
echo "<span style='font-weight: bold; text-decoration: underline; color: #000;'>".$text['description-restore_warning']."</span>";
|
||||
echo "</form>\n";
|
||||
echo "</div>";
|
||||
echo "<br><br><br>";
|
||||
|
||||
echo "</div>";
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user