* Copyright (C) 2006-2018 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/admin/tools/dolibarr_export.php * \ingroup core * \brief Page to export database */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $langs->load("admin"); $action=GETPOST('action', 'alpha'); $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="date"; if (empty($page) || $page == -1) { $page = 0; } $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $offset = $limit * $page; if (! $user->admin) accessforbidden(); /* * Actions */ if ($action == 'delete') { if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha'))) { $file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha')); $ret=dol_delete_file($file, 1); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); } else { $file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha')); $ret=dol_delete_file($file, 1); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); } $action=''; } /* * View */ $form=new Form($db); $formfile = new FormFile($db); $label=$db::LABEL; $type=$db->type; //var_dump($db); $help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad'; llxHeader('', '', $help_url); ?> trans("Backup"), '', 'title_setup'); //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup'); print '
'; print $langs->trans("BackupDesc", DOL_DATA_ROOT); print '
'; print '
'; ?>
1 trans("BackupDesc3", $dolibarr_main_db_name).'
'; //print $langs->trans("BackupDescY").'
'; print '
'; ?>
trans("BackupDumpWizard")); print ''; print ''; print ''; print ''; print ''; print '
'; print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
'; print '
'; ?>
trans("ExportMethod"); ?>

trans("MySqlExportParameters"); ?>
trans("FullPathToMysqldumpCommand"); if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) { $fullpathofmysqldump=$db->getPathOfDump(); } else { $fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP; } ?>

trans("ExportOptions"); ?>
global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?>



id="checkbox_dump_drop" />








trans("MySqlExportParameters"); ?>
trans("ExportOptions"); ?>
global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?>

trans('ExportStructure') ?> id="checkbox_dump_drop" />

trans("Datas"); ?>



trans("PostgreSqlExportParameters"); ?>
trans("FullPathToPostgreSQLdumpCommand"); if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) { $fullpathofpgdump=$db->getPathOfDump(); } else { $fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP; } ?>

trans("ExportOptions"); ?>





" />

'', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")); $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); // $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function $compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2")); } else { $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("Default")); $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); } // Show compression choices print '
'; print "\n"; print $langs->trans("Compression").':   '; foreach($compression as $key => $val) { if (! $val['function'] || function_exists($val['function'])) // Enabled export format { print ''; print ' '; } else // Disabled export format { print ''; print ' '; print ' ('.$langs->trans("NotAvailable").')'; } print '     '; } print '
'; print "\n"; ?>
" id="buttonGo">

'.$langs->trans("RunCommandSummary").':
'."\n"; print '
'."\n"; print '
'; //print $paramclear; // Now show result print ''.$langs->trans("BackupResult").': '; print $_SESSION["commandbackupresult"]; $_SESSION["commandbackuplastdone"]=''; $_SESSION["commandbackuptorun"]=''; $_SESSION["commandbackupresult"]=''; } if (! empty($_SESSION["commandbackuptorun"])) { print '
'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':
'."\n"; print '
'."\n"; print ajax_autoselect("commandbackuptoruntext", 0); print '
'; //print $paramclear; $_SESSION["commandbackuplastdone"]=''; $_SESSION["commandbackuptorun"]=''; $_SESSION["commandbackupresult"]=''; } ?>
'; ?>
admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); print '
'; ?>

2 trans("BackupDesc2", DOL_DATA_ROOT).'
'; print $langs->trans("BackupDescX").'

'; ?>
trans("BackupDumpWizard")); ?>
" />

'; print "\n"; print $langs->trans("Compression").':   '; $filecompression = $compression; array_shift($filecompression); $filecompression['zip']= array('function' => 'dol_compress_dir', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); foreach($filecompression as $key => $val) { if (! $val['function'] || function_exists($val['function'])) // Enabled export format { print ''; print ' '; } else // Disabled export format { print ''; print ' '; print ' ('.$langs->trans("NotAvailable").')'; } print '     '; } print '
'; print "\n"; ?>
" id="buttonGo" />

admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); print '
'; ?>
close();