2006-08-20 21:15:47 +02:00
< ? php
2018-04-18 08:34:48 +02:00
/* Copyright ( C ) 2006 - 2018 Laurent Destailleur < eldy @ users . sourceforge . net >
* Copyright ( C ) 2006 - 2018 Regis Houssin < regis . houssin @ capnetworks . com >
2006-08-20 21:15:47 +02:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2006-08-20 21:15:47 +02:00
* ( 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
2011-08-03 02:45:22 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2006-08-20 21:15:47 +02:00
*/
/**
2009-07-06 20:29:40 +02:00
* \file htdocs / admin / tools / dolibarr_export . php
* \ingroup core
* \brief Page to export database
*/
2007-07-28 13:29:09 +02:00
2012-08-22 23:24:21 +02:00
require '../../main.inc.php' ;
2012-08-22 23:11:24 +02:00
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' ;
2006-08-20 21:15:47 +02:00
$langs -> load ( " admin " );
2012-08-02 10:07:55 +02:00
$action = GETPOST ( 'action' , 'alpha' );
2012-02-10 11:09:34 +01:00
2012-08-02 10:07:55 +02:00
$sortfield = GETPOST ( 'sortfield' , 'alpha' );
$sortorder = GETPOST ( 'sortorder' , 'alpha' );
$page = GETPOST ( 'page' , 'int' );
2012-02-10 11:09:34 +01:00
if ( ! $sortorder ) $sortorder = " DESC " ;
if ( ! $sortfield ) $sortfield = " date " ;
2018-04-18 08:34:48 +02:00
if ( empty ( $page ) || $page == - 1 ) { $page = 0 ; }
2018-04-21 12:16:12 +02:00
$limit = GETPOST ( 'limit' , 'int' ) ? GETPOST ( 'limit' , 'int' ) : $conf -> liste_limit ;
2012-02-10 10:53:11 +01:00
$offset = $limit * $page ;
2012-08-02 10:07:55 +02:00
if ( ! $user -> admin )
accessforbidden ();
2009-01-23 15:29:57 +01:00
2012-02-10 10:53:11 +01:00
/*
* Actions
*/
2012-02-10 11:09:34 +01:00
if ( $action == 'delete' )
{
2014-03-31 00:19:31 +02:00
$file = $conf -> admin -> dir_output . '/' . GETPOST ( 'urlfile' );
2012-07-29 16:11:52 +02:00
$ret = dol_delete_file ( $file , 1 );
2015-10-23 12:58:30 +02:00
if ( $ret ) setEventMessages ( $langs -> trans ( " FileWasRemoved " , GETPOST ( 'urlfile' )), null , 'mesgs' );
else setEventMessages ( $langs -> trans ( " ErrorFailToDeleteFile " , GETPOST ( 'urlfile' )), null , 'errors' );
2012-02-10 11:09:34 +01:00
$action = '' ;
}
2007-07-28 13:29:09 +02:00
/*
2010-09-06 11:51:00 +02:00
* View
*/
2006-08-20 21:15:47 +02:00
2012-02-10 10:53:11 +01:00
$form = new Form ( $db );
$formfile = new FormFile ( $db );
2014-08-01 00:53:29 +02:00
$label = $db :: LABEL ;
2015-07-16 00:58:05 +02:00
$type = $db -> type ;
//var_dump($db);
2012-03-15 20:45:08 +01:00
2011-12-28 12:53:46 +01:00
$help_url = 'EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad' ;
llxHeader ( '' , '' , $help_url );
2006-08-20 21:15:47 +02:00
2010-09-06 11:51:00 +02:00
?>
2011-11-21 01:34:37 +01:00
< script type = " text/javascript " >
2010-09-06 11:51:00 +02:00
jQuery ( document ) . ready ( function () {
2011-10-14 16:02:18 +02:00
function hideoptions () {
jQuery ( " #mysql_options " ) . hide ();
2012-08-16 16:02:08 +02:00
jQuery ( " #mysql_nobin_options " ) . hide ();
2011-10-14 16:02:18 +02:00
jQuery ( " #postgresql_options " ) . hide ();
}
hideoptions ();
2010-09-06 11:51:00 +02:00
jQuery ( " #radio_dump_mysql " ) . click ( function () {
2011-10-14 16:02:18 +02:00
hideoptions ();
2010-09-06 11:51:00 +02:00
jQuery ( " #mysql_options " ) . show ();
});
2011-10-14 16:02:18 +02:00
jQuery ( " #radio_dump_mysql_nobin " ) . click ( function () {
hideoptions ();
2012-08-16 16:02:08 +02:00
jQuery ( " #mysql_nobin_options " ) . show ();
2011-10-14 16:02:18 +02:00
});
2010-09-06 11:51:00 +02:00
jQuery ( " #radio_dump_postgresql " ) . click ( function () {
2011-10-14 16:02:18 +02:00
hideoptions ();
2010-09-06 11:51:00 +02:00
jQuery ( " #postgresql_options " ) . show ();
});
2012-02-10 10:00:32 +01:00
jQuery ( " #select_sql_compat " ) . click ( function () {
if ( jQuery ( " #select_sql_compat " ) . val () == 'POSTGRESQL' )
{
2015-05-12 14:22:00 +02:00
jQuery ( " #checkbox_dump_disable-add-locks " ) . prop ( 'checked' , true );
2015-02-10 10:52:48 +01:00
}
2012-02-10 10:00:32 +01:00
});
2012-03-15 20:45:08 +01:00
< ? php
2015-07-16 00:58:05 +02:00
if ( in_array ( $type , array ( 'mysql' , 'mysqli' ))) print 'jQuery("#radio_dump_mysql").click();' ;
if ( in_array ( $type , array ( 'pgsql' ))) print 'jQuery("#radio_dump_postgresql").click();' ;
2012-03-15 20:45:08 +01:00
?>
2010-09-06 11:51:00 +02:00
});
</ script >
< ? php
2015-09-24 18:33:48 +02:00
print load_fiche_titre ( $langs -> trans ( " Backup " ), '' , 'title_setup' );
2017-02-27 02:04:25 +01:00
//print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup');
2007-07-28 13:29:09 +02:00
2017-05-20 18:46:15 +02:00
print '<div class="center">' ;
print $langs -> trans ( " BackupDesc " , DOL_DATA_ROOT );
print '</div>' ;
2017-07-12 22:52:56 +02:00
print '<br>' ;
2011-12-28 01:28:16 +01:00
2007-07-28 13:29:09 +02:00
?>
<!-- Dump of a server -->
2010-09-06 11:51:00 +02:00
< form method = " post " action = " export.php " name = " dump " >< input type = " hidden "
name = " token " value = " <?php echo $_SESSION['newtoken'] ; ?> " /> < input
type = " hidden " name = " export_type " value = " server " />
2017-02-27 02:04:25 +01:00
< fieldset id = " fieldsetexport " >< legend class = " legendforfieldsetstep " style = " font-size: 3em " > 1 </ legend >
2015-04-03 17:17:02 +02:00
< ? php
print $langs -> trans ( " BackupDesc3 " , $dolibarr_main_db_name ) . '<br>' ;
//print $langs->trans("BackupDescY").'<br>';
print '<br>' ;
?>
< div id = " backupdatabaseleft " class = " fichehalfleft " >
< ? php
2015-09-24 18:27:13 +02:00
print load_fiche_titre ( $title ? $title : $langs -> trans ( " BackupDumpWizard " ));
2015-04-03 17:17:02 +02:00
2015-07-16 00:58:05 +02:00
print '<table width="100%" class="' . ( $useinecm ? 'nobordernopadding' : 'liste' ) . ' nohover">' ;
2015-04-03 17:17:02 +02:00
print '<tr class="liste_titre">' ;
print '<td class="liste_titre">' ;
print $langs -> trans ( " DatabaseName " ) . ' : <b>' . $dolibarr_main_db_name . '</b><br>' ;
print '</td>' ;
print '</tr>' ;
print '<tr ' . $bc [ false ] . '><td style="padding-left: 8px">' ;
?>
< table class = " centpercent " >
2010-09-06 11:51:00 +02:00
< tr >
2017-01-22 12:13:32 +01:00
< td class = " tdtop " >
2010-09-06 11:51:00 +02:00
< div id = " div_container_exportoptions " >
< fieldset id = " exportoptions " >< legend >< ? php echo $langs -> trans ( " ExportMethod " ); ?> </legend>
< ? php
2015-07-16 00:58:05 +02:00
if ( in_array ( $type , array ( 'mysql' , 'mysqli' )))
2010-09-06 11:51:00 +02:00
{
?>
2011-01-10 02:40:49 +01:00
< div class = " formelementrow " >< input type = " radio " name = " what " value = " mysql " id = " radio_dump_mysql " />
< label for = " radio_dump_mysql " > MySQL Dump ( mysqldump ) </ label >
</ div >
2012-02-09 23:07:58 +01:00
< br >
2011-10-14 16:02:18 +02:00
< div class = " formelementrow " >< input type = " radio " name = " what " value = " mysqlnobin " id = " radio_dump_mysql_nobin " />
2012-08-23 08:46:22 +02:00
< label for = " radio_dump_mysql " > MySQL Dump ( php ) < ? php print img_warning ( $langs -> trans ( 'BackupPHPWarning' )) ?> </label>
2011-10-14 16:02:18 +02:00
</ div >
2010-09-06 11:51:00 +02:00
< ? php
}
2015-07-16 00:58:05 +02:00
else if ( in_array ( $type , array ( 'pgsql' )))
2010-09-06 11:51:00 +02:00
{
2011-01-10 02:40:49 +01:00
?>
< div class = " formelementrow " >< input type = " radio " name = " what " value = " postgresql " id = " radio_dump_postgresql " />
< label for = " radio_dump_postgresql " > PostgreSQL Dump ( pg_dump ) </ label >
</ div >
< ? php
2010-09-06 11:51:00 +02:00
}
else
{
2011-12-28 01:28:16 +01:00
print 'No method available with database ' . $label ;
2010-09-06 11:51:00 +02:00
}
?>
</ fieldset >
</ div >
</ td >
2017-01-22 12:13:32 +01:00
< td class = " tdtop " >
2010-09-06 11:51:00 +02:00
< div id = " div_container_sub_exportoptions " >
< ? php
2015-07-16 00:58:05 +02:00
if ( in_array ( $type , array ( 'mysql' , 'mysqli' )))
2010-09-06 11:51:00 +02:00
{
?> <!-- Fieldset mysqldump -->
< fieldset id = " mysql_options " >< legend >< ? php echo $langs -> trans ( " MySqlExportParameters " ); ?> </legend>
< div class = " formelementrow " >< ? php echo $langs -> trans ( " FullPathToMysqldumpCommand " );
if ( empty ( $conf -> global -> SYSTEMTOOLS_MYSQLDUMP ))
{
2009-11-29 20:32:16 +01:00
$fullpathofmysqldump = $db -> getPathOfDump ();
2010-09-06 11:51:00 +02:00
}
else
{
$fullpathofmysqldump = $conf -> global -> SYSTEMTOOLS_MYSQLDUMP ;
}
?> <br>
2015-04-03 17:17:02 +02:00
< input type = " text " name = " mysqldump " style = " width: 80% "
2010-09-06 11:51:00 +02:00
value = " <?php echo $fullpathofmysqldump ; ?> " /></ div >
< br >
< fieldset >< legend >< ? php echo $langs -> trans ( " ExportOptions " ); ?> </legend>
< div class = " formelementrow " >< input type = " checkbox "
name = " use_transaction " value = " yes " id = " checkbox_use_transaction " /> < label
for = " checkbox_use_transaction " > < ? php echo $langs -> trans ( " UseTransactionnalMode " ); ?> </label>
</ div >
2017-12-03 11:45:34 +01:00
< ? php if ( ! empty ( $conf -> global -> MYSQL_OLD_OPTION_DISABLE_FK )) { ?>
2010-09-06 11:51:00 +02:00
< div class = " formelementrow " >< input type = " checkbox " name = " disable_fk "
2015-05-07 11:39:26 +02:00
value = " yes " id = " checkbox_disable_fk " checked /> < label
2013-03-14 09:50:02 +01:00
for = " checkbox_disable_fk " > < ? php echo $langs -> trans ( " CommandsToDisableForeignKeysForImport " ); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
2010-09-06 11:51:00 +02:00
</ div >
2017-12-03 11:45:34 +01:00
< ? php } ?>
2010-09-06 11:51:00 +02:00
< label for = " select_sql_compat " > < ? php echo $langs -> trans ( " ExportCompatibility " ); ?> </label>
2011-06-15 02:02:59 +02:00
< select name = " sql_compat " id = " select_sql_compat " class = " flat " >
2015-05-07 12:20:20 +02:00
< option value = " NONE " selected > NONE </ option >
2010-09-06 11:51:00 +02:00
< option value = " ANSI " > ANSI </ option >
< option value = " DB2 " > DB2 </ option >
< option value = " MAXDB " > MAXDB </ option >
< option value = " MYSQL323 " > MYSQL323 </ option >
< option value = " MYSQL40 " > MYSQL40 </ option >
< option value = " MSSQL " > MSSQL </ option >
< option value = " ORACLE " > ORACLE </ option >
< option value = " POSTGRESQL " > POSTGRESQL </ option >
</ select > < br >
<!-- < input type = " checkbox " name = " drop_database " value = " yes "
id = " checkbox_drop_database " /> < label for = " checkbox_drop_database " >< ? php echo $langs -> trans ( " AddDropDatabase " ); ?> </label>
-->
</ fieldset >
< br >
< fieldset >< legend > < input type = " checkbox " name = " sql_structure "
2015-05-07 11:39:26 +02:00
value = " structure " id = " checkbox_sql_structure " checked /> < label
2012-08-23 08:46:22 +02:00
for = " checkbox_sql_structure " > < ? php echo $langs -> trans ( 'ExportStructure' ) ?> </label> </legend> <input
2015-05-07 11:39:26 +02:00
type = " checkbox " name = " drop " < ? php echo (( ! isset ( $_GET [ " drop " ]) && ! isset ( $_POST [ " drop " ])) || GETPOST ( 'drop' )) ? ' checked' : '' ; ?> id="checkbox_dump_drop" /> <label
2010-09-06 11:51:00 +02:00
for = " checkbox_dump_drop " >< ? php echo $langs -> trans ( " AddDropTable " ); ?> </label><br>
</ fieldset >
< br >
< fieldset >< legend > < input type = " checkbox " name = " sql_data " value = " data "
2015-05-07 11:39:26 +02:00
id = " checkbox_sql_data " checked /> < label for = " checkbox_sql_data " >
2010-09-06 11:51:00 +02:00
< ? php echo $langs -> trans ( " Datas " ); ?> </label> </legend> <input
type = " checkbox " name = " showcolumns " value = " yes "
2015-05-07 11:39:26 +02:00
id = " checkbox_dump_showcolumns " checked /> < label
2010-09-06 11:51:00 +02:00
for = " checkbox_dump_showcolumns " > < ? php echo $langs -> trans ( " NameColumn " ); ?> </label><br>
< input type = " checkbox " name = " extended_ins " value = " yes "
2015-05-07 11:39:26 +02:00
id = " checkbox_dump_extended_ins " checked /> < label
2010-09-06 11:51:00 +02:00
for = " checkbox_dump_extended_ins " > < ? php echo $langs -> trans ( " ExtendedInsert " ); ?> </label><br>
2012-02-09 23:07:58 +01:00
< input type = " checkbox " name = " disable-add-locks " value = " no "
id = " checkbox_dump_disable-add-locks " /> < label
for = " checkbox_dump_disable-add-locks " > < ? php echo $langs -> trans ( " NoLockBeforeInsert " ); ?> </label><br>
2010-09-06 11:51:00 +02:00
< input type = " checkbox " name = " delayed " value = " yes "
id = " checkbox_dump_delayed " /> < label for = " checkbox_dump_delayed " > < ? php echo $langs -> trans ( " DelayedInsert " ); ?> </label><br>
< input type = " checkbox " name = " sql_ignore " value = " yes "
id = " checkbox_dump_ignore " /> < label for = " checkbox_dump_ignore " > < ? php echo $langs -> trans ( " IgnoreDuplicateRecords " ); ?> </label><br>
< input type = " checkbox " name = " hexforbinary " value = " yes "
2015-05-07 11:39:26 +02:00
id = " checkbox_hexforbinary " checked /> < label
2010-09-06 11:51:00 +02:00
for = " checkbox_hexforbinary " > < ? php echo $langs -> trans ( " EncodeBinariesInHexa " ); ?> </label><br>
2012-02-10 10:53:11 +01:00
< input type = " checkbox " name = " charset_utf8 " value = " yes "
2015-05-07 11:57:23 +02:00
id = " checkbox_charset_utf8 " checked disabled /> < label
2012-02-10 10:53:11 +01:00
for = " checkbox_charset_utf8 " > < ? php echo $langs -> trans ( " UTF8 " ); ?> </label><br>
2010-09-06 11:51:00 +02:00
</ fieldset >
</ fieldset >
2012-08-16 16:02:08 +02:00
<!-- Fieldset mysql_nobin -->
< fieldset id = " mysql_nobin_options " >< legend >< ? php echo $langs -> trans ( " MySqlExportParameters " ); ?> </legend>
< fieldset >
< legend >< ? php echo $langs -> trans ( " ExportOptions " ); ?> </legend>
< div class = " formelementrow " >< input type = " checkbox "
name = " nobin_use_transaction " value = " yes " id = " checkbox_use_transaction " /> < label
for = " checkbox_use_transaction " > < ? php echo $langs -> trans ( " UseTransactionnalMode " ); ?> </label>
</ div >
2017-12-03 11:45:34 +01:00
< ? php if ( ! empty ( $conf -> global -> MYSQL_OLD_OPTION_DISABLE_FK )) { ?>
2012-08-16 16:02:08 +02:00
< div class = " formelementrow " >< input type = " checkbox " name = " nobin_disable_fk "
2015-05-07 11:39:26 +02:00
value = " yes " id = " checkbox_disable_fk " checked /> < label
2012-08-23 08:46:22 +02:00
for = " checkbox_disable_fk " > < ? php echo $langs -> trans ( " CommandsToDisableForeignKeysForImport " ); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label>
2012-08-16 16:02:08 +02:00
</ div >
2017-12-03 11:45:34 +01:00
< ? php } ?>
2012-08-16 16:02:08 +02:00
</ fieldset >
< br >
2012-08-23 08:46:22 +02:00
< fieldset >< legend >< ? php echo $langs -> trans ( 'ExportStructure' ) ?> </legend> <input
2015-05-07 11:39:26 +02:00
type = " checkbox " name = " nobin_drop " < ? php echo (( ! isset ( $_GET [ " nobin_drop " ]) && ! isset ( $_POST [ " nobin_drop " ])) || GETPOST ( 'nobin_drop' )) ? ' checked' : '' ; ?> id="checkbox_dump_drop" /> <label
2012-08-16 16:02:08 +02:00
for = " checkbox_dump_drop " >< ? php echo $langs -> trans ( " AddDropTable " ); ?> </label><br>
</ fieldset >
< br >
< fieldset >
< legend >< ? php echo $langs -> trans ( " Datas " ); ?> </legend>
< input type = " checkbox " name = " nobin_nolocks " value = " no "
id = " checkbox_dump_disable-add-locks " /> < label
for = " checkbox_dump_disable-add-locks " > < ? php echo $langs -> trans ( " NoLockBeforeInsert " ); ?> </label><br>
< input type = " checkbox " name = " nobin_delayed " value = " yes "
id = " checkbox_dump_delayed " /> < label for = " checkbox_dump_delayed " > < ? php echo $langs -> trans ( " DelayedInsert " ); ?> </label><br>
< input type = " checkbox " name = " nobin_sql_ignore " value = " yes "
id = " checkbox_dump_ignore " /> < label for = " checkbox_dump_ignore " > < ? php echo $langs -> trans ( " IgnoreDuplicateRecords " ); ?> </label><br>
< input type = " checkbox " name = " nobin_charset_utf8 " value = " yes "
2015-05-07 11:57:23 +02:00
id = " checkbox_charset_utf8 " checked disabled /> < label
2012-08-16 16:02:08 +02:00
for = " checkbox_charset_utf8 " > < ? php echo $langs -> trans ( " UTF8 " ); ?> </label><br>
</ fieldset >
</ fieldset >
2010-09-06 11:51:00 +02:00
< ? php
}
2015-07-16 00:58:05 +02:00
if ( in_array ( $type , array ( 'pgsql' )))
2010-09-06 11:51:00 +02:00
{
?> <!-- Fieldset pg_dump -->
< fieldset id = " postgresql_options " >< legend >< ? php echo $langs -> trans ( " PostgreSqlExportParameters " ); ?> </legend>
< div class = " formelementrow " >< ? php echo $langs -> trans ( " FullPathToPostgreSQLdumpCommand " );
if ( empty ( $conf -> global -> SYSTEMTOOLS_POSTGRESQLDUMP ))
{
2009-11-29 20:32:16 +01:00
$fullpathofpgdump = $db -> getPathOfDump ();
2010-09-06 11:51:00 +02:00
}
else
{
$fullpathofpgdump = $conf -> global -> SYSTEMTOOLS_POSTGRESQLDUMP ;
}
?> <br>
2015-04-03 17:17:02 +02:00
< input type = " text " name = " postgresqldump " style = " width: 80% "
2010-09-06 11:51:00 +02:00
value = " <?php echo $fullpathofpgdump ; ?> " /></ div >
< br >
< fieldset >< legend >< ? php echo $langs -> trans ( " ExportOptions " ); ?> </legend>
< label for = " select_sql_compat " > < ? php echo $langs -> trans ( " ExportCompatibility " ); ?> </label>
2011-06-15 09:44:02 +02:00
< select name = " sql_compat " id = " select_sql_compat " class = " flat " >
2015-05-07 12:20:20 +02:00
< option value = " POSTGRESQL " selected > POSTGRESQL </ option >
2010-09-06 11:51:00 +02:00
< option value = " ANSI " > ANSI </ option >
</ select >< br >
<!-- < input type = " checkbox " name = " drop_database " value = " yes "
id = " checkbox_drop_database " /> < label for = " checkbox_drop_database " >< ? php echo $langs -> trans ( " AddDropDatabase " ); ?> </label>
-->
</ fieldset >
< br >
< fieldset >< legend > < input type = " checkbox " name = " sql_structure "
2015-05-07 11:39:26 +02:00
value = " structure " id = " checkbox_sql_structure " checked /> < label
2012-08-23 08:46:22 +02:00
for = " checkbox_sql_structure " > < ? php echo $langs -> trans ( 'ExportStructure' ) ?> </label> </legend></fieldset>
2010-09-06 11:51:00 +02:00
< br >
< fieldset >< legend > < input type = " checkbox " name = " sql_data " value = " data "
2015-05-07 11:39:26 +02:00
id = " checkbox_sql_data " checked /> < label for = " checkbox_sql_data " >
2010-09-06 11:51:00 +02:00
< ? php echo $langs -> trans ( " Datas " ); ?> </label> </legend> <input
type = " checkbox " name = " showcolumns " value = " yes "
2015-05-07 11:39:26 +02:00
id = " checkbox_dump_showcolumns " checked /> < label
2010-09-06 11:51:00 +02:00
for = " checkbox_dump_showcolumns " > < ? php echo $langs -> trans ( " NameColumn " ); ?> </label><br>
</ fieldset >
</ fieldset >
< ? php
}
?>
</ div >
</ td >
</ tr >
</ table >
2009-10-26 04:10:12 +01:00
2007-07-28 13:29:09 +02:00
2015-04-03 17:17:02 +02:00
<!--< fieldset >
< legend >< ? php echo $langs -> trans ( " Destination " ); ?> </legend> -->
< br >
< label for = " filename_template " > < ? php echo $langs -> trans ( " FileNameToGenerate " ); ?> </label><br>
< input type = " text " name = " filename_template " style = " width: 90% "
2010-09-06 11:51:00 +02:00
id = " filename_template "
value = " <?php
2009-10-26 04:10:12 +01:00
$prefix = 'dump' ;
2014-09-17 17:38:07 +02:00
$ext = '.sql' ;
2015-07-16 00:58:05 +02:00
if ( in_array ( $type , array ( 'mysql' , 'mysqli' ))) { $prefix = 'mysqldump' ; $ext = 'sql' ; }
2014-09-17 17:38:07 +02:00
//if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; }
2015-07-16 00:58:05 +02:00
if ( in_array ( $type , array ( 'pgsql' ))) { $prefix = 'pg_dump' ; $ext = 'sql' ; }
2014-09-17 17:38:07 +02:00
$file = $prefix . '_' . $dolibarr_main_db_name . '_' . dol_sanitizeFileName ( DOL_VERSION ) . '_' . strftime ( " %Y%m%d%H%M " ) . '.' . $ext ;
2007-07-28 13:29:09 +02:00
echo $file ;
2010-09-06 11:51:00 +02:00
?> " /> <br>
< br >
2007-07-28 13:29:09 +02:00
< ? php
2009-10-26 04:10:12 +01:00
// Define compressions array
2014-09-17 17:38:07 +02:00
$compression = array ();
2015-07-16 00:58:05 +02:00
if ( in_array ( $type , array ( 'mysql' , 'mysqli' )))
2009-10-26 04:10:12 +01:00
{
2014-09-17 17:38:07 +02:00
$compression [ 'none' ] = array ( 'function' => '' , '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
2012-05-06 15:32:23 +02:00
$compression [ 'bz' ] = array ( 'function' => 'bzopen' , 'id' => 'radio_compression_bzip' , 'label' => $langs -> trans ( " Bzip2 " ));
2009-10-26 04:10:12 +01:00
}
2014-09-17 17:38:07 +02:00
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 " ));
}
2009-10-26 04:10:12 +01:00
// Show compression choices
print '<div class="formelementrow">' ;
print " \n " ;
print $langs -> trans ( " Compression " ) . ': ' ;
2007-07-28 13:29:09 +02:00
foreach ( $compression as $key => $val )
{
2010-09-06 12:08:36 +02:00
if ( ! $val [ 'function' ] || function_exists ( $val [ 'function' ])) // Enabled export format
2007-07-28 13:29:09 +02:00
{
2015-05-07 11:39:26 +02:00
print '<input type="radio" name="compression" value="' . $key . '" id="' . $val [ 'id' ] . '" checked>' ;
2008-01-27 23:03:07 +01:00
print ' <label for="' . $val [ 'id' ] . '">' . $val [ 'label' ] . '</label>' ;
2007-07-28 13:29:09 +02:00
}
2010-09-06 12:08:36 +02:00
else // Disabled export format
2007-07-28 13:29:09 +02:00
{
2015-05-07 11:57:23 +02:00
print '<input type="radio" name="compression" value="' . $key . '" id="' . $val [ 'id' ] . '" disabled>' ;
2008-01-27 23:03:07 +01:00
print ' <label for="' . $val [ 'id' ] . '">' . $val [ 'label' ] . '</label>' ;
2007-07-28 13:29:09 +02:00
print ' (' . $langs -> trans ( " NotAvailable " ) . ')' ;
2009-01-23 15:29:57 +01:00
}
2007-07-28 13:29:09 +02:00
print ' ' ;
}
print '</div>' ;
print " \n " ;
2015-04-03 17:17:02 +02:00
?> <!--</fieldset>--> <!-- End destination -->
2007-07-28 13:29:09 +02:00
2013-07-28 17:25:58 +02:00
< br >
2011-12-21 19:34:16 +01:00
< div align = " center " >< input type = " submit " class = " button "
2010-09-06 11:51:00 +02:00
value = " <?php echo $langs->trans ( " GenerateBackup " ) ?> " id = " buttonGo " />< br >
< br >
2015-05-18 20:33:02 +02:00
< ? php
if ( ! empty ( $_SESSION [ " commandbackuplastdone " ]))
{
print '<br><b>' . $langs -> trans ( " RunCommandSummary " ) . ':</b><br>' . " \n " ;
print '<textarea rows="' . ROWS_2 . '" class="centpercent">' . $_SESSION [ " commandbackuplastdone " ] . '</textarea><br>' . " \n " ;
print '<br>' ;
//print $paramclear;
// Now run command and show result
print '<b>' . $langs -> trans ( " BackupResult " ) . ':</b> ' ;
print $_SESSION [ " commandbackupresult " ];
$_SESSION [ " commandbackuplastdone " ] = '' ;
$_SESSION [ " commandbackuptorun " ] = '' ;
$_SESSION [ " commandbackupresult " ] = '' ;
}
2017-11-25 01:58:11 +01:00
if ( ! empty ( $_SESSION [ " commandbackuptorun " ]))
{
print '<br><font class="warning">' . $langs -> trans ( " YouMustRunCommandFromCommandLineAfterLoginToUser " , $dolibarr_main_db_user , $dolibarr_main_db_user ) . ':</font><br>' . " \n " ;
print '<textarea id="commandbackuptoruntext" rows="' . ROWS_2 . '" class="centpercent">' . $_SESSION [ " commandbackuptorun " ] . '</textarea><br>' . " \n " ;
print ajax_autoselect ( " commandbackuptoruntext " , 0 );
print '<br>' ;
//print $paramclear;
$_SESSION [ " commandbackuplastdone " ] = '' ;
$_SESSION [ " commandbackuptorun " ] = '' ;
$_SESSION [ " commandbackupresult " ] = '' ;
}
2015-05-18 20:33:02 +02:00
?>
2017-09-08 10:09:22 +02:00
</ div > <!-- end div center button -->
2007-07-28 13:29:09 +02:00
2015-04-03 17:17:02 +02:00
< ? php
2017-09-08 10:09:22 +02:00
print '</td></tr>' ;
print '</table>' ;
2015-04-03 17:17:02 +02:00
?>
2007-07-28 13:29:09 +02:00
2017-09-08 10:09:22 +02:00
</ div > <!-- end div fichehalfleft -->
2017-02-27 02:04:25 +01:00
< div id = " backupdatabaseright " class = " fichehalfright " style = " height:480px; overflow: auto; " >
2015-04-03 17:17:02 +02:00
< div class = " ficheaddleft " >
2007-07-28 13:29:09 +02:00
< ? php
2012-02-10 10:53:11 +01:00
$filearray = dol_dir_list ( $conf -> admin -> dir_output . '/backup' , 'files' , 0 , '' , '' , $sortfield ,( strtolower ( $sortorder ) == 'asc' ? SORT_ASC : SORT_DESC ), 1 );
2012-02-10 11:09:34 +01:00
$result = $formfile -> list_of_documents ( $filearray , null , 'systemtools' , '' , 1 , 'backup/' , 1 , 0 , $langs -> trans ( " NoBackupFileAvailable " ), 0 , $langs -> trans ( " PreviousDumpFiles " ));
print '<br>' ;
2015-04-03 17:17:02 +02:00
?>
2017-09-08 10:09:22 +02:00
2015-04-03 17:17:02 +02:00
</ div >
</ div >
2012-02-10 10:53:11 +01:00
2015-04-03 17:17:02 +02:00
</ fieldset >
< br >
2017-02-27 02:04:25 +01:00
< fieldset >< legend class = " legendforfieldsetstep " style = " font-size: 3em " > 2 </ legend >
2015-04-03 17:17:02 +02:00
< ? php
print $langs -> trans ( " BackupDesc2 " , DOL_DATA_ROOT ) . '<br>' ;
print $langs -> trans ( " BackupDescX " ) . '<br><br>' ;
?>
</ fieldset >
</ form >
< ? php
2007-07-28 13:29:09 +02:00
2011-08-27 16:24:16 +02:00
llxFooter ();
2011-10-14 16:02:18 +02:00
$db -> close ();