New: Ajout outil de dump par mysqldump

This commit is contained in:
Laurent Destailleur 2006-08-20 19:15:47 +00:00
parent 2e0a010daf
commit 532fff5eef
11 changed files with 999 additions and 29 deletions

View File

@ -0,0 +1,573 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/admin/tools/dolibarr_export.php
\brief Page export de la base
\version $Revision$
*/
require("./pre.inc.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
$langs->load("admin");
if (! $user->admin)
accessforbidden();
llxHeader();
print_fiche_titre($langs->trans("Backup"),'','setup');
print '<br>';
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
print '<br>';
?>
<!-- Dump of a server -->
<form method="post" action="export.php" name="dump">
<input type="hidden" name="export_type" value="server" />
<script type="text/javascript" language="javascript">
//<![CDATA[
function hide_them_all() {
document.getElementById("mysql_options").style.display = 'none';
// document.getElementById("csv_options").style.display = 'none';
// document.getElementById("latex_options").style.display = 'none';
// document.getElementById("pdf_options").style.display = 'none';
// document.getElementById("none_options").style.display = 'none';
}
function show_checked_option() {
hide_them_all();
if (document.getElementById('radio_dump_mysql')) {
document.getElementById('mysql_options').style.display = 'block';
}
// if (document.getElementById('radio_dump_latex').checked) {
// document.getElementById('latex_options').style.display = 'block';
// }
// if (document.getElementById('radio_dump_pdf').checked) {
// document.getElementById('pdf_options').style.display = 'block';
// }
// if (document.getElementById('radio_dump_xml').checked) {
// document.getElementById('none_options').style.display = 'block';
// }
// if (document.getElementById('radio_dump_csv')) {
// document.getElementById('csv_options').style.display = 'block';
// }
}
//]]>
</script>
<fieldset id="fieldsetexport">
<legend>Schéma et/ou contenu des bases de données
</legend>
<!-- LDR -->
<table><tr><td valign="top">
<div id="div_container_exportoptions">
<fieldset id="exportoptions">
<legend>Méthode d'exportation</legend>
<div class="formelementrow">
<input type="radio" name="what" value="mysql" id="radio_dump_mysql"
onclick="
if (this.checked) {
hide_them_all();
document.getElementById('mysql_options').style.display = 'block';
}; return true"
/>
<label for="radio_dump_mysql">MySQLDump</label>
</div>
<!--
<div class="formelementrow">
<input type="radio" name="what" value="latex" id="radio_dump_latex"
onclick="
if (this.checked) {
hide_them_all();
document.getElementById('latex_options').style.display = 'block';
}; return true"
/>
<label for="radio_dump_latex">LaTeX</label>
</div>
<div class="formelementrow">
<input type="radio" name="what" value="pdf" id="radio_dump_pdf"
onclick="
if (this.checked) {
hide_them_all();
document.getElementById('pdf_options').style.display = 'block';
}; return true"
/>
<label for="radio_dump_pdf">PDF</label>
</div>
<div class="formelementrow">
<input type="radio" name="what" value="csv" id="radio_dump_csv"
onclick="if
(this.checked) {
hide_them_all();
document.getElementById('csv_options').style.display = 'block';
}; return true"
/>
<label for="radio_dump_csv">CSV</label>
</div>
<div class="formelementrow">
<input type="radio" name="what" value="xml" id="radio_dump_xml"
onclick="
if (this.checked) {
hide_them_all();
document.getElementById('none_options').style.display = 'block';
}; return true"
/>
<label for="radio_dump_xml">XML</label>
</div>
-->
</fieldset>
</div>
</td><td valign="top">
<div id="div_container_sub_exportoptions">
<fieldset id="mysql_options">
<legend>Parametres export MySQL</legend>
<div class="formelementrow">
Path commande mysqldump:<br />
<input type="text" name="mysqldump" size="80"
value="<?php echo $conf->global->SYSTEMTOOLS_MYSQLDUMP ?>" />
</div>
<div class="formelementrow">
<input type="checkbox" name="use_transaction" value="yes"
id="checkbox_use_transaction"
/>
<label for="checkbox_use_transaction">
Utiliser le mode transactionnel</label>
</div>
<div class="formelementrow">
<input type="checkbox" name="disable_fk" value="yes"
id="checkbox_disable_fk" checked="true"
/>
<label for="checkbox_disable_fk">
Ordre de désactivation des clés étrangères à l'import</label>
</div>
<label for="select_sql_compat">
Compatibilité de l'exportation:</label>
<select name="sql_compat" id="select_sql_compat">
<option value="NONE" selected="selected">NONE</option>
<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>
<fieldset>
<legend>Options d'exportation</legend>
<input type="checkbox" name="drop_database" value="yes"
id="checkbox_drop_database"
/>
<label for="checkbox_drop_database">
Ajouter DROP DATABASE</label>
</fieldset>
<fieldset>
<legend>
<input type="checkbox" name="sql_structure" value="structure"
id="checkbox_sql_structure"
checked="checked" onclick="
if (!this.checked &amp;&amp; !document.getElementById('checkbox_sql_data').checked)
return false;
else return true;" />
<label for="checkbox_sql_structure">
Structure</label>
</legend>
<input type="checkbox" name="drop" value="1" id="checkbox_dump_drop"
/>
<label for="checkbox_dump_drop">
Inclure des énoncés "DROP TABLE"</label><br />
</fieldset>
<fieldset>
<legend>
<input type="checkbox" name="sql_data" value="data"
id="checkbox_sql_data" checked="checked" onclick="
if (!this.checked &amp;&amp; (!document.getElementById('checkbox_sql_structure') || !document.getElementById('checkbox_sql_structure').checked))
return false;
else return true;" />
<label for="checkbox_sql_data">
Données</label>
</legend>
<input type="checkbox" name="showcolumns" value="yes"
id="checkbox_dump_showcolumns"
/>
<label for="checkbox_dump_showcolumns">
Nomme les colonnes</label><br />
<input type="checkbox" name="extended_ins" value="yes"
id="checkbox_dump_extended_ins"
/>
<label for="checkbox_dump_extended_ins">
Insertions étendues</label><br />
<input type="checkbox" name="delayed" value="yes"
id="checkbox_dump_delayed"
/>
<label for="checkbox_dump_delayed">
Insertions avec délais (DELAYED)</label><br />
<input type="checkbox" name="sql_ignore" value="yes"
id="checkbox_dump_ignore"
/>
<label for="checkbox_dump_ignore">
Ignorer les erreurs de doublons (INSERT IGNORE)</label><br />
<input type="checkbox" name="hexforbinary" value="yes"
id="checkbox_hexforbinary"
checked="checked" />
<label for="checkbox_hexforbinary">
Encoder les champs binaires en hexadécimal</label><br />
</fieldset>
</fieldset>
<!--
<fieldset id="latex_options">
<legend>Parametres export LaTeX</legend>
<div class="formelementrow">
<input type="checkbox" name="latex_caption" value="yes"
id="checkbox_latex_show_caption"
checked="checked" />
<label for="checkbox_latex_show_caption">
Inclure les sous-titres</label>
</div>
<fieldset>
<legend>
<input type="checkbox" name="latex_structure" value="structure"
id="checkbox_latex_structure"
checked="checked" onclick="
if (!this.checked &amp;&amp; !document.getElementById('checkbox_latex_data').checked)
return false;
else return true;" />
<label for="checkbox_latex_structure">
Structure</label>
</legend>
<table>
<tr><td><label for="latex_structure_caption">
Sous-titre de la table</label></td>
<td><input type="text" name="latex_structure_caption" size="30"
value="Structure de la table __TABLE__"
id="latex_structure_caption" />
</td>
</tr>
<tr><td><label for="latex_structure_continued_caption">
Sous-titre de la table (suite)</label></td>
<td><input type="text" name="latex_structure_continued_caption"
value="Structure de la table __TABLE__ (suite)"
size="30" id="latex_structure_continued_caption" />
</td>
</tr>
<tr><td><label for="latex_structure_label">
Clé de l'étiquette</label></td>
<td><input type="text" name="latex_structure_label" size="30"
value="tab:__TABLE__-structure"
id="latex_structure_label" />
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>
<input type="checkbox" name="latex_data" value="data"
id="checkbox_latex_data"
checked="checked" onclick="
if (!this.checked &amp;&amp; (!document.getElementById('checkbox_latex_structure') || !document.getElementById('checkbox_latex_structure').checked))
return false;
else return true;" />
<label for="checkbox_latex_data">
Données</label>
</legend>
<input type="checkbox" name="latex_showcolumns" value="yes"
id="ch_latex_showcolumns"
checked="checked" />
<label for="ch_latex_showcolumns">
Nom des colonnes</label><br />
<table>
<tr><td><label for="latex_data_caption">
Sous-titre de la table</label></td>
<td><input type="text" name="latex_data_caption" size="30"
value="Contenu de la table __TABLE__"
id="latex_data_caption" />
</td>
</tr>
<tr><td><label for="latex_data_continued_caption">
Sous-titre de la table (suite)</label></td>
<td><input type="text" name="latex_data_continued_caption" size="30"
value="Contenu de la table __TABLE__ (suite)"
id="latex_data_continued_caption" />
</td>
</tr>
<tr><td><label for="latex_data_label">
Clé de l'étiquette</label></td>
<td><input type="text" name="latex_data_label" size="30"
value="tab:__TABLE__-data"
id="latex_data_label" />
</td>
</tr>
<tr><td><label for="latex_replace_null">
Remplacer NULL par</label></td>
<td><input type="text" name="latex_replace_null" size="20"
value="\textit{NULL}"
id="latex_replace_null" />
</td>
</tr>
</table>
</fieldset>
</fieldset>
-->
<!--
<fieldset id="csv_options">
<input type="hidden" name="csv_data" value="csv_data" />
<legend>Parametres export CSV</legend>
<table>
<tr><td><label for="export_separator">
Champs terminés par</label></td>
<td><input type="text" name="export_separator" size="2"
id="export_separator"
value=";" />
</td>
</tr>
<tr><td><label for="enclosed">
Champs entourés par</label></td>
<td><input type="text" name="enclosed" size="2"
id="enclosed"
value="&quot;" />
</td>
</tr>
<tr><td><label for="escaped">
Caractère spécial</label></td>
<td><input type="text" name="escaped" size="2"
id="escaped"
value="\" />
</td>
</tr>
<tr><td><label for="add_character">
Lignes terminées par</label></td>
<td><input type="text" name="add_character" size="2"
id="add_character"
value="\r\n" />
</td>
</tr>
<tr><td><label for="csv_replace_null">
Remplacer NULL par</label></td>
<td><input type="text" name="csv_replace_null" size="20"
id="csv_replace_null"
value="NULL" />
</td>
</tr>
</table>
<input type="checkbox" name="showcsvnames" value="yes"
id="checkbox_dump_showcsvnames"
/>
<label for="checkbox_dump_showcsvnames">
Afficher les noms de champ en première ligne</label>
</fieldset>
-->
<!--
<fieldset id="pdf_options">
<input type="hidden" name="pdf_data" value="pdf_data" />
<legend>Parametres export PDF</legend>
<div class="formelementrow">
<label for="pdf_report_title">Titre du rapport</label>
<input type="text" name="pdf_report_title" size="50"
value=""
id="pdf_report_title" />
</div>
</fieldset>
-->
<!--
<fieldset id="none_options">
<legend>Options XML</legend>
Ce format ne comporte pas d'options <input type="hidden" name="xml_data" value="xml_data" />
</fieldset>
-->
</div>
</td></tr></table>
<script type="text/javascript" language="javascript">
//<![CDATA[
show_checked_option();
hide_them_all();
//]]>
</script>
</fieldset>
<fieldset>
<label for="filename_template">
Nom du fichier à générer</label> :
<input type="text" name="filename_template" size="60" id="filename_template"
value="<?php
$file='mysqldump_'.$dolibarr_main_db_name.'_'.strftime("%Y%m%d%H%M").'.sql';
echo $file;
?>" />
<br><br>
<div class="formelementrow">
Compression :
<input type="radio" name="compression" value="none"
id="radio_compression_none"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
checked="checked" />
<label for="radio_compression_none">aucune</label>
<!-- No zip support (not open source)
<input type="radio" name="compression" value="zip"
id="radio_compression_zip"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
/>
<label for="radio_compression_zip">"zippé"</label>
-->
<?php
if (function_exists('gz_open'))
{
?>
<input type="radio" name="compression" value="gz"
id="radio_compression_gzip"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
/>
<label for="radio_compression_gzip">"gzippé"</label>
<?php
}
?>
<?php
if (function_exists('bz_open'))
{
?>
<input type="radio" name="compression" value="bz"
id="radio_compression_bzip"
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
/>
<label for="radio_compression_bzip">"bzippé"</label>
</div>
<?php
}
?>
</fieldset>
<center>
<input type="submit" class="button" value="Exécuter" id="buttonGo" /><br><br>
</center>
</form>
<script type="text/javascript" language="javascript">
//<![CDATA[
// set current db, table and sql query in the querywindow
if (window.parent.refreshLeft) {
window.parent.reload_querywindow("","","");
}
if (window.parent.frames[1]) {
// reset content frame name, as querywindow needs to set a unique name
// before submitting form data, and navigation frame needs the original name
if (window.parent.frames[1].name != 'frame_content') {
window.parent.frames[1].name = 'frame_content';
}
if (window.parent.frames[1].id != 'frame_content') {
window.parent.frames[1].id = 'frame_content';
}
//window.parent.frames[1].setAttribute('name', 'frame_content');
//window.parent.frames[1].setAttribute('id', 'frame_content');
}
//]]>
</script>
<?php
llxFooter();
?>

View File

@ -0,0 +1,51 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/admin/tools/dolibarr_import.php
\brief Page import de la base
\version $Revision$
*/
require("./pre.inc.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
$langs->load("admin");
if (! $user->admin)
accessforbidden();
llxHeader();
print_fiche_titre($langs->trans("Restore"),'','setup');
print '<br>';
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
print '<br>';
print $langs->trans("FeatureNotYetAvailable");
llxFooter();
?>

View File

@ -0,0 +1,195 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/admin/tools/export.php
\brief Page export de la base
\version $Revision$
*/
require("./pre.inc.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
$what=$_REQUEST["what"];
$export_type=$_REQUEST["export_type"];
$file=isset($_POST['filename_template']) ? $_POST['filename_template'] : '';
$langs->load("admin");
if (! $user->admin)
accessforbidden();
llxHeader();
$html=new Form($db);
print_fiche_titre($langs->trans("Backup"),'','setup');
print '<br>';
if ($file && ! $what)
{
print '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ee")).'</div>';
print '<br>';
}
/**
* Increase time limit for script execution and initializes some variables
*/
@set_time_limit($cfg['ExecTimeLimit']);
if (!empty($cfg['MemoryLimit'])) {
@ini_set('memory_limit', $cfg['MemoryLimit']);
}
// Start with empty buffer
$dump_buffer = '';
$dump_buffer_len = 0;
// We send fake headers to avoid browser timeout when buffering
$time_start = time();
if ($what == 'mysql')
{
$mysqldump=$_POST["mysqldump"];
if ($mysqldump)
{
dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $mysqldump, $type='chaine');
}
create_exdir(DOL_DATA_ROOT.'/admin/temp');
// Parameteres execution
$command=escapeshellarg($mysqldump);
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host." -u ".$dolibarr_main_db_user." -p".$dolibarr_main_db_pass;
$compression=isset($_POST['compression']) ? $_POST['compression'] : 'none';
if (! $_POST["use_transaction"]) $param.=" -l --single-transaction";
if ($_POST["disable_fk"]) $param.=" -K";
if ($_POST["sql_compat"] && $_POST["sql_compat"] != 'NONE') $param.=" --compatible=".$_POST["sql_compat"];
if ($_POST["drop_database"]) $param.=" --add-drop-database";
if ($_POST["sql_structure"])
{
if ($_POST["drop"]) $param.=" --add-drop-table";
}
else
{
$param.=" -t";
}
if ($_POST["sql_data"])
{
$param.=" --tables";
if ($_POST["showcolumns"]) $param.=" -c";
if ($_POST["extended_ins"]) $param.=" -e";
if ($_POST["delayed"]) $param.=" --delayed-insert";
if ($_POST["sql_ignore"]) $param.=" --insert-ignore";
if ($_POST["hexforbinary"]) $param.=" --hex-blob";
}
else
{
$param.=" -d";
}
$relativepathfile='/admin/temp/'.$file;
$relativepatherr=$relativepathfile.'.err';
$outputfile=DOL_DATA_ROOT.$relativepathfile;
$outputerror=DOL_DATA_ROOT.$relativepatherr;
print $langs->trans("RunCommandSummary").':<br>';
print '<textarea rows="1" cols="120">'.$command." ".$param.'</textarea><br>';
print '<br>';
print $langs->trans("BackupResult").': ';
// Debut appel methode execution
$fullcommand=$command." ".$param." 2>&1";
if ($compression == 'none') $handle = fopen($outputfile, 'w');
if ($compression == 'gz') $handle = gzopen($outputfile, 'w');
if ($compression == 'bz') $handle = bzopen($outputfile, 'w');
$handlein = popen($fullcommand, 'r');
while (!feof($handlein))
{
$read = fgets($handlein);
fwrite($handle,$read);
}
pclose($handlein);
if ($compression == 'none') fclose($handle);
if ($compression == 'gz') gzclose($handle);
if ($compression == 'bz') bzclose($handle);
// Get errorstring
$errormsg='';
if ($compression == 'none') $handle = fopen($outputfile, 'r');
if ($compression == 'gz') $handle = gzopen($outputfile, 'r');
if ($compression == 'bz') $handle = bzopen($outputfile, 'r');
$handle = fopen($outputfile, "r");
$errormsg = fgets($handle);
if ($compression == 'none') fclose($handle);
if ($compression == 'gz') gzclose($handle);
if ($compression == 'bz') bzclose($handle);
if (eregi('^-- MySql',$errormsg)) $errormsg=''; // Pas erreur
else
{
// Renommer fichier sortie en fichier erreur
//print "$outputfile -> $outputerror";
@rename($outputfile,$outputerror);
}
// Fin execution commande
}
// Si on a demande une generation
if ($what)
{
if ($errormsg)
{
print '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
// print '<a href="'.DOL_URL_ROOT.$relativepatherr.'">'.$langs->trans("DownloadErrorFile").'</a><br>';
print '<br>';
print '<br>';
}
else
{
print '<div class="ok">';
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
print $langs->trans("YouCanDownloadBackupFile");
print '</div>';
print '<br>';
}
}
$result=$html->show_documents('systemtools','',DOL_DATA_ROOT.'/admin/temp',$_SERVER['PHP_SELF'],0,1);
if ($result == 0)
{
print $langs->trans("NoBackupFileAvailable").'<br>';
print $langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php').'<br>';
}
print '<br>';
$time_end = time();
llxFooter();
?>

View File

@ -0,0 +1,61 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/admin/tools/index.php
\brief Page d'accueil de l'espace outils admin
\version $Revision$
*/
require("./pre.inc.php");
$langs->load("admin");
$langs->load("companies");
if (!$user->admin)
accessforbidden();
/*
* Affichage page
*/
llxHeader();
$form = new Form($db);
print_fiche_titre($langs->trans("SystemToolsArea"),'','setup');
print "<br>";
if ($message) print $message.'<br>';
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -0,0 +1,48 @@
<?php
/* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/admin/system/pre.inc.php
\brief Fichier gestionnaire menu page infos système
\version $Revision$
*/
require("../../main.inc.php");
function llxHeader($head = "", $urlp = "")
{
global $langs;
$langs->load("admin");
top_menu($head);
$menu = new Menu();
$menu->add(DOL_URL_ROOT."/admin/tools/index.php", "SystemTools");
$menu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_export.php", $langs->trans("Backup"));
$menu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_import.php", $langs->trans("Restore"));
left_menu($menu->liste);
}
?>

View File

@ -291,6 +291,9 @@ class Conf
* Modification de quelques variable de conf en fonction des Constantes
*/
// outils systemes
if (! $this->global->SYSTEMTOOLS_MYSQLDUMP) $this->global->SYSTEMTOOLS_MYSQLDUMP="mysqldump";
// societe
if (! $this->global->SOCIETE_CODECLIENT_ADDON) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
if (! $this->global->SOCIETE_CODEFOURNISSEUR_ADDON) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON="mod_codeclient_leopard";

View File

@ -263,6 +263,17 @@ if ($modulepart)
$original_file=$conf->fckeditor->dir_output.'/'.$original_file;
}
// Wrapping pour les backups
if ($modulepart == 'systemtools')
{
if ($user->admin)
{
$accessallowed=1;
}
$original_file=DOL_DATA_ROOT.'/admin/temp/'.$original_file;
}
}
// Limite accès si droits non corrects

View File

@ -2389,7 +2389,7 @@ class Form
/**
* \brief Affiche la cartouche de la liste des documents d'une propale, facture...
* \param modulepart propal=propal, facture=facture, ...
* \param filename Nom fichier sans extension
* \param filename Sous rep à scanner (vide si filedir deja complet)
* \param filedir Repertoire à scanner
* \param urlsource Url page origine
* \param genallowed Génération autorisée (1/0 ou array des formats)
@ -2558,7 +2558,9 @@ class Form
{
// Défini chemin relatif par rapport au module pour lien download
$relativepath=$filename."/".$file["name"];
$relativepath=$file["name"]; // Cas general
if ($filename) $relativepath=$filename."/".$file["name"]; // Cas prpal, facture...
// Autre cas
if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file["name"]; }
if ($modulepart == 'export') { $relativepath = $file["name"]; }

View File

@ -116,33 +116,37 @@ class MenuLeft {
if($user->admin)
{
$langs->load("admin");
$newmenu->add(DOL_URL_ROOT."/admin/index.php?leftmenu=setup", $langs->trans("Setup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/company.php", $langs->trans("MenuCompanySetup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/modules.php", $langs->trans("Modules"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/ihm.php", $langs->trans("GUISetup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/boxes.php", $langs->trans("Boxes"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/delais.php",$langs->trans("Alerts"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/triggers.php", $langs->trans("Triggers"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/perms.php", $langs->trans("Security"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/dict.php", $langs->trans("DictionnarySetup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/const.php", $langs->trans("OtherSetup"));
$newmenu->add(DOL_URL_ROOT."/admin/system/index.php?leftmenu=system", $langs->trans("SystemInfo"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/dolibarr.php", $langs->trans("Dolibarr"),1);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/constall.php", $langs->trans("AllParameters"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/about.php", $langs->trans("About"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/os.php", $langs->trans("OS"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/web.php", $langs->trans("WebServer"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php", $langs->trans("Php"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php?what=conf", $langs->trans("PhpConf"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php?what=env", $langs->trans("PhpEnv"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php?what=modules", $langs->trans("PhpModules"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database.php", $langs->trans("Database"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables.php", $langs->trans("Tables"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables-contraintes.php", $langs->trans("Constraints"),2);
$langs->load("admin");
$newmenu->add(DOL_URL_ROOT."/admin/index.php?leftmenu=setup", $langs->trans("Setup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/company.php", $langs->trans("MenuCompanySetup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/modules.php", $langs->trans("Modules"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/ihm.php", $langs->trans("GUISetup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/boxes.php", $langs->trans("Boxes"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/delais.php",$langs->trans("Alerts"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/triggers.php", $langs->trans("Triggers"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/perms.php", $langs->trans("Security"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/dict.php", $langs->trans("DictionnarySetup"));
if ($leftmenu=="setup") $newmenu->add_submenu(DOL_URL_ROOT."/admin/const.php", $langs->trans("OtherSetup"));
$newmenu->add(DOL_URL_ROOT."/admin/system/index.php?leftmenu=system", $langs->trans("SystemInfo"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/dolibarr.php", $langs->trans("Dolibarr"),1);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/constall.php", $langs->trans("AllParameters"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/about.php", $langs->trans("About"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/os.php", $langs->trans("OS"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/web.php", $langs->trans("WebServer"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php", $langs->trans("Php"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php?what=conf", $langs->trans("PhpConf"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php?what=env", $langs->trans("PhpEnv"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/phpinfo.php?what=modules", $langs->trans("PhpModules"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database.php", $langs->trans("Database"));
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables.php", $langs->trans("Tables"),2);
if ($leftmenu=="system") $newmenu->add_submenu(DOL_URL_ROOT."/admin/system/database-tables-contraintes.php", $langs->trans("Constraints"),2);
$newmenu->add(DOL_URL_ROOT."/admin/tools/index.php?leftmenu=admintools", $langs->trans("SystemTools"));
if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_export.php", $langs->trans("Backup"),1);
if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_import.php", $langs->trans("Restore"),1);
}
$langs->load("users");

View File

@ -41,6 +41,17 @@ Box=Box
Boxes=Boxes
System=System
SystemInfo=System informations
SystemTools=System tools
SystemToolsArea=System tools area
Backup=Backup
Restore=Restore
RunCommandSummary=Backup will be done through the following command
WebServerMustHavePermissionForCommand=Your web server must have permissions to run such commands
BackupResult=Backup result
BackupFileSuccessfullyCreated=Backup file successfully generated
YouCanDownloadBackupFile=Generated files can now be downlaoded
NoBackupFileAvailable=No backup files available.
ToBuildBackupFileClickHere=To build one backup file, click <a href="%s">here</a>.
Yes=Yes
No=No
AutoDetectLang=Autodetect (browser language)

View File

@ -41,6 +41,17 @@ Box=Bo
Boxes=Boîtes
System=Système
SystemInfo=Infos Système
SystemTools=Outils Système
SystemToolsArea=Espace outils systèmes
Backup=Sauvegarde
Restore=Restauration
RunCommandSummary=La sauvegarde sera exécutée par la commande suivante
WebServerMustHavePermissionForCommand=Votre serveur web doit avoir les droits pour exécuter une telle commande
BackupResult=Résultat sauvegarde
BackupFileSuccessfullyCreated=Fichier backup généré avec succès
YouCanDownloadBackupFile=Les fichiers générés peuvent maintenant être téléchargés
NoBackupFileAvailable=Aucune fichier backup disponible.
ToBuildBackupFileClickHere=Pour générer un fichier de sauvegarde, cliquez <a href="%s">ici</a>.
Yes=Oui
No=Non
AutoDetectLang=Détection auto (navigateur)