From ebfef0492d6ba469aa28ac000c2d07b7440ee95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sun, 9 Dec 2001 09:38:41 +0000 Subject: [PATCH] =?UTF-8?q?sending=20the=20"fake"=20header=20at=20each=20i?= =?UTF-8?q?t=EF=BF=BDration=20is=20about=20ten=20times=20faster=20than=20c?= =?UTF-8?q?hecking=20elapsed=20time=20and=20send=20the=20header=20each=202?= =?UTF-8?q?0=20seconds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 5 +++++ libraries/build_dump.lib.php3 | 20 ++++---------------- read_dump.php3 | 19 +++++++------------ 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index c39d63cbe..21181883a 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-12-09 Loïc Chapeaux + * read_dump.php3; libraries/build_dump.lib.php3: sending the "fake" header + at each itération is about ten times faster than checking elapsed time + and send the header each 20 seconds. + 2001-12-08 Loïc Chapeaux * libraries/left.js, lines 234-240: fixed a js bug with empty databases. * libraries/functions.js: improved pointer code (for Opera 6.0). diff --git a/libraries/build_dump.lib.php3 b/libraries/build_dump.lib.php3 index dedab5bbf..bc0672612 100644 --- a/libraries/build_dump.lib.php3 +++ b/libraries/build_dump.lib.php3 @@ -202,7 +202,6 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required $replace = array('\0', '\n', '\r', '\Z'); $is_first_row = TRUE; - $prev_time = time(); @set_time_limit($GLOBALS['cfgExecTimeLimit']); @@ -242,13 +241,8 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ // Call the handler $handler($insert_line); - // loic1: each 20 seconds, send a fake header to bypass browser - // timeout - $new_time = time(); - if ($new_time - $prev_time >= 20) { - $prev_time = $new_time; - header('Expires: 0'); - } + // loic1: send a fake header to bypass browser timeout + header('Expires: 0'); } // end while // Replace last comma by a semi-column in extended inserts case @@ -296,7 +290,6 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $i = 0; $is_first_row = TRUE; $fields_cnt = mysql_num_fields($result); - $prev_time = time(); @set_time_limit($GLOBALS['cfgExecTimeLimit']); // HaRa @@ -359,13 +352,8 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){ $handler(trim($schema_insert)); ++$i; - // loic1: each 20 seconds, send a fake header to bypass browser - // timeout - $new_time = time(); - if ($new_time - $prev_time >= 20) { - $prev_time = $new_time; - header('Expires: 0'); - } + // loic1: send a fake header to bypass browser timeout + header('Expires: 0'); } // end while mysql_free_result($result); diff --git a/read_dump.php3 b/read_dump.php3 index b2032d9a6..f25b8757f 100644 --- a/read_dump.php3 +++ b/read_dump.php3 @@ -18,12 +18,11 @@ */ function PMA_splitSqlFile(&$ret, $sql, $release) { - $sql = trim($sql); - $sql_len = strlen($sql); - $char = ''; - $string_start = ''; - $in_string = FALSE; - $prev_time = time(); + $sql = trim($sql); + $sql_len = strlen($sql); + $char = ''; + $string_start = ''; + $in_string = FALSE; for ($i = 0; $i < $sql_len; ++$i) { $char = $sql[$i]; @@ -119,12 +118,8 @@ function PMA_splitSqlFile(&$ret, $sql, $release) $sql[$i] = ' '; } // end else if - // loic1: each 20 seconds, send a fake header to bypass browser timeout - $new_time = time(); - if ($new_time - $prev_time >= 20) { - $prev_time = $new_time; - header('Expires: 0'); - } + // loic1: send a fake header to bypass browser timeout + header('Expires: 0'); } // end for // add any rest to the returned array