diff --git a/ChangeLog b/ChangeLog index c93716d13..4e18b59c7 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,11 +5,16 @@ phpMyAdmin - Changelog $Id$ $Source$ +2002-02-17 Loïc Chapeaux + * read_dump.php3; libraries/build_dump.lib.php3: tried a fix for + bug #508746 - PMA_splitSqlFile() crashes server. Thanks to + Matthias Fichtner (mfichtner) for the suggestions he did. + 2002-02-16 Marc Delisle * db_details.php3, no links if no data, thanks to Alexander M. Turek (rabus) -2002-02-09 Loïc Chapeaux +2002-02-15 Loïc Chapeaux * Documentation.html: line sizes. * sql.php3: optimized a bit. * libraries/select_lang.php3: sorted the languages array. diff --git a/libraries/build_dump.lib.php3 b/libraries/build_dump.lib.php3 index da6fccdd2..a8c623fa4 100644 --- a/libraries/build_dump.lib.php3 +++ b/libraries/build_dump.lib.php3 @@ -210,6 +210,13 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ @set_time_limit($GLOBALS['cfgExecTimeLimit']); + // loic1: send a fake header to bypass browser timeout if data + // are bufferized - part 1 + if (!empty($GLOBALS['ob_mode']) + || (isset($GLOBALS['zip']) || isset($GLOBALS['bzip']) || isset($GLOBALS['gzip']))) { + $time0 = time(); + } + while ($row = mysql_fetch_row($result)) { $current_row++; for ($j = 0; $j < $fields_cnt; $j++) { @@ -247,11 +254,14 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $handler($insert_line); // loic1: send a fake header to bypass browser timeout if data - // are bufferized - if (!empty($GLOBALS['ob_mode']) - || (isset($GLOBALS['zip']) || isset($GLOBALS['bzip']) || isset($GLOBALS['gzip']))) { - header('Expires: 0'); - } + // are bufferized - part 2 + if (isset($time0)) { + $time1 = time(); + if ($time1 >= $time0 + 30) { + $time0 = $time1; + header('X-pmaPing: Pong'); + } + } // end if } // end while } // end if ($result != FALSE) mysql_free_result($result); @@ -301,6 +311,13 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ @set_time_limit($GLOBALS['cfgExecTimeLimit']); // HaRa + // loic1: send a fake header to bypass browser timeout if data + // are bufferized - part 1 + if (!empty($GLOBALS['ob_mode']) + || (isset($GLOBALS['zip']) || isset($GLOBALS['bzip']) || isset($GLOBALS['gzip']))) { + $time0 = time(); + } + while ($row = mysql_fetch_row($result)) { $current_row++; $table_list = '('; @@ -360,12 +377,15 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $schema_insert .= ')'; $handler(trim($schema_insert)); - // loic1: send a fake header to bypass browser timeout if data are - // bufferized - if (!empty($GLOBALS['ob_mode']) - && (isset($GLOBALS['zip']) || isset($GLOBALS['bzip']) || isset($GLOBALS['gzip']))) { - header('Expires: 0'); - } + // loic1: send a fake header to bypass browser timeout if data + // are bufferized - part 2 + if (isset($time0)) { + $time1 = time(); + if ($time1 >= $time0 + 30) { + $time0 = $time1; + header('X-pmaPing: Pong'); + } + } // end if } // end while mysql_free_result($result); diff --git a/read_dump.php3 b/read_dump.php3 index 9aaf71f98..0eb0c1b4c 100644 --- a/read_dump.php3 +++ b/read_dump.php3 @@ -23,6 +23,7 @@ function PMA_splitSqlFile(&$ret, $sql, $release) $char = ''; $string_start = ''; $in_string = FALSE; + $time0 = time(); for ($i = 0; $i < $sql_len; ++$i) { $char = $sql[$i]; @@ -120,8 +121,12 @@ function PMA_splitSqlFile(&$ret, $sql, $release) $sql[$i] = ' '; } // end else if - // loic1: send a fake header to bypass browser timeout - header('Expires: 0'); + // loic1: send a fake header each 30 sec. to bypass browser timeout + $time1 = time(); + if ($time1 >= $time0 + 30) { + $time0 = $time1; + header('X-pmaPing: Pong'); + } // end if } // end for // add any rest to the returned array