- Sets MySQL timeout to 60 seconds

This commit is contained in:
Vlad
2017-01-15 19:54:23 -05:00
parent b60c758281
commit 625f828cce
2 changed files with 6 additions and 2 deletions

View File

@@ -55,7 +55,8 @@ class Initializer {
\ORM::configure('logging', WP_DEBUG);
\ORM::configure('driver_options', array(
\PDO::MYSQL_ATTR_INIT_COMMAND =>
'SET TIME_ZONE = "' . Env::$db_timezone_offset . '", ' .
'SET SESSION wait_timeout = 60, ' .
'TIME_ZONE = "' . Env::$db_timezone_offset . '", ' .
'sql_mode=(SELECT REPLACE(@@sql_mode,"ONLY_FULL_GROUP_BY",""))'
));

View File

@@ -8,13 +8,16 @@ class InitializerTest extends MailPoetTest {
->raw_query(
'SELECT ' .
'@@sql_mode as sql_mode, ' .
'@@session.time_zone as time_zone'
'@@session.time_zone as time_zone, ' .
'@@session.wait_timeout as wait_timeout'
)
->findOne();
// disable ONLY_FULL_GROUP_BY
expect($result->sql_mode)->notContains('ONLY_FULL_GROUP_BY');
// time zone should be set based on WP's time zone
expect($result->time_zone)->equals(Env::$db_timezone_offset);
// connection timeout should be set to 60 seconds
expect($result->wait_timeout)->equals(60);
}
function testItConfiguresHooks() {