Skip to content

Commit 87e7128

Browse files
authored
Merge pull request #5 from integer-net/6071/charset-after-reconnect
6071: Force full reinitialization of MySQL connections after disconnect
2 parents 712e0b3 + a4b5e31 commit 87e7128

File tree

2 files changed

+27
-0
lines changed
  • src/app/code/community/IntegerNet/Solr

2 files changed

+27
-0
lines changed

src/app/code/community/IntegerNet/Solr/Model/Resource/Db.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ public function disconnectMysql()
2222
$connection->closeConnection();
2323
}
2424
}
25+
// connections (adapter objects) must be fully reinitialized, otherwise initStatements are not executed
26+
Mage::unregister('_singleton/core/resource');
2527
}
2628
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* integer_net Magento Module
4+
*
5+
* @category IntegerNet
6+
* @package IntegerNet_Solr
7+
* @copyright Copyright (c) 2016 integer_net GmbH (http://www.integer-net.de/)
8+
* @author Fabian Schmengler <fs@integer-net.de>
9+
*/
10+
11+
/**
12+
* @loadFixture registry
13+
* @doNotIndexAll
14+
*/
15+
class IntegerNet_Solr_Test_Model_Resource_Db extends EcomDev_PHPUnit_Test_Case
16+
{
17+
public function testDisconnectUnsetsConnection()
18+
{
19+
Mage::getResourceModel('integernet_solr/db')->disconnectMysql();
20+
$this->assertEquals(
21+
[],
22+
Mage::getSingleton('core/resource')->getConnections()
23+
);
24+
}
25+
}

0 commit comments

Comments
 (0)