1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 22:40:39 +02:00

Merge pull request #4156 from CHItA/ticket/14445

[ticket/14445] Force refresh before schema generation

* CHItA/ticket/14445:
  [ticket/14445] Force refresh before schema generation
This commit is contained in:
Tristan Darricau
2016-02-02 21:16:37 +01:00
2 changed files with 16 additions and 3 deletions

View File

@@ -157,10 +157,10 @@ class config
{ {
if ($this->system_data['max_execution_time'] <= 0) if ($this->system_data['max_execution_time'] <= 0)
{ {
return 1; return PHP_INT_MAX;
} }
return ($this->system_data['start_time'] + $this->system_data['max_execution_time']) - time(); return ($this->system_data['start_time'] + $this->system_data['max_execution_time']) - microtime(true);
} }
/** /**
@@ -430,7 +430,7 @@ class config
$this->system_data['max_execution_time'] = $execution_time; $this->system_data['max_execution_time'] = $execution_time;
// Set start time // Set start time
$this->system_data['start_time'] = time(); $this->system_data['start_time'] = microtime(true);
// Get memory limit // Get memory limit
$this->system_data['memory_limit'] = $this->php_ini->getBytes('memory_limit'); $this->system_data['memory_limit'] = $this->php_ini->getBytes('memory_limit');

View File

@@ -13,6 +13,8 @@
namespace phpbb\install\module\install_database\task; namespace phpbb\install\module\install_database\task;
use phpbb\install\exception\resource_limit_reached_exception;
/** /**
* Create database schema * Create database schema
*/ */
@@ -106,6 +108,17 @@ class create_schema extends \phpbb\install\task_base
*/ */
public function run() public function run()
{ {
// As this task may take a large amount of time to complete refreshing the page might be necessary for some
// server configurations with limited resources
if (!$this->config->get('pre_schema_forced_refresh'))
{
if ($this->config->get_time_remaining() < 5)
{
$this->config->set('pre_schema_forced_refresh', true);
throw new resource_limit_reached_exception();
}
}
$this->db->sql_return_on_error(true); $this->db->sql_return_on_error(true);
$dbms = $this->config->get('dbms'); $dbms = $this->config->get('dbms');