Skip to content

Commit

Permalink
Support utf8mb4 in campaign subject and content
Browse files Browse the repository at this point in the history
  • Loading branch information
bramley committed Feb 11, 2024
1 parent cd64bed commit bb24406
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions public_html/lists/admin/structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@
'message' => array( // a message
'id' => array('integer not null primary key auto_increment', 'ID'),
'uuid' => array('varchar(36) default ""', 'UUID'),
'subject' => array("varchar(255) not null default '(no subject)'", 'subject'),
'subject' => array("varchar(255) character set utf8mb4 not null default '(no subject)'", 'subject'),
'fromfield' => array("varchar(255) not null default ''", 'from'),
'tofield' => array("varchar(255) not null default ''", 'tofield'),
'replyto' => array("varchar(255) not null default ''", 'reply-to'),
'message' => array('longtext', 'Message'),
'textmessage' => array('longtext', 'Text version of Message'),
'message' => array('longtext character set utf8mb4', 'Message'),
'textmessage' => array('longtext character set utf8mb4', 'Text version of Message'),
'footer' => array('text', 'Footer for a message'),
'entered' => array('datetime', 'Entered'),
'modified' => array('timestamp', 'Modified'),
Expand Down Expand Up @@ -155,7 +155,7 @@
'messagedata' => array(
'name' => array('varchar(100) not null', 'Name of field'),
'id' => array('integer not null', 'Message ID'),
'data' => array('longtext', 'Data'),
'data' => array('longtext character set utf8mb4', 'Data'),
'primary key' => array('(name,id)', ''),
),
'listmessage' => array( // linking messages to a list
Expand Down
8 changes: 8 additions & 0 deletions public_html/lists/admin/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,14 @@ function output($message)
Sql_Query("alter table {$GLOBALS['tables']['admin']} modify modifiedby varchar(66) default ''");
}

if (version_compare($dbversion, '3.6.15','<')) {
// support utf8mb4 for campaign subject and content
Sql_Query("alter table {$GLOBALS['tables']['message']} modify subject varchar(255) character set utf8mb4 not null default '(no subject)'");
Sql_Query("alter table {$GLOBALS['tables']['message']} modify message longtext character set utf8mb4");
Sql_Query("alter table {$GLOBALS['tables']['message']} modify textmessage longtext character set utf8mb4");
Sql_Query("alter table {$GLOBALS['tables']['messagedata']} modify data longtext character set utf8mb4");
}

//# longblobs are better at mixing character encoding. We don't know the encoding of anything we may want to store in cache
//# before converting, it's quickest to clear the cache
clearPageCache();
Expand Down

0 comments on commit bb24406

Please sign in to comment.