Added bzip support for dump files
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2001-07-14 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||
* db_details.php3, tbl_properties.php3, functions.js, tbl_dump.php3,
|
||||
documentation.html, translations: added bzip support for dump files.
|
||||
|
||||
2001-07-14 Armel Fauveau <armel.fauveau@globalis-ms.com>
|
||||
* Added a warning concerning bookmark feature and advanced auth
|
||||
|
||||
|
@@ -168,8 +168,9 @@
|
||||
<tr>
|
||||
<td valign="top">(*) </td>
|
||||
<td>
|
||||
phpMyAdmin can compress (GZip format - RFC 1952) dumps and CSV exports
|
||||
if you use PHP>=4.0.4 with Zlib support (--with-zlib)
|
||||
phpMyAdmin can compress (GZip format -RFC 1952- or Bzip2) dumps and CSV
|
||||
exports if you use PHP4 >= 4.0.4 with Zlib support
|
||||
(<tt>--with-zlib</tt>) and/or Bzip2 support (<tt>--with-bz2</tt>).
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -748,11 +749,13 @@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>How can I GZip a dump or a CSV export. It seem to not work?</b>
|
||||
<b>How can I GZip or Bzip a dump or a CSV export. It seem to not work?</b>
|
||||
<br />
|
||||
This feature is based on gzencode() to be more independent of the platform
|
||||
These features are based on the <tt>gzencode()</tt> and
|
||||
<tt>bzcompress()</tt> php functions to be more independent of the platform
|
||||
(Unix/Windows, Safe Mode or not, and so on).
|
||||
So, you must have PHP4 >= 4.0.4 and Zlib support (<tt>--with-zlib</tt>).
|
||||
So, you must have PHP4 >= 4.0.4 and Zlib/Bzip2 support
|
||||
(<tt>--with-zlib</tt> and <tt>--with-bz2</tt>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@@ -365,12 +365,25 @@ if ($num_tables > 0) {
|
||||
<input type="checkbox" name="asfile" value="sendit" onclick="return checkTransmitDump(this.form, 'transmit')" />
|
||||
<?php echo $strSend . "\n"; ?>
|
||||
<?php
|
||||
// gzip encode feature
|
||||
if (function_exists('gzencode')) {
|
||||
echo "\n";
|
||||
?>
|
||||
(<input type="checkbox" name="gzip" value="gzip" onclick="return checkTransmitDump(this.form, 'gzip')" /><?php echo $strGzip; ?>)
|
||||
<?php
|
||||
// gzip and bzip2 encode features
|
||||
if (PMA_INT_VERSION >= 40004) {
|
||||
$is_gzip = @function_exists('gzencode');
|
||||
$is_bzip = @function_exists('bzcompress');
|
||||
if ($is_gzip || $is_bzip) {
|
||||
echo "\n" . ' (';
|
||||
if ($is_gzip) {
|
||||
?>
|
||||
<input type="checkbox" name="gzip" value="gzip" onclick="return checkTransmitDump(this.form, 'gzip')" /><?php echo $strGzip . (($is_bzip) ? ' ' : '') . "\n"; ?>
|
||||
<?php
|
||||
}
|
||||
if ($is_bzip) {
|
||||
echo "\n"
|
||||
?>
|
||||
<input type="checkbox" name="bzip" value="bzip" onclick="return checkTransmitDump(this.form, 'bzip')" /><?php echo $strBzip . "\n"; ?>
|
||||
<?php
|
||||
}
|
||||
echo "\n" . ' )';
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
|
31
functions.js
31
functions.js
@@ -46,7 +46,8 @@ function checkFormElementInRange(theForm, theFieldName, min, max)
|
||||
|
||||
|
||||
/**
|
||||
* Ensures the choice between 'transmit' and 'gzipped' checkboxes is consistant
|
||||
* Ensures the choice between 'transmit', 'gzipped' and 'bzipped' checkboxes is
|
||||
* consistant
|
||||
*
|
||||
* @param object the form
|
||||
* @param string a code for the action that causes this function to be run
|
||||
@@ -57,19 +58,33 @@ function checkTransmitDump(theForm, theAction)
|
||||
{
|
||||
var formElts = theForm.elements;
|
||||
|
||||
// 'gzipped' option has been checked/unchecked
|
||||
if (theAction == 'gzip') {
|
||||
if (formElts['gzip'].checked && !formElts['asfile'].checked) {
|
||||
// 'gzipped' option has been checked
|
||||
if (theAction == 'gzip' && formElts['gzip'].checked) {
|
||||
if (!formElts['asfile'].checked) {
|
||||
theForm.elements['asfile'].checked = true;
|
||||
}
|
||||
if (typeof(formElts['bzip']) != 'undefined' && formElts['bzip'].checked) {
|
||||
theForm.elements['bzip'].checked = false;
|
||||
}
|
||||
}
|
||||
// 'transmit' option has been checked/unchecked
|
||||
else if (theAction == 'transmit') {
|
||||
if (!formElts['asfile'].checked
|
||||
&& (typeof(formElts['gzip']) != 'undefined' && formElts['gzip'].checked)) {
|
||||
// 'bzipped' option has been checked
|
||||
else if (theAction == 'bzip' && formElts['bzip'].checked) {
|
||||
if (!formElts['asfile'].checked) {
|
||||
theForm.elements['asfile'].checked = true;
|
||||
}
|
||||
if (typeof(formElts['gzip']) != 'undefined' && formElts['gzip'].checked) {
|
||||
theForm.elements['gzip'].checked = false;
|
||||
}
|
||||
}
|
||||
// 'transmit' option has been unchecked
|
||||
else if (theAction == 'transmit' && !formElts['asfile'].checked) {
|
||||
if ((typeof(formElts['gzip']) != 'undefined' && formElts['gzip'].checked)) {
|
||||
theForm.elements['gzip'].checked = false;
|
||||
}
|
||||
if ((typeof(formElts['bzip']) != 'undefined' && formElts['bzip'].checked)) {
|
||||
theForm.elements['bzip'].checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end of the 'checkTransmitDump()' function
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -270,6 +270,7 @@ $strWrongUser = "
|
||||
$strYes = "Ano";
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -270,6 +270,7 @@ $strWrongUser = "
|
||||
$strYes = "Ano";
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -45,6 +45,7 @@ $strBookmarkQuery = "Bookmarked SQL-query";
|
||||
$strBookmarkThis = "Bookmark this SQL-query";
|
||||
$strBookmarkView = "View only";
|
||||
$strBrowse = "Browse";
|
||||
$strBzip = "\"bzipped\"";
|
||||
|
||||
$strCantLoadMySQL = "cannot load MySQL extension,<br>please check PHP Configuration.";
|
||||
$strCarriage = "Carriage return: \\r";
|
||||
|
@@ -44,6 +44,7 @@ $strBookmarkQuery = "Requ
|
||||
$strBookmarkThis = "Bookmarker cette requ<71>te";
|
||||
$strBookmarkView = "Voir uniquement";
|
||||
$strBrowse = "Afficher";
|
||||
$strBzip = "\"bzipp<EFBFBD>\"";
|
||||
|
||||
$strCantLoadMySQL = "ne peux charger l'extension MySQL,<br>v<>rifiez la configuration PHP";
|
||||
$strCarriage = "Retour de chariot: \\r";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "Das ist keine Zahl!";
|
||||
$strNotValidNumber = " ist keine g<>ltige Zeilennummer!";
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"GZip komprimiert\"";
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -270,6 +270,7 @@ $strWrongUser = "Usuario/password equivocado. Acesso denegado.";
|
||||
$strYes = "Si";
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -273,6 +273,7 @@ $strNotNumber = "This is not a number!"; //to translate
|
||||
$strNotValidNumber = " is not a valid row number!"; //to translate
|
||||
|
||||
// export Zip (July 07, 2001, 19:48am)
|
||||
$strBzip = "\"bzipped\"";
|
||||
$strGzip = "\"gzipped\""; //to translate
|
||||
$strOffSet = "Offset";
|
||||
$strNbRecords = "No. Of records";
|
||||
|
@@ -6,7 +6,8 @@ require("./grab_globals.inc.php3");
|
||||
@set_time_limit(600);
|
||||
$crlf="\n";
|
||||
|
||||
if (empty($asfile) && !empty($gzip)) {
|
||||
if (empty($asfile)
|
||||
&& (!empty($gzip) || !empty($bzip))) {
|
||||
$asfile = 1;
|
||||
}
|
||||
|
||||
@@ -20,10 +21,15 @@ else
|
||||
if (!isset($table)) $filename=$db;
|
||||
else $filename=$table;
|
||||
include("./lib.inc.php3");
|
||||
$ext = "sql";
|
||||
if($what == "csv") $ext = "csv";
|
||||
if(isset($gzip))
|
||||
if($gzip == "gzip") $ext = "gz";
|
||||
if (isset($bzip) && $bzip == 'bzip') {
|
||||
$ext = 'bz2';
|
||||
} else if (isset($gzip) && $gzip == 'bzip') {
|
||||
$ext = 'gz';
|
||||
} else if ($what == 'csv') {
|
||||
$ext = 'csv';
|
||||
} else {
|
||||
$ext = 'sql';
|
||||
}
|
||||
|
||||
header('Content-Type: application/octetstream');
|
||||
header('Content-Disposition: filename="' . $filename . '.' . $ext . '"');
|
||||
@@ -152,7 +158,10 @@ else
|
||||
$dump_buffer.= "#$crlf$crlf";
|
||||
|
||||
$tmp_buffer="";
|
||||
get_table_content($db, $table, $limit_from, $limit_to, 'my_handler');
|
||||
if (!isset($limit_from) || !isset($limit_to)) {
|
||||
$limit_from = $limit_to = 0;
|
||||
}
|
||||
get_table_content($db, $table, $limit_from, $limit_to, 'my_handler');
|
||||
$dump_buffer.=$tmp_buffer;
|
||||
}
|
||||
$i++;
|
||||
@@ -169,13 +178,20 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($gzip)) {
|
||||
if($gzip == "gzip" && function_exists("gzencode"))
|
||||
// without the optional parameter level because it bug
|
||||
echo gzencode($dump_buffer);
|
||||
if (isset($bzip) && $bzip == 'bzip') {
|
||||
if (function_exists('bzcompress')) {
|
||||
echo bzcompress($dump_buffer);
|
||||
}
|
||||
}
|
||||
else if (isset($gzip) && $gzip == 'gzip') {
|
||||
if ($gzip == 'gzip' && function_exists('gzencode')) {
|
||||
// without the optional parameter level because it bug
|
||||
echo gzencode($dump_buffer);
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo $dump_buffer;
|
||||
}
|
||||
else
|
||||
echo $dump_buffer;
|
||||
|
||||
if(empty($asfile))
|
||||
{
|
||||
|
@@ -599,12 +599,25 @@ echo "\n";
|
||||
<input type="checkbox" name="asfile" value="sendit" onclick="return checkTransmitDump(this.form, 'transmit')" />
|
||||
<?php echo $strSend . "\n"; ?>
|
||||
<?php
|
||||
// gzip encode feature
|
||||
if (function_exists('gzencode')) {
|
||||
echo "\n";
|
||||
?>
|
||||
(<input type="checkbox" name="gzip" value="gzip" onclick="return checkTransmitDump(this.form, 'gzip')" /><?php echo $strGzip; ?>)
|
||||
<?php
|
||||
// gzip and bzip2 encode features
|
||||
if (PMA_INT_VERSION >= 40004) {
|
||||
$is_gzip = @function_exists('gzencode');
|
||||
$is_bzip = @function_exists('bzcompress');
|
||||
if ($is_gzip || $is_bzip) {
|
||||
echo "\n" . ' (';
|
||||
if ($is_gzip) {
|
||||
?>
|
||||
<input type="checkbox" name="gzip" value="gzip" onclick="return checkTransmitDump(this.form, 'gzip')" /><?php echo $strGzip . (($is_bzip) ? ' ' : '') . "\n"; ?>
|
||||
<?php
|
||||
}
|
||||
if ($is_bzip) {
|
||||
echo "\n"
|
||||
?>
|
||||
<input type="checkbox" name="bzip" value="bzip" onclick="return checkTransmitDump(this.form, 'bzip')" /><?php echo $strBzip . "\n"; ?>
|
||||
<?php
|
||||
}
|
||||
echo "\n" . ' )';
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
?>
|
||||
|
Reference in New Issue
Block a user