25 require
'../../main.inc.php';
28 $langs->loadLangs(array(
"other",
"admin"));
33 $radio_dump =
GETPOST(
'radio_dump');
34 $showpass =
GETPOST(
'showpass');
45 $help_url =
'EN:Restores|FR:Restaurations|ES:Restauraciones';
49 <script
type=
"text/javascript">
50 jQuery(document).ready(
function() {
51 jQuery(
"#mysql_options").<?php echo $radio_dump ==
'mysql_options' ?
'show()' :
'hide()'; ?>;
52 jQuery(
"#postgresql_options").<?php echo $radio_dump ==
'postgresql_options' ?
'show()' :
'hide()'; ?>;
54 jQuery(
"#radio_dump_mysql").click(
function() {
55 jQuery(
"#mysql_options").show();
57 jQuery(
"#radio_dump_postgresql").click(
function() {
58 jQuery(
"#postgresql_options").show();
61 if ($label ==
'MySQL')
print 'jQuery("#radio_dump_mysql").click();';
62 if ($label ==
'PostgreSQL')
print 'jQuery("#radio_dump_postgresql").click();';
70 print '<div class="center opacitymedium">';
71 print $langs->trans(
"RestoreDesc", DOL_DATA_ROOT);
77 <legend style=
"font-size: 3em">1</legend>
79 print $langs->trans(
"RestoreDesc2", DOL_DATA_ROOT).
'<br><br>';
86 <legend style=
"font-size: 3em">2</legend>
88 print $langs->trans(
"RestoreDesc3", $dolibarr_main_db_name).
'<br><br>';
91 <?php print $langs->trans(
"DatabaseName").
' : <b>'.$dolibarr_main_db_name.
'</b>'; ?><br><br>
93 <table
class=
"centpercent"><tr><td
class=
"tdtop">
95 <?php
if ($conf->use_javascript_ajax) { ?>
96 <div
id=
"div_container_exportoptions">
97 <fieldset
id=
"exportoptions">
98 <legend><?php echo $langs->trans(
"ImportMethod"); ?></legend>
100 if (in_array($type, array(
'mysql',
'mysqli')))
103 <div
class=
"formelementrow">
104 <input type=
"radio" name=
"what" value=
"mysql" id=
"radio_dump_mysql"<?php echo ($radio_dump ==
'mysql_options' ?
' checked' :
''); ?> />
105 <label
for=
"radio_dump_mysql">MySQL (mysql)</label>
108 } elseif (in_array($type, array(
'pgsql')))
111 <div
class=
"formelementrow">
112 <input type=
"radio" name=
"what" value=
"mysql" id=
"radio_dump_postgresql"<?php echo ($radio_dump ==
'postgresql_options' ?
' checked' :
''); ?> />
113 <label
for=
"radio_dump_postgresql">PostgreSQL Restore (pg_restore or psql)</label>
117 print
'No method available with database '.$label;
124 </td><td
class=
"tdtop">
127 <div
id=
"div_container_sub_exportoptions" >
129 if (in_array($type, array(
'mysql',
'mysqli')))
131 print
'<fieldset id="mysql_options">';
132 print
'<legend>'.$langs->trans(
'RestoreMySQL').
'</legend>';
133 print
'<div class="formelementrow centpercent">';
135 $command = $db->getPathOfRestore();
136 if (preg_match(
"/\s/", $command)) $command = $command = escapeshellarg($command);
138 $param = $dolibarr_main_db_name;
139 $param .=
" -h ".$dolibarr_main_db_host;
140 if (!empty($dolibarr_main_db_port)) $param .=
" -P ".$dolibarr_main_db_port;
141 $param .=
" -u ".$dolibarr_main_db_user;
142 $paramcrypted = $param;
143 $paramclear = $param;
144 if (!empty($dolibarr_main_db_pass))
146 $paramcrypted .=
" -p".preg_replace(
'/./i',
'*', $dolibarr_main_db_pass);
147 $paramclear .=
" -p".$dolibarr_main_db_pass;
150 echo $langs->trans(
"ImportMySqlDesc");
152 print
'<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans(
"ImportMySqlCommand", $command, ($showpass ? $paramclear : $paramcrypted)).
'</textarea><br>';
155 if (empty($_GET[
"showpass"]) && $dolibarr_main_db_pass) {
156 print
'<br><a href="'.$_SERVER[
"PHP_SELF"].
'?showpass=1&radio_dump=mysql_options">'.$langs->trans(
"UnHidePassword").
'</a>';
161 } elseif (in_array($type, array(
'pgsql')))
163 print
'<fieldset id="postgresql_options">';
164 print
'<legend>Restore PostgreSQL</legend>';
165 print
'<div class="formelementrow">';
167 $command = $db->getPathOfRestore();
168 if (preg_match(
"/\s/", $command)) $command = $command = escapeshellarg($command);
170 $param =
" -d ".$dolibarr_main_db_name;
171 $param .=
" -h ".$dolibarr_main_db_host;
172 if (!empty($dolibarr_main_db_port)) $param .=
" -p ".$dolibarr_main_db_port;
173 $param .=
" -U ".$dolibarr_main_db_user;
174 $paramcrypted = $param;
175 $paramclear = $param;
181 $paramcrypted .=
" -W";
182 $paramclear .=
" -W";
184 $paramcrypted .=
" -f";
185 $paramclear .=
" -f";
187 echo $langs->trans(
"ImportPostgreSqlDesc");
189 print
'<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans(
"ImportPostgreSqlCommand", $command, ($showpass ? $paramclear : $paramcrypted)).
'</textarea><br>';
200 print
'</td></tr></table>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
$conf db name
Only used if Module[ID]Name translation string is not found.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
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 ...
ajax_autoselect($htmlname, $addlink= '')
Make content of an input box selected when we click into input field.
print
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type