dolibarr  13.0.2
dolibarr_export.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2006-2018 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2006-2018 Regis Houssin <regis.houssin@inodbox.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 require '../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
29 
30 $langs->load("admin");
31 
32 $action = GETPOST('action', 'aZ09');
33 
34 $sortfield = GETPOST('sortfield', 'aZ09comma');
35 $sortorder = GETPOST('sortorder', 'aZ09comma');
36 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
37 if (!$sortorder) $sortorder = "DESC";
38 if (!$sortfield) $sortfield = "date";
39 if (empty($page) || $page == -1) { $page = 0; }
40 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
41 $offset = $limit * $page;
42 
43 if (!$user->admin)
45 
46 
47 /*
48  * Actions
49  */
50 
51 if ($action == 'delete')
52 {
53  if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
54  {
55  $file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
56  $ret = dol_delete_file($file, 1);
57  if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
58  else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
59  } else {
60  $file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
61  $ret = dol_delete_file($file, 1);
62  if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
63  else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
64  }
65  $action = '';
66 }
67 
68 
69 /*
70  * View
71  */
72 
73 $form = new Form($db);
74 $formfile = new FormFile($db);
75 
76 $label = $db::LABEL;
77 $type = $db->type;
78 //var_dump($db);
79 
80 $help_url = 'EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
81 llxHeader('', '', $help_url);
82 
83 print '<script type="text/javascript">
84 jQuery(document).ready(function() {';
85 ?>
86 
87  function hideoptions () {
88  jQuery("#mysql_options").hide();
89  jQuery("#mysql_nobin_options").hide();
90  jQuery("#postgresql_options").hide();
91  }
92 
93  hideoptions();
94  jQuery("#radio_dump_mysql").click(function() {
95  hideoptions();
96  jQuery("#mysql_options").show();
97  });
98  jQuery("#radio_dump_mysql_nobin").click(function() {
99  hideoptions();
100  jQuery("#mysql_nobin_options").show();
101  });
102  jQuery("#radio_dump_postgresql").click(function() {
103  hideoptions();
104  jQuery("#postgresql_options").show();
105  });
106  jQuery("#select_sql_compat").click(function() {
107  if (jQuery("#select_sql_compat").val() == 'POSTGRESQL')
108  {
109  jQuery("#checkbox_dump_disable-add-locks").prop('checked',true);
110  }
111  });
112 
113 <?php
114 if (in_array($type, array('mysql', 'mysqli'))) {
115  print 'jQuery("#radio_dump_mysql").click();';
116 }
117 if (in_array($type, array('pgsql'))) {
118  print 'jQuery("#radio_dump_postgresql").click();';
119 }
120 print "});\n";
121 print "</script>\n";
122 
123 $title = $langs->trans("Backup");
124 
125 print load_fiche_titre($title, '', 'title_setup');
126 //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup');
127 
128 print '<div class="center opacitymedium">';
129 print $langs->trans("BackupDesc", DOL_DATA_ROOT);
130 print '</div>';
131 print '<br>';
132 
133 print "<!-- Dump of a server -->\n";
134 print '<form method="post" action="export.php" name="dump">';
135 print '<input type="hidden" name="token" value="'.newToken().'" />';
136 print '<input type="hidden" name="export_type" value="server" />';
137 print '<fieldset id="fieldsetexport"><legend class="legendforfieldsetstep" style="font-size: 3em">1</legend>';
138 
139 print $langs->trans("BackupDesc3", $dolibarr_main_db_name).'<br>';
140 //print $langs->trans("BackupDescY").'<br>';
141 print '<br>';
142 
143 print '<div id="backupdatabaseleft" class="fichehalfleft" >';
144 
145 $title = $langs->trans("BackupDumpWizard");
146 
147 print load_fiche_titre($title);
148 
149 print '<table width="100%" class="'.($useinecm ? 'nobordernopadding' : 'liste').' nohover">';
150 print '<tr class="liste_titre">';
151 print '<td class="liste_titre">';
152 print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
153 print '</td>';
154 print '</tr>';
155 print '<tr class="oddeven nohover"><td style="padding-left: 8px" class="nohover">';
156 print '<table class="centpercent">';
157 print '<tr>';
158 print '<td class="tdtop">';
159 
160 print '<div id="div_container_exportoptions">';
161 print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>';
162 if (in_array($type, array('mysql', 'mysqli'))) {
163  print '<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />';
164  print '<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>';
165  print '</div>';
166  print '<br>';
167  print '<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />';
168  print '<label for="radio_dump_mysql_nobin">MySQL Dump (php) '.img_warning($langs->trans('BackupPHPWarning')).'</label>';
169  print '</div>';
170 } elseif (in_array($type, array('pgsql'))) {
171  print '<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />';
172  print '<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
173  print '</div>';
174 } else {
175  print 'No method available with database '.$label;
176 }
177 print '</fieldset>';
178 print '</div>';
179 
180 print '</td>';
181 print '<td class="tdtop">';
182 
183 
184 print '<div id="div_container_sub_exportoptions">';
185 if (in_array($type, array('mysql', 'mysqli'))) {
186  print "<!-- Fieldset mysqldump -->\n";
187  print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
188 
189  print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
190  if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
191  {
192  $fullpathofmysqldump = $db->getPathOfDump();
193  } else {
194  $fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
195  }
196  print '<br>';
197  print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
198 
199  print '<br>';
200  print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
201  print '<div class="formelementrow">';
202  print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
203  print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
204  print '</div>';
205 
206  if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
207  print '<div class="formelementrow">';
208  print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
209  print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
210  print '</div>';
211  }
212 
213  print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
214 
215  print '<select name="sql_compat" id="select_sql_compat" class="flat">';
216  print '<option value="NONE" selected>NONE</option>';
217  print '<option value="ANSI">ANSI</option>';
218  print '<option value="DB2">DB2</option>';
219  print '<option value="MAXDB">MAXDB</option>';
220  print '<option value="MYSQL323">MYSQL323</option>';
221  print '<option value="MYSQL40">MYSQL40</option>';
222  print '<option value="MSSQL">MSSQL</option>';
223  print '<option value="ORACLE">ORACLE</option>';
224  print '<option value="POSTGRESQL">POSTGRESQL</option>';
225  print '</select>';
226  print '<br>';
227 
228  print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" />';
229  print '<label for="checkbox_use_quick">';
230  print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
231  print '</label>';
232  print '<br/>';
233 
234  print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
235  print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
236  print '-->';
237  print '</fieldset>';
238 
239  print '<br>';
240  print '<fieldset>';
241  print '<legend>';
242  print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
243  print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
244  print '</legend>';
245 
246  print '<input type="checkbox" name="drop"'.((!GETPOSTISSET("drop") || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
247  print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
248  print '<br>';
249  print '</fieldset>';
250 
251  print '<br>';
252  print '<fieldset>';
253  print '<legend>';
254  print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
255  print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
256  print '</legend>';
257  print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
258  print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
259  print '<br>';
260 
261  print '<input type="checkbox" name="extended_ins" value="yes" id="checkbox_dump_extended_ins" checked />';
262  print '<label for="checkbox_dump_extended_ins">'.$langs->trans("ExtendedInsert").'</label>';
263  print '<br>';
264 
265  print '<input type="checkbox" name="disable-add-locks" value="no" id="checkbox_dump_disable-add-locks" />';
266  print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
267  print '<br>';
268 
269  print '<input type="checkbox" name="delayed" value="yes" id="checkbox_dump_delayed" />';
270  print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
271  print '<br>';
272 
273  print '<input type="checkbox" name="sql_ignore" value="yes" id="checkbox_dump_ignore" />';
274  print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
275  print '<br>';
276 
277  print '<input type="checkbox" name="hexforbinary" value="yes" id="checkbox_hexforbinary" checked />';
278  print '<label for="checkbox_hexforbinary">'.$langs->trans("EncodeBinariesInHexa").'</label>';
279  print '<br>';
280 
281  print '<input type="checkbox" name="charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
282  print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
283  print '<br>';
284 
285  print '</fieldset>';
286  print '</fieldset>';
287  print "<!-- Fieldset mysql_nobin -->\n";
288  print '<fieldset id="mysql_nobin_options">';
289  print '<legend>'.$langs->trans("MySqlExportParameters").'</legend>';
290  print '<fieldset>';
291  print '<legend>'.$langs->trans("ExportOptions").'</legend>';
292  print '<div class="formelementrow">';
293  print '<input type="checkbox" name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" />';
294  print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
295 
296  print '</div>';
297  if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
298  print '<div class="formelementrow">';
299  print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
300  print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
301  print '</div>';
302  }
303  print '</fieldset>';
304 
305  print '<br>';
306  print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
307  print '<input type="checkbox" name="nobin_drop"'.((!GETPOSTISSET("nobin_drop") || GETPOST('nobin_drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
308  print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
309  print '<br>';
310  print '</fieldset>';
311 
312  print '<br>';
313  print '<fieldset>';
314  print '<legend>'.$langs->trans("Datas").'</legend>';
315 
316  print '<input type="checkbox" name="nobin_nolocks" value="no" id="checkbox_dump_disable-add-locks" />';
317  print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
318  print '<br>';
319 
320  print '<input type="checkbox" name="nobin_delayed" value="yes" id="checkbox_dump_delayed" />';
321  print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
322  print '<br>';
323 
324  print '<input type="checkbox" name="nobin_sql_ignore" value="yes" id="checkbox_dump_ignore" />';
325  print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
326  print '<br>';
327 
328  print '<input type="checkbox" name="nobin_charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
329  print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
330  print '<br>';
331 
332  print '</fieldset>';
333  print '</fieldset>';
334 }
335 
336 if (in_array($type, array('pgsql'))) {
337  print "<!-- Fieldset pg_dump -->\n";
338  print '<fieldset id="postgresql_options"><legend>'.$langs->trans("PostgreSqlExportParameters").'</legend>';
339 
340  print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
341  if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
342  $fullpathofpgdump = $db->getPathOfDump();
343  } else {
344  $fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
345  }
346  print '<br>';
347  print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
348 
349  print '<br>';
350  print '<fieldset>';
351  print '<legend>'.$langs->trans("ExportOptions").'</legend>';
352  print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
353  print '<select name="sql_compat" id="select_sql_compat" class="flat">';
354  print '<option value="POSTGRESQL" selected>POSTGRESQL</option>';
355  print '<option value="ANSI">ANSI</option>';
356  print '</select>';
357  print '<br>';
358  print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
359  print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
360  print '-->';
361  print '</fieldset>';
362  print '<br>';
363  print '<fieldset>';
364  print '<legend>';
365  print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
366  print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
367  print '</legend>';
368  print '</fieldset>';
369  print '<br>';
370  print '<fieldset>';
371  print '<legend>';
372  print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
373  print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
374  print '</legend>';
375  print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
376  print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
377  print '<br>';
378  print '</fieldset>';
379  print '</fieldset>';
380 }
381 print '</div>';
382 
383 print '</td>';
384 print '</tr>';
385 print '</table>';
386 
387 
388 print '<!--<fieldset>';
389 print '<legend>'.$langs->trans("Destination").'</legend> -->';
390 print '<br>';
391 print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
392 print '<br>';
393 $prefix = 'dump';
394 $ext = '.sql';
395 if (in_array($type, array('mysql', 'mysqli'))) {
396  $prefix = 'mysqldump';
397  $ext = 'sql';
398 }
399 //if ($label == 'PostgreSQL') {
400 // $prefix='pg_dump';
401 // $ext='dump';
402 //}
403 if (in_array($type, array('pgsql'))) {
404  $prefix = 'pg_dump';
405  $ext = 'sql';
406 }
407 $file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
408 print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
409 print '<br>';
410 print '<br>';
411 
412 // Define compressions array
413 $compression = array();
414 if (in_array($type, array('mysql', 'mysqli'))) {
415  $compression['gz'] = array(
416  'function' => 'gzopen',
417  'id' => 'radio_compression_gzip',
418  'label' => $langs->trans("Gzip")
419  );
420  // Not open source format. Must implement dol_compress function
421  // $compression['zip']= array(
422  // 'function' => 'dol_compress',
423  // 'id' => 'radio_compression_zip',
424  // 'label' => $langs->trans("FormatZip")
425  // );
426  $compression['bz'] = array(
427  'function' => 'bzopen',
428  'id' => 'radio_compression_bzip',
429  'label' => $langs->trans("Bzip2")
430  );
431  $compression['none'] = array(
432  'function' => '',
433  'id' => 'radio_compression_none',
434  'label' => $langs->trans("None")
435  );
436 } else {
437  $compression['none'] = array(
438  'function' => '',
439  'id' => 'radio_compression_none',
440  'label' => $langs->trans("None")
441  );
442  $compression['gz'] = array(
443  'function' => 'gzopen',
444  'id' => 'radio_compression_gzip',
445  'label' => $langs->trans("Gzip")
446  );
447 }
448 
449 // Show compression choices
450 print '<div class="formelementrow">';
451 print "\n";
452 
453 print $langs->trans("Compression").': &nbsp; ';
454 
455 $i = 0;
456 foreach ($compression as $key => $val)
457 {
458  if (!$val['function'] || function_exists($val['function'])) {
459  // Enabled export format
460  $checked = '';
461  if ($key == 'gz') $checked = ' checked';
462  print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
463  print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
464  } else {
465  // Disabled export format
466  print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
467  print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
468  print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
469  }
470  print ' &nbsp; &nbsp; ';
471  $i++;
472 }
473 
474 print '</div>';
475 print "\n";
476 
477 print "<!--</fieldset>--> <!-- End destination -->\n";
478 
479 print '<br>';
480 print '<div class="center">';
481 print '<input type="submit" class="button reposition" value="'.$langs->trans("GenerateBackup").'" id="buttonGo">';
482 print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">';
483 print '<br>';
484 print '<br>';
485 
486 if (!empty($_SESSION["commandbackuplastdone"]))
487 {
488  print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
489  print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
490  print '<br>';
491 
492  //print $paramclear;
493 
494  // Now show result
495  print '<b>'.$langs->trans("BackupResult").':</b> ';
496  print $_SESSION["commandbackupresult"];
497 
498  $_SESSION["commandbackuplastdone"] = '';
499  $_SESSION["commandbackuptorun"] = '';
500  $_SESSION["commandbackupresult"] = '';
501 }
502 if (!empty($_SESSION["commandbackuptorun"]))
503 {
504  print '<br><font class="warning">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':</font><br>'."\n";
505  print '<textarea id="commandbackuptoruntext" rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuptorun"].'</textarea><br>'."\n";
506  print ajax_autoselect("commandbackuptoruntext", 0);
507  print '<br>';
508 
509  //print $paramclear;
510 
511  $_SESSION["commandbackuplastdone"] = '';
512  $_SESSION["commandbackuptorun"] = '';
513  $_SESSION["commandbackupresult"] = '';
514 }
515 
516 print "</div> <!-- end div center button -->\n";
517 
518 print '</td></tr>';
519 print '</table>';
520 
521 print "</div> <!-- end div fichehalfleft -->\n";
522 
523 
524 print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
525 print '<div class="ficheaddleft">';
526 
527 $filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
528 $result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
529 print '<br>';
530 
531 print '</div>';
532 print '</div>';
533 print '</form>';
534 print '</fieldset>';
535 
536 
537 
538 print "<br>\n";
539 print "<!-- Dump of a server -->\n";
540 
541 print '<form method="post" action="export_files.php" name="dump">';
542 print '<input type="hidden" name="token" value="'.newToken().'" />';
543 print '<input type="hidden" name="export_type" value="server" />';
544 print '<input type="hidden" name="page_y" value="" />';
545 
546 print '<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>';
547 
548 print $langs->trans("BackupDesc2", DOL_DATA_ROOT).'<br>';
549 print $langs->trans("BackupDescX").'<br><br>';
550 
551 print '<div id="backupfilesleft" class="fichehalfleft">';
552 
553 print load_fiche_titre($title ? $title : $langs->trans("BackupZipWizard"));
554 
555 print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
556 $prefix = 'documents';
557 $ext = 'zip';
558 $file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M");
559 print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
560 print '<br>';
561 
562 
563 // Show compression choices
564 // Example: With gz choice, you can compress in 5mn, a file of 2GB directory (after compression) with 10 Mb memory.
565 print '<div class="formelementrow">';
566 print "\n";
567 
568 print $langs->trans("Compression").': &nbsp; ';
569 $filecompression = $compression;
570 unset($filecompression['none']);
571 $filecompression['zip'] = array('function' => 'dol_compress_dir', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip"));
572 
573 $i = 0;
574 foreach ($filecompression as $key => $val)
575 {
576  if (!$val['function'] || function_exists($val['function'])) // Enabled export format
577  {
578  $checked = '';
579  if ($key == 'gz') $checked = ' checked';
580  print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
581  print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
582  } else // Disabled export format
583  {
584  print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
585  print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
586  print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
587  }
588  print ' &nbsp; &nbsp; ';
589  $i++;
590 }
591 
592 print '</div>';
593 print "\n";
594 
595 print '<br>';
596 print '<div class="center">';
597 print '<input type="submit" class="button reposition" value="'.$langs->trans("GenerateBackup").'" id="buttonGo" /><br>';
598 print '<br>';
599 print '</div>';
600 
601 print '</div>';
602 
603 print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
604 print '<div class="ficheaddleft">';
605 
606 $filearray = dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
607 $result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
608 print '<br>';
609 
610 print '</div>';
611 print '</div>';
612 
613 print '</fieldset>';
614 print '</form>';
615 
616 // End of page
617 llxFooter();
618 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
Definition: files.lib.php:1144
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:60
Class to offer components to list and upload files.
ajax_autoselect($htmlname, $addlink= '')
Make content of an input box selected when we click into input field.
print
Draft customers invoices.
Definition: index.php:89
img_info($titlealt= 'default')
Show info logo.
llxFooter()
Empty footer.
Definition: wrapper.php:59