Permalink
Browse files

Fix table creation for mq.sql

  • Loading branch information...
1 parent 0e890dc commit 6208ba02acd1e70630b11fa2f892a4f8a55cacfe @cdujeu cdujeu committed Oct 3, 2016
@@ -61,7 +61,8 @@ public function performChecks()
}
}
-
+
+
/**
* @var array
*/
@@ -79,6 +80,12 @@ public function loadChannel($channelName, $create = false)
if (isSet(self::$channels) && is_array(self::$channels[$channelName])) {
return;
}
+ if(empty($this->sqlDriver)) {
+ return;
+ }
+ if(!dibi::isConnected()){
+ dibi::connect($this->sqlDriver);
+ }
$res = dibi::query('SELECT [content] FROM [ajxp_mq_queues] WHERE [channel_name] = %s', $channelName);
if($res->count()){
if(!isset(self::$channels)) self::$channels = array();
@@ -100,10 +107,13 @@ public function loadChannel($channelName, $create = false)
public function __destruct()
{
- if (isSet(self::$channels) && is_array(self::$channels)) {
+ if (isSet(self::$channels) && is_array(self::$channels) && !empty($this->sqlDriver)) {
$inserts = [];
$deletes = [];
$driver = $this->sqlDriver["driver"];
+ if(!dibi::isConnected()){
+ dibi::connect($this->sqlDriver);
+ }
foreach (self::$channels as $channelName => $data) {
if (is_array($data)) {
if(isSet($data["CLIENTS"]) && count($data["CLIENTS"])) {
@@ -2,4 +2,4 @@ CREATE TABLE IF NOT EXISTS `ajxp_mq_queues` (
`channel_name` varchar(255) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY (`channel_name`)
-) DEFAULT CHARSET=utf8;
+) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

0 comments on commit 6208ba0

Please sign in to comment.