Bugfixes de la class mysql
This commit is contained in:
parent
f1a4587ef1
commit
3b719b1214
|
@ -35,33 +35,36 @@ $fields = array (
|
|||
"restfile" => array ("post", "string", ""),
|
||||
);
|
||||
getFields($fields);
|
||||
?>
|
||||
|
||||
<h3><?php __("MySQL Databases"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
|
||||
<?php
|
||||
|
||||
if (!$r=$mysql->get_mysql_details($id)) {
|
||||
$error=$err->errstr();
|
||||
}
|
||||
if (! $r["enabled"]) {
|
||||
echo "<p class=\"error\">"._("You currently have no database defined")."</p>";
|
||||
include_once("foot.php");
|
||||
die();
|
||||
}
|
||||
?>
|
||||
<h3><?php __("MySQL Databases"); ?></h3>
|
||||
<hr id="topbar"/>
|
||||
<br />
|
||||
<?php
|
||||
if ($r["enabled"]) {
|
||||
?>
|
||||
|
||||
<h3><?php __("Restore a SQL backup"); ?></h3>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
if (!$mysql->restore($restfile,true,$id)) {
|
||||
$error=$err->errstr();
|
||||
$error=$err->errstr();
|
||||
} else {
|
||||
$error=_("Your database has been restored, check out the previous text for error messages.");
|
||||
}
|
||||
$error=_("Your database has been restored, check out the previous text for error messages.");
|
||||
} // if mysql->restore
|
||||
|
||||
echo "<p class=\"error\">$error</p><p> </p>";
|
||||
} else {
|
||||
|
||||
__("You currently have no database defined");
|
||||
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php include_once("foot.php"); ?>
|
||||
|
|
|
@ -59,8 +59,18 @@ echo "</p>";
|
|||
<form action="sql_dorestore.php" method="post">
|
||||
<input type="hidden" name="id" value="<?php echo $id ?>" />
|
||||
<p><label for="restfile"><?php __("Please enter the path and the filename containing SQL data to be restored."); ?></label></p>
|
||||
<p><input type="text" class="int" id="restfile" name="restfile" size="35" maxlength="255" value="" /> <input class="inb" type="submit" name="submit" value="<?php __("Restore my database"); ?>" /></p>
|
||||
<p><input type="text" class="int" id="restfile" name="restfile" size="35" maxlength="255" value="" /> <input class="inb" type="submit" name="submit" onClick='return restfilenotempty();' value="<?php __("Restore my database"); ?>" /></p>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
function restfilenotempty() {
|
||||
if ( $('#restfile').val() == '' ) {
|
||||
alert("<?php __("Please the complete path of the filename");?>");
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
echo "<p>";
|
||||
__("Note: If the filename ends with .gz, it will be uncompressed before.");
|
||||
|
|
|
@ -487,6 +487,11 @@ class m_mysql {
|
|||
$err->raise("mysql",_("File not found"));
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($fi)) {
|
||||
$err->raise("mysql",_("File not found"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (substr($fi,-3)==".gz") {
|
||||
$exe="/bin/gzip -d -c <".escapeshellarg($fi)." | /usr/bin/mysql -h".escapeshellarg($L_MYSQL_HOST)." -u".escapeshellarg($r["login"])." -p".escapeshellarg($r["pass"])." ".escapeshellarg($r["db"]);
|
||||
} elseif (substr($fi,-4)==".bz2") {
|
||||
|
|
Loading…
Reference in New Issue