From 3e694f784d490eeec2fe71015a16316db4a17cb9 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 10 Oct 2013 10:05:20 -0500 Subject: [PATCH 1/3] [ticket/11902] Set max execution time to 0 in db update PHPBB3-11902 --- phpBB/install/database_update.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index b79420ab71..2526657bf9 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -203,7 +203,14 @@ $migrations = $finder $migrator->set_migrations($migrations); // What is a safe limit of execution time? Half the max execution time should be safe. -$safe_time_limit = (ini_get('max_execution_time') / 2); +// No more than 15 seconds so the user isn't sitting and waiting for a very long time +$safe_time_limit = min(15, (ini_get('max_execution_time') / 2)); + +// While we're going to try limit this to half the max execution time, +// we want to try and take additional measures to prevent hitting the +// max execution time (if, say, one migration step takes much longer +// than the max execution time) +set_time_limit(0); while (!$migrator->finished()) { From d062402c4b4a97a7ab4b6d2f316d4d14d8faf70b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Wed, 16 Oct 2013 11:08:33 -0500 Subject: [PATCH 2/3] [ticket/11902] Prevent errors if set_time_limit disabled PHPBB3-11902 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 2526657bf9..07a8ed7a1e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -210,7 +210,7 @@ $safe_time_limit = min(15, (ini_get('max_execution_time') / 2)); // we want to try and take additional measures to prevent hitting the // max execution time (if, say, one migration step takes much longer // than the max execution time) -set_time_limit(0); +@set_time_limit(0); while (!$migrator->finished()) { From 405f883437e248801f3c7d15766a035be53f38ce Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 30 Dec 2013 14:24:58 -0600 Subject: [PATCH 3/3] [ticket/11902] Use phpbb\php\ini class PHPBB3-11902 --- phpBB/install/database_update.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 07a8ed7a1e..bad51e2fe3 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -204,7 +204,8 @@ $migrator->set_migrations($migrations); // What is a safe limit of execution time? Half the max execution time should be safe. // No more than 15 seconds so the user isn't sitting and waiting for a very long time -$safe_time_limit = min(15, (ini_get('max_execution_time') / 2)); +$phpbb_ini = new \phpbb\php\ini(); +$safe_time_limit = min(15, ($phpbb_ini->get_int('max_execution_time') / 2)); // While we're going to try limit this to half the max execution time, // we want to try and take additional measures to prevent hitting the