Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 6208ba0

Browse files
committed
Fix table creation for mq.sql
1 parent 0e890dc commit 6208ba0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

core/src/plugins/mq.sql/SqlMessageExchanger.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public function performChecks()
6161
}
6262
}
6363

64-
64+
65+
6566
/**
6667
* @var array
6768
*/
@@ -79,6 +80,12 @@ public function loadChannel($channelName, $create = false)
7980
if (isSet(self::$channels) && is_array(self::$channels[$channelName])) {
8081
return;
8182
}
83+
if(empty($this->sqlDriver)) {
84+
return;
85+
}
86+
if(!dibi::isConnected()){
87+
dibi::connect($this->sqlDriver);
88+
}
8289
$res = dibi::query('SELECT [content] FROM [ajxp_mq_queues] WHERE [channel_name] = %s', $channelName);
8390
if($res->count()){
8491
if(!isset(self::$channels)) self::$channels = array();
@@ -100,10 +107,13 @@ public function loadChannel($channelName, $create = false)
100107

101108
public function __destruct()
102109
{
103-
if (isSet(self::$channels) && is_array(self::$channels)) {
110+
if (isSet(self::$channels) && is_array(self::$channels) && !empty($this->sqlDriver)) {
104111
$inserts = [];
105112
$deletes = [];
106113
$driver = $this->sqlDriver["driver"];
114+
if(!dibi::isConnected()){
115+
dibi::connect($this->sqlDriver);
116+
}
107117
foreach (self::$channels as $channelName => $data) {
108118
if (is_array($data)) {
109119
if(isSet($data["CLIENTS"]) && count($data["CLIENTS"])) {

core/src/plugins/mq.sql/create.sql renamed to core/src/plugins/mq.sql/create.mysql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ CREATE TABLE IF NOT EXISTS `ajxp_mq_queues` (
22
`channel_name` varchar(255) NOT NULL,
33
`content` text NOT NULL,
44
PRIMARY KEY (`channel_name`)
5-
) DEFAULT CHARSET=utf8;
5+
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

0 commit comments

Comments
 (0)