29require
'../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
48$action =
GETPOST(
'action',
'aZ09');
50$allow_download_app =
GETPOSTINT(
'allow_download_app');
53$allowdownloadapp = ($allow_download_app && !empty($dolibarr_allow_download_app));
55$paramallowdownloadapp = ($allowdownloadapp ?
'&allow_download_app=1' :
'');
57$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
58$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
66if (empty($page) || $page == -1) {
70$offset = $limit * $page;
81if ($action ==
'deletefile') {
82 if (preg_match(
'/^backup\//',
GETPOST(
'urlfile',
'alpha'))) {
83 $file =
$conf->admin->dir_output.
'/backup/'.basename(
GETPOST(
'urlfile',
'alpha'));
86 setEventMessages($langs->trans(
"FileWasRemoved",
GETPOST(
'urlfile')),
null,
'mesgs');
88 setEventMessages($langs->trans(
"ErrorFailToDeleteFile",
GETPOST(
'urlfile')),
null,
'errors');
90 } elseif (preg_match(
'/^backupapp\//',
GETPOST(
'urlfile',
'alpha'))) {
91 $file =
$conf->admin->dir_output.
'/backupapp/'.basename(
GETPOST(
'urlfile',
'alpha'));
94 setEventMessages($langs->trans(
"FileWasRemoved",
GETPOST(
'urlfile')),
null,
'mesgs');
96 setEventMessages($langs->trans(
"ErrorFailToDeleteFile",
GETPOST(
'urlfile')),
null,
'errors');
99 $file =
$conf->admin->dir_output.
'/documents/'.basename(
GETPOST(
'urlfile',
'alpha'));
102 setEventMessages($langs->trans(
"FileWasRemoved",
GETPOST(
'urlfile')),
null,
'mesgs');
104 setEventMessages($langs->trans(
"ErrorFailToDeleteFile",
GETPOST(
'urlfile')),
null,
'errors');
115$form =
new Form($db);
122$help_url =
'EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
123llxHeader(
'',
'', $help_url,
'', 0, 0,
'',
'',
'',
'mod-admin page-tools_dolibarr_export');
125print
'<script type="text/javascript">
126jQuery(document).ready(function() {';
129 function hideoptions () {
130 jQuery(
"#mysql_options").hide();
131 jQuery(
"#mysql_nobin_options").hide();
132 jQuery(
"#postgresql_options").hide();
136 jQuery(
"#radio_dump_mysql").click(
function() {
138 jQuery(
"#mysql_options").show();
140 jQuery(
"#radio_dump_mysql_nobin").click(
function() {
142 jQuery(
"#mysql_nobin_options").show();
144 jQuery(
"#radio_dump_postgresql").click(
function() {
146 jQuery(
"#postgresql_options").show();
148 jQuery(
"#select_sql_compat").click(
function() {
149 if (jQuery(
"#select_sql_compat").val() ==
'POSTGRESQL')
151 jQuery(
"#checkbox_dump_disable-add-locks").prop(
'checked',
true);
156if (in_array($type, array(
'mysql',
'mysqli'))) {
157 print
'jQuery("#radio_dump_mysql").click();';
159if (in_array($type, array(
'pgsql'))) {
160 print
'jQuery("#radio_dump_postgresql").click();';
165$title = $langs->trans(
"Backup");
169print
'<div class="center">';
170print $langs->trans(
"BackupDesc", $allowdownloadapp ? 4 : 3);
174print
"<!-- Dump of a server -->\n";
175print
'<form method="post" action="'.DOL_URL_ROOT.
'/admin/tools/export.php" name="dump" spellcheck="false">';
176print
'<input type="hidden" name="token" value="'.newToken().
'" />';
177print
'<input type="hidden" name="export_type" value="server" />';
178print
'<input type="hidden" name="page_y" value="" />';
179if ($allowdownloadapp) {
180 print
'<input type="hidden" name="allow_download_app" value="1" />';
183print
'<fieldset id="fieldsetexport"><legend class="legendforfieldsetstep" style="font-size: 3em">1</legend>';
185print
'<span class="opacitymedium">';
186print $langs->trans(
"BackupDesc3", $dolibarr_main_db_name).
'<br>';
187print $langs->trans(
"BackupDescY").
'<br>';
192print
'<div id="backupdatabaseleft" class="fichehalfleft" >';
194$title = $langs->trans(
"BackupDumpWizard");
201print
'<span class="opacitymedium">'.$langs->trans(
"DatabaseName").
' : </span><b>'.$dolibarr_main_db_name.
'</b><br><br>';
206print
'<table class="centpercent noborderbottom">';
209print
'<td class="tdtop nopaddingleftimp">';
211print
'<div id="div_container_exportoptions">';
212print
'<fieldset id="exportoptions"><legend>'.$langs->trans(
"ExportMethod").
'</legend>';
213if (in_array($type, array(
'mysql',
'mysqli'))) {
214 print
'<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />';
215 print
'<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>';
218 print
'<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />';
219 print
'<label for="radio_dump_mysql_nobin">MySQL Dump (php) '.img_warning($langs->trans(
'BackupPHPWarning')).
'</label>';
221} elseif (in_array($type, array(
'pgsql'))) {
222 print
'<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />';
223 print
'<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
226 print
'No method available with database '.dol_escape_htmltag($label);
235print
'<td class="tdtop nopaddingleftimp">';
237print
'<div class="centpercent center margintoponly marginbottomonly">';
238print img_picto(
'',
'setup',
'class="pictofixedwidth"').
'<a class="classlink" id="lnk">'.$langs->trans(
"ShowAdvancedOptions").
'...</a>';
241print
'<script type="text/javascript">
242jQuery(document).ready(function() {
243 jQuery("#lnk").click(function() {
244 console.log("We click on link");
249function hideoptions(domelem) {
250 const div = document.getElementById("div_container_sub_exportoptions");
252 if (div.style.display === "none") {
253 div.style.display = "block";
254 domelem.innerText=\''.dol_escape_js($langs->transnoentitiesnoconv(
"HideAdvancedoptions")).
'\';
256 div.style.display =
"none";
257 domelem.innerText=\
''.dol_escape_js($langs->transnoentitiesnoconv(
"ShowAdvancedOptions").
'...').
'\';
263print '<div
id=
"div_container_sub_exportoptions" style=
"display: none;">
';
265if (in_array($type, array('mysql
', 'mysqli
'))) {
266 print "<!-- Fieldset mysqldump -->\n";
267 print '<fieldset
id=
"mysql_options">
';
269 print '<fieldset
class=
"formelementrow"><legend>
'.$langs->trans("FullPathToMysqldumpCommand").'</legend>
';
270 if (!getDolGlobalString('SYSTEMTOOLS_MYSQLDUMP
')) {
271 $fullpathofmysqldump = $db->getPathOfDump();
273 $fullpathofmysqldump = getDolGlobalString('SYSTEMTOOLS_MYSQLDUMP
');
275 print '<input
type=
"text" name=
"mysqldump" style=
"width: 80%" value=
"'.$fullpathofmysqldump.'" spellcheck=
"false">
';
279 print '<fieldset><legend>
'.$langs->trans("ExportOptions").'</legend>
';
281 if (getDolGlobalString('MYSQL_OLD_OPTION_DISABLE_FK
')) {
282 print '<div
class=
"formelementrow">
';
283 print '<input
type=
"checkbox" name=
"disable_fk" value=
"yes" id=
"checkbox_disable_fk" checked>
';
284 print '<label
for=
"checkbox_disable_fk">
'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning
')).'</label>
';
288 print '<label
for=
"select_sql_compat">
'.$langs->trans("ExportCompatibility").'</label>
';
290 print '<select
name=
"sql_compat" id=
"select_sql_compat" class=
"flat">
';
291 print '<option value=
"NONE" selected>NONE</option>
';
292 print '<option value=
"ANSI">ANSI</option>
';
293 print '<option value=
"DB2">DB2</option>
';
294 print '<option value=
"MAXDB">MAXDB</option>
';
295 print '<option value=
"MYSQL323">MYSQL323</option>
';
296 print '<option value=
"MYSQL40">MYSQL40</option>
';
297 print '<option value=
"MSSQL">MSSQL</option>
';
298 print '<option value=
"ORACLE">ORACLE</option>
';
299 print '<option value=
"POSTGRESQL">POSTGRESQL</option>
';
303 print '<div
class=
"formelementrow">
';
304 print '<input
type=
"checkbox" name=
"use_transaction" value=
"yes" id=
"checkbox_use_transaction" checked=
"checked">
';
305 print '<label
for=
"checkbox_use_transaction">
'.$langs->trans("UseTransactionnalMode").'</label>
';
308 print '<input
type=
"checkbox" name=
"use_mysql_quick_param" value=
"yes" id=
"checkbox_use_quick" checked=
"checked" />
';
309 print '<label
for=
"checkbox_use_quick">
';
310 print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter
'), $langs->trans('ExportUseMySQLQuickParameterHelp
'));
314 print '<input
type=
"checkbox" name=
"use_force" value=
"no" id=
"checkbox_use_force" />
';
315 print '<label
for=
"checkbox_use_force">
';
316 print $form->textwithpicto($langs->trans('ExportUseForce
'), $langs->trans('ExportUseForceHelp
'));
321 if (getDolGlobalString('MAIN_EXEC_USE_POPEN
')) {
322 $execmethod = getDolGlobalString('MAIN_EXEC_USE_POPEN
');
324 if (empty($execmethod)) {
327 if ($execmethod == 1) {
328 // If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode.
329 print '<input
type=
"checkbox" name=
"lowmemorydump" value=
"1" id=
"lowmemorydump"'.((GETPOSTISSET('lowmemorydump
') ? GETPOSTINT('lowmemorydump
') : getDolGlobalInt('MAIN_LOW_MEMORY_DUMP
')) ? ' checked=
"checked"' : '').'" />';
330 print '<label for="lowmemorydump
">';
331 print $form->textwithpicto($langs->trans('ExportUseLowMemoryMode'), $langs->trans('ExportUseLowMemoryModeHelp'));
336 print '<!-- <input type="checkbox
" name="drop_database
" value="yes
" id="checkbox_drop_database
" />';
337 print '<label for="checkbox_drop_database
">'.$langs->trans("AddDropDatabase
").'</label>';
344 print '<input type="checkbox
" name="sql_structure
" value="structure
" id="checkbox_sql_structure
" checked />';
345 print '<label for="checkbox_sql_structure
">'.$langs->trans('ExportStructure').'</label>';
348 print '<input type="checkbox
" name="drop
"'.((!GETPOSTISSET("drop
") || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop
" />';
349 print '<label for="checkbox_dump_drop
">'.$langs->trans("AddDropTable
").'</label>';
356 print '<input type="checkbox
" name="sql_data
" value="data
" id="checkbox_sql_data
" checked />';
357 print '<label for="checkbox_sql_data
">'.$langs->trans("Datas
").'</label>';
359 print '<input type="checkbox
" name="showcolumns
" value="yes
" id="checkbox_dump_showcolumns
" checked />';
360 print '<label for="checkbox_dump_showcolumns
">'.$langs->trans("NameColumn
").'</label>';
363 print '<input type="checkbox
" name="extended_ins
" value="yes
" id="checkbox_dump_extended_ins
" checked />';
364 print '<label for="checkbox_dump_extended_ins
">'.$langs->trans("ExtendedInsert
").'</label>';
367 print '<input type="checkbox
" name="disable-add-locks
" value="no
" id="checkbox_dump_disable-add-locks
" />';
368 print '<label for="checkbox_dump_disable-add-locks
">'.$langs->trans("NoLockBeforeInsert
").'</label>';
371 print '<input type="checkbox
" name="delayed
" value="yes
" id="checkbox_dump_delayed
" />';
372 print '<label for="checkbox_dump_delayed
">'.$langs->trans("DelayedInsert
").'</label>';
375 print '<input type="checkbox
" name="sql_ignore
" value="yes
" id="checkbox_dump_ignore
" />';
376 print '<label for="checkbox_dump_ignore
">'.$langs->trans("IgnoreDuplicateRecords
").'</label>';
379 print '<input type="checkbox
" name="hexforbinary
" value="yes
" id="checkbox_hexforbinary
" checked />';
380 print '<label for="checkbox_hexforbinary
">'.$langs->trans("EncodeBinariesInHexa
").'</label>';
383 print '<input type="checkbox
" name="charset_utf8
" value="yes
" id="checkbox_charset_utf8
" checked disabled />';
384 print '<label for="checkbox_charset_utf8
">'.$langs->trans("UTF8
").'</label>';
391 print "<!-- Fieldset mysql_nobin -->\n
";
392 print '<fieldset id="mysql_nobin_options
">';
395 print '<legend>'.$langs->trans("ExportOptions
").'</legend>';
397 print '<div class="formelementrow
">';
398 print '<input type="checkbox
" name="nobin_use_transaction
" value="yes
" id="checkbox_use_transaction
" />';
399 print '<label for="checkbox_use_transaction
">'.$langs->trans("UseTransactionnalMode
").'</label>';
402 if (getDolGlobalString('MYSQL_OLD_OPTION_DISABLE_FK')) {
403 print '<div class="formelementrow
">';
404 print '<input type="checkbox
" name="nobin_disable_fk
" value="yes
" id="checkbox_disable_fk
" checked />';
405 print '<label for="checkbox_disable_fk
">'.$langs->trans("CommandsToDisableForeignKeysForImport
").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
411 print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
412 print '<input type="checkbox
" name="nobin_drop
"'.((!GETPOSTISSET("nobin_drop
") || GETPOST('nobin_drop')) ? ' checked' : '').' id="checkbox_dump_drop
" />';
413 print '<label for="checkbox_dump_drop
">'.$langs->trans("AddDropTable
").'</label>';
419 print '<legend>'.$langs->trans("Datas
").'</legend>';
421 print '<input type="checkbox
" name="nobin_nolocks
" value="no
" id="checkbox_dump_disable-add-locks
" />';
422 print '<label for="checkbox_dump_disable-add-locks
">'.$langs->trans("NoLockBeforeInsert
").'</label>';
425 print '<input type="checkbox
" name="nobin_delayed
" value="yes
" id="checkbox_dump_delayed
" />';
426 print '<label for="checkbox_dump_delayed
">'.$langs->trans("DelayedInsert
").'</label>';
429 print '<input type="checkbox
" name="nobin_sql_ignore
" value="yes
" id="checkbox_dump_ignore
" />';
430 print '<label for="checkbox_dump_ignore
">'.$langs->trans("IgnoreDuplicateRecords
").'</label>';
433 print '<input type="checkbox
" name="nobin_charset_utf8
" value="yes
" id="checkbox_charset_utf8
" checked disabled />';
434 print '<label for="checkbox_charset_utf8
">'.$langs->trans("UTF8
").'</label>';
441if (in_array($type, array('pgsql'))) {
442 print "<!-- Fieldset pg_dump -->\n
";
443 print '<fieldset id="postgresql_options
">';
446 print '<fieldset class="formelementrow
"><legend>'.$langs->trans("FullPathToPostgreSQLdumpCommand
").'</legend>';
447 if (!getDolGlobalString('SYSTEMTOOLS_POSTGRESQLDUMP')) {
448 $fullpathofpgdump = $db->getPathOfDump();
450 $fullpathofpgdump = getDolGlobalString('SYSTEMTOOLS_POSTGRESQLDUMP');
453 print '<input type="text
" name="postgresqldump
" style="width: 80%
" value="'.$fullpathofpgdump.'" />';
458 print '<legend>'.$langs->trans("ExportOptions
").'</legend>';
459 print '<label for="select_sql_compat
">'.$langs->trans("ExportCompatibility
").'</label>';
460 print '<select name="sql_compat
" id="select_sql_compat
" class="flat
">';
461 print '<option value="POSTGRESQL
" selected>POSTGRESQL</option>';
462 print '<option value="ANSI
">ANSI</option>';
465 print '<!-- <input type="checkbox
" name="drop_database
" value="yes
" id="checkbox_drop_database
" />';
466 print '<label for="checkbox_drop_database
">'.$langs->trans("AddDropDatabase
").'</label>';
472 print '<input type="checkbox
" name="sql_structure
" value="structure
" id="checkbox_sql_structure
" checked />';
473 print '<label for="checkbox_sql_structure
">'.$langs->trans('ExportStructure').'</label>';
479 print '<input type="checkbox
" name="sql_data
" value="data
" id="checkbox_sql_data
" checked />';
480 print '<label for="checkbox_sql_data
">'.$langs->trans("Datas
").'</label>';
482 print '<input type="checkbox
" name="showcolumns
" value="yes
" id="checkbox_dump_showcolumns
" checked />';
483 print '<label for="checkbox_dump_showcolumns
">'.$langs->trans("NameColumn
").'</label>';
497print '<!--<fieldset>';
498print '<legend>'.$langs->trans("Destination
").'</legend> -->';
500print '<label for="filename_template
" class="line-height-large opacitymedium
">'.$langs->trans("FileNameToGenerate
").'</label>';
504if (in_array($type, array('mysql', 'mysqli'))) {
505 $prefix = 'mysqldump';
508//if ($label == 'PostgreSQL') {
512if (in_array($type, array('pgsql'))) {
516$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall
", 'tzuser').'.'.$ext;
517print '<input type="text
" name="filename_template
" style="width: 90%
" id="filename_template
" value="'.$file.'" />';
521// Define compressions array
522$compression = array();
523if (in_array($type, array('mysql', 'mysqli'))) {
524 $compression['gz'] = array(
525 'function' => 'gzopen',
526 'id' => 'radio_compression_gzip',
527 'label' => $langs->trans("Gzip
")
529 // Not open source format. Must implement dol_compress function
530 // $compression['zip']= array(
531 // 'function' => 'dol_compress',
532 // 'id' => 'radio_compression_zip',
533 // 'label' => $langs->trans("FormatZip
")
535 $compression['bz'] = array(
536 'function' => 'bzopen',
537 'id' => 'radio_compression_bzip',
538 'label' => $langs->trans("Bzip2
")
540 $compression['zstd'] = array(
541 'function' => 'zstd_compress',
542 'id' => 'radio_compression_zstd',
543 'label' => $langs->trans("Zstd
")
545 $compression['none'] = array(
547 'id' => 'radio_compression_none',
548 'label' => $langs->trans("None
")
551 $compression['none'] = array(
553 'id' => 'radio_compression_none',
554 'label' => $langs->trans("None
")
556 $compression['gz'] = array(
557 'function' => 'gzopen',
558 'id' => 'radio_compression_gzip',
559 'label' => $langs->trans("Gzip
")
563// Show compression choices
564print '<div class="formelementrow
">';
567print $langs->trans("Compression
").': ';
570foreach ($compression as $key => $val) {
571 if (!$val['function'] || function_exists($val['function'])) {
572 // Enabled export format
575 $checked = ' checked';
577 print '<input type="radio
" name="compression
" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
578 print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
580 // Disabled export format
581 print '<input type="radio
" name="compression
" value="'.$key.'" id="'.$val['id'].'" disabled>';
582 print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
583 print ' <span class="opacitymedium
">('.$langs->trans("NotAvailable
").')</span>';
585 print ' ';
592print "<!--</fieldset>--> <!-- End destination -->\n
";
595print '<div class="center
">';
596print '<input type="submit
" class="button reposition
" value="'.$langs->trans("GenerateBackup").'" id="buttonGo
">';
600if (!empty($_SESSION["commandbackuplastdone
"])) {
601 print '<br><b>'.$langs->trans("RunCommandSummary
").':</b><br>'."\n
";
602 print '<textarea rows="'.ROWS_2.'" class="centpercent
">'.$_SESSION["commandbackuplastdone
"].'</textarea><br>'."\n
";
608 print '<b>'.$langs->trans("BackupResult
").':</b> ';
609 print $_SESSION["commandbackupresult
"];
611 $_SESSION["commandbackuplastdone
"] = '';
612 $_SESSION["commandbackuptorun
"] = '';
613 $_SESSION["commandbackupresult
"] = '';
615if (!empty($_SESSION["commandbackuptorun
"])) {
616 print '<br><span class="warning
">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser
", $dolibarr_main_db_user, $dolibarr_main_db_user).':</span><br>'."\n
";
617 print '<textarea id="commandbackuptoruntext
" rows="'.ROWS_2.'" class="centpercent
">'.$_SESSION["commandbackuptorun
"].'</textarea><br>'."\n
";
618 print ajax_autoselect("commandbackuptoruntext
", '');
623 $_SESSION["commandbackuplastdone
"] = '';
624 $_SESSION["commandbackuptorun
"] = '';
625 $_SESSION["commandbackupresult
"] = '';
628print "</div> <!-- end div center
button -->\n
";
633print "</div> <!-- end div fichehalfleft -->\n
";
636print '<div id="backupdatabaseright
" class="fichehalfright
">';
638$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ? SORT_ASC : SORT_DESC), 1);
639$result = $formfile->list_of_documents($filearray, null, 'systemtools', $paramallowdownloadapp, 1, 'backup/', 1, 3, $langs->trans("NoBackupFileAvailable
"), 0, $langs->trans("PreviousDumpFiles
"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow:
auto;
"');
647$title = $langs->trans("BackupZipWizard
");
650print "<!-- Dump of a server -->\n
";
652print '<form method="post
" action="'.DOL_URL_ROOT.'/admin/tools/export_files.php
" name="dump
" spellcheck="false">';
653print '<input type="hidden
" name="token
" value="'.newToken().'" />';
654print '<input type="hidden
" name="export_type
" value="server
" />';
655print '<input type="hidden
" name="page_y
" value="" />';
656if ($allowdownloadapp) {
657 print '<input type="hidden
" name="allow_download_app
" value="1
" />';
660print '<fieldset><legend class="legendforfieldsetstep
" style="font-size: 3em
">2</legend>';
662print '<span class="opacitymedium
">';
663print $langs->trans("BackupDesc2
", DOL_DATA_ROOT).'<br>';
664print $langs->trans("BackupDescX
").'<br><br>';
667print '<div id="backupfilesleft
" class="fichehalfleft
">';
669print load_fiche_titre($title);
671print '<label for="zipfilename_template
" class="line-height-large paddingbottom opacitymedium
">'.$langs->trans("FileNameToGenerate
").'</label><br>';
672$prefix = 'documents';
674$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall
", 'tzuser');
675print '<input type="text
" name="zipfilename_template
" style="width: 90%
" id="zipfilename_template
" value="'.$file.'" /> <br>';
679// Show compression choices
680// Example: With gz choice, you can compress in 5mn, a file of 2GB directory (after compression) with 10 Mb memory.
681print '<div class="formelementrow
">';
684print $langs->trans("Compression
").': ';
685$filecompression = $compression;
686unset($filecompression['none']);
687$filecompression['zip'] = array('function' => 'dol_compress_dir', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip
"));
689// The gz, bz and zstd formats are built by export_files.php with OS commands (tar then a compressor). When
690// $dolibarr_main_restrict_os_commands is set (default since 24.0.1), Utils::executeCLI() refuses any command not in
691// the list, so a format whose commands are not allowed must not be offered.
692$oscommandsforformat = array('gz' => array('tar', 'gzip'), 'bz' => array('tar', 'bzip2'), 'zstd' => array('tar', 'zstd'));
693$arrayofallowedcommand = array();
694if (!empty($dolibarr_main_restrict_os_commands)) {
695 $arrayofallowedcommand = array_map('trim', explode(',', $dolibarr_main_restrict_os_commands));
697$disabledbyrestriction = array();
698foreach ($oscommandsforformat as $key => $commands) {
699 if (!empty($arrayofallowedcommand) && array_diff($commands, $arrayofallowedcommand)) {
700 $disabledbyrestriction[$key] = implode(', ', array_diff($commands, $arrayofallowedcommand));
703$defaultcompression = empty($disabledbyrestriction['gz']) ? 'gz' : 'zip';
706foreach ($filecompression as $key => $val) {
707 if ((!$val['function'] || function_exists($val['function'])) && empty($disabledbyrestriction[$key])) { // Enabled export format
709 if ($key == $defaultcompression) {
710 $checked = ' checked';
712 print '<input type="radio
" name="compression
" value="'.$key.'" id="'.$val['id'].'2
"'.$checked.'>';
713 print ' <label for="'.$val['id'].'2
">'.$val['label'].'</label>';
714 } else { // Disabled export format
715 print '<input type="radio
" name="compression
" value="'.$key.'" id="'.$val['id'].'2
" disabled>';
716 print ' <label for="'.$val['id'].'2
">'.$val['label'].'</label>';
717 if (!empty($disabledbyrestriction[$key])) {
718 print ' <span class="opacitymedium
">('.$langs->trans("NotAvailableCommandNotAllowed
", $disabledbyrestriction[$key]).')</span>';
720 print ' <span class="opacitymedium
">('.$langs->trans("NotAvailable
").')</span>';
723 print ' ';
726if (!empty($disabledbyrestriction)) {
727 print '<br><span class="opacitymedium small
">'.$langs->trans("RestrictOsCommandsHelp
", 'dolibarr_main_restrict_os_commands').'</span>';
734print '<div class="center
">';
735print '<input type="submit
" class="button reposition
" value="'.$langs->trans("GenerateBackup").'" id="buttonGo
" /><br>';
741print '<div id="backupfileright
" class="fichehalfright
">';
743$filearray = dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ? SORT_ASC : SORT_DESC), 1);
744$result = $formfile->list_of_documents($filearray, null, 'systemtools', $paramallowdownloadapp, 1, 'documents/', 1, 3, $langs->trans("NoBackupFileAvailable
"), 0, $langs->trans("PreviousArchiveFiles
"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow:
auto;
"');
755// Step 3 (optional): Export the application files (directory DOL_DOCUMENT_ROOT)
756if ($allowdownloadapp) {
757 print "<!-- Dump of the application directory -->\n
";
760 print '<form method="post
" action="'.DOL_URL_ROOT.'/admin/tools/export_files.php
" name="dumpapp
" spellcheck="false">';
761 print '<input type="hidden
" name="token
" value="'.newToken().'" />';
762 print '<input type="hidden
" name="export_type
" value="app
" />';
763 print '<input type="hidden
" name="page_y
" value="" />';
765 print '<fieldset><legend class="legendforfieldsetstep
" style="font-size: 3em
">3</legend>';
767 print '<span class="opacitymedium
">';
768 print $langs->trans("BackupDescApp
", DOL_DOCUMENT_ROOT).'<br>';
769 print $langs->trans("BackupDescX
").'<br><br>';
772 print '<div id="backupappfilesleft
" class="fichehalfleft
">';
774 $title = $langs->trans("BackupAppZipWizard
");
776 print load_fiche_titre($title);
778 print '<label for="appfilename_template
" class="line-height-large paddingbottom opacitymedium
">'.$langs->trans("FileNameToGenerate
").'</label><br>';
779 $prefix = 'application';
780 $file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.dol_print_date(dol_now('gmt'), "dayhourlogsmall
", 'tzuser');
781 print '<input type="text
" name="zipfilename_template
" style="width: 90%
" id="appfilename_template
" value="'.$file.'" /> <br>';
784 // Show compression choices (same choices than for the documents directory)
785 print '<div class="formelementrow
">';
787 print $langs->trans("Compression
").': ';
788 foreach ($filecompression as $key => $val) {
789 if ((empty($val['function']) || function_exists($val['function'])) && empty($disabledbyrestriction[$key])) { // Enabled export format
791 if ($key == $defaultcompression) {
792 $checked = ' checked';
794 print '<input type="radio
" name="compression
" value="'.$key.'" id="'.$val['id'].'3
"'.$checked.'>';
795 print ' <label for="'.$val['id'].'3
">'.$val['label'].'</label>';
796 } else { // Disabled export format
797 print '<input type="radio
" name="compression
" value="'.$key.'" id="'.$val['id'].'3
" disabled>';
798 print ' <label for="'.$val['id'].'3
">'.$val['label'].'</label>';
799 if (!empty($disabledbyrestriction[$key])) {
800 print ' <span class="opacitymedium
">('.$langs->trans("NotAvailableCommandNotAllowed
", $disabledbyrestriction[$key]).')</span>';
802 print ' <span class="opacitymedium
">('.$langs->trans("NotAvailable
").')</span>';
805 print ' ';
807 if (!empty($disabledbyrestriction)) {
808 print '<br><span class="opacitymedium small
">'.$langs->trans("RestrictOsCommandsHelp
", 'dolibarr_main_restrict_os_commands').'</span>';
814 print '<div class="center
">';
815 print '<input type="submit
" class="button reposition
" value="'.$langs->trans("GenerateBackup").'" id="buttonGo3
" /><br>';
821 print '<div id="backupappfilesright
" class="fichehalfright
">';
823 $filearray = dol_dir_list($conf->admin->dir_output.'/backupapp', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ? SORT_ASC : SORT_DESC), 1);
824 $result = $formfile->list_of_documents($filearray, null, 'systemtools', $paramallowdownloadapp, 1, 'backupapp/', 1, 3, $langs->trans("NoBackupFileAvailable
"), 0, $langs->trans("PreviousArchiveFiles
"), '', 0, -1, '', '', 'ASC', 1, 0, -1, 'style="height:250px; overflow:
auto;
"');
831} elseif ($allow_download_app) {
832 // The parameter allow_download_app was provided but the option $dolibarr_allow_download_app
833 // is not set into the conf/conf.php file, so the step to export the application files is not shown.
835 print '<div class="center
"><span class="warning
">'.$langs->trans("DownloadOfAppFileDisallowed
").'</span></div>';
841print "<!-- Save setup
conf -->\n
";
843print '<fieldset><legend class="legendforfieldsetstep
" style="font-size: 3em
">'.($allowdownloadapp ? 4 : 3).'</legend>';
847print '<span class="opacitymedium
">';
848print $langs->trans("BackupDesc4
", 'dolibarr_main_dolcrypt_key '.$langs->transnoentitiesnoconv("or
").' dolibarr_main_instance_unique_id').'<br>';
853print '<div id="backupfileright
">';
855print $langs->trans("SeeValueIntoConfPhp
").'<br>';
856print $langs->trans("SeeValueIntoConfPhp2
");
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
conf($dolibarr_main_document_root, $realpathconf=null)
Load conf file (file must exists)
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.