From aa245fe53a110cd64aea28cd7e8d8d3330d2a71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Fri, 9 Nov 2001 22:35:46 +0000 Subject: [PATCH] feature #443134 - unlimited set_time_limit() --- ChangeLog | 3 +++ Documentation.html | 9 +++++++++ config.inc.php3 | 1 + libraries/build_dump.lib.php3 | 14 +++++++------- libraries/common.lib.php3 | 3 +++ read_dump.php3 | 2 +- tbl_dump.php3 | 2 +- 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e28f1d52..fd762049b 100755 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,9 @@ $Source$ tbl_properties.php3; libraries/indexes.js; lang/*: commited patch #458014 - Advanced index generation/editing thanks to Michal Cihar . + * config.inc.php3; Documentation.html; read_dump.php3; tbl_dump.php3; + libraries/common.lib.php3; libraries/build_dump.lib.php3: feature + #443134 - unlimited set_time_limit(). 2001-11-08 Robin Johnson * config.inc.php3; main.php3; phpinfo.php3: fixed bug #479303 diff --git a/Documentation.html b/Documentation.html index a1e67670a..86dce30aa 100755 --- a/Documentation.html +++ b/Documentation.html @@ -524,6 +524,15 @@

+
$cfgExecTimeLimit integer [number of seconds]
+
+ Set the number of seconds a script is allowed to run. If seconds is set + to zero, no time limit is imposed.
+ This setting is used while importing/exporting dump files but has no + effect when PHP is running in safe mode. +

+
+
$cfgSkipLockedTables boolean
Mark used tables and make it possible to show databases with locked diff --git a/config.inc.php3 b/config.inc.php3 index 607efad7f..52ca35fe3 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -96,6 +96,7 @@ unset($cfgServers[0]); */ $cfgOBGzip = TRUE; // use GZIP output buffering if possible $cfgPersistentConnections = FALSE; // use persistent connections to MySQL database +$cfgExecTimeLimit = 300; // maximum execution time in seconds (0 for no limit) $cfgSkipLockedTables = FALSE; // mark used tables, make possible to show // locked tables (since MySQL 3.23.30) $cfgShowSQL = TRUE; // show SQL queries as run diff --git a/libraries/build_dump.lib.php3 b/libraries/build_dump.lib.php3 index 7c8e4f6d8..cdc672b7d 100644 --- a/libraries/build_dump.lib.php3 +++ b/libraries/build_dump.lib.php3 @@ -203,7 +203,7 @@ if (!defined('__LIB_BUILD_DUMP__')){ $replace = array('\0', '\n', '\r', '\Z'); $isFirstRow = TRUE; - @set_time_limit(1200); // 20 Minutes + @set_time_limit($GLOBALS['cfgExecTimeLimit']); while ($row = mysql_fetch_row($result)) { for ($j = 0; $j < $fields_cnt; $j++) { @@ -288,14 +288,13 @@ if (!defined('__LIB_BUILD_DUMP__')){ $isFirstRow = TRUE; $fields_cnt = mysql_num_fields($result); - while ($row = mysql_fetch_row($result)) { - @set_time_limit(60); // HaRa - $table_list = '('; + @set_time_limit($GLOBALS['cfgExecTimeLimit']); // HaRa + while ($row = mysql_fetch_row($result)) { + $table_list = '('; for ($j = 0; $j < $fields_cnt; $j++) { $table_list .= backquote(mysql_field_name($result, $j), $use_backquotes) . ', '; } - $table_list = substr($table_list, 0, -2); $table_list .= ')'; @@ -478,10 +477,11 @@ if (!defined('__LIB_BUILD_DUMP__')){ $result = mysql_query($local_query) or mysql_die('', $local_query, '', $error_url); $fields_cnt = mysql_num_fields($result); + @set_time_limit($GLOBALS['cfgExecTimeLimit']); + // Format the data - $i = 0; + $i = 0; while ($row = mysql_fetch_row($result)) { - @set_time_limit(60); $schema_insert = ''; for ($j = 0; $j < $fields_cnt; $j++) { if (!isset($row[$j])) { diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3 index ddffbe294..efbba76df 100644 --- a/libraries/common.lib.php3 +++ b/libraries/common.lib.php3 @@ -103,6 +103,9 @@ if (!defined('__LIB_COMMON__')){ include('./config.inc.php3'); // For compatibility with old config.inc.php3 + if (!isset($cfgExecTimeLimit)) { + $cfgExecTimeLimit = 300; // 5 minuts + } if (!isset($cfgShowStats)) { $cfgShowStats = TRUE; } diff --git a/read_dump.php3 b/read_dump.php3 index dce0849e4..1e9a305a1 100644 --- a/read_dump.php3 +++ b/read_dump.php3 @@ -132,7 +132,7 @@ function split_sql_file(&$ret, $sql, $release) /** * Increases the max. allowed time to run a script */ -@set_time_limit(10000); +@set_time_limit($cfgExecTimeLimit); /** diff --git a/tbl_dump.php3 b/tbl_dump.php3 index b0f0097ee..28c5c4174 100755 --- a/tbl_dump.php3 +++ b/tbl_dump.php3 @@ -79,7 +79,7 @@ $err_url = 'tbl_properties.php3' /** * Increase time limit for script execution and initializes some variables */ -@set_time_limit(600); +@set_time_limit($cfgExecTimeLimit); $dump_buffer = ''; // Defines the default format $crlf = which_crlf();