Tried a fix for bug #508746 - PMA_splitSqlFile() crashes server

This commit is contained in:
Loïc Chapeaux
2002-02-17 11:59:04 +00:00
parent 2fa991e251
commit fd60f5ba1e
3 changed files with 44 additions and 14 deletions

View File

@@ -5,11 +5,16 @@ phpMyAdmin - Changelog
$Id$
$Source$
2002-02-17 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* 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 <lem9@users.sourceforge.net>
* db_details.php3, no links if no data,
thanks to Alexander M. Turek (rabus)
2002-02-09 Lo<4C>c Chapeaux <lolo@phpheaven.net>
2002-02-15 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* Documentation.html: line sizes.
* sql.php3: optimized a bit.
* libraries/select_lang.php3: sorted the languages array.

View File

@@ -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);

View File

@@ -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