Skip to content
Snippets Groups Projects
Commit 956b8c80 authored by Jared Hancock's avatar Jared Hancock
Browse files

Fix upgrade from 1.8 develop branch

parent efe859a1
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,17 @@ INSERT INTO `%TABLE_PREFIX%attachment`
DROP TABLE `%TABLE_PREFIX%faq_attachment`;
DROP TABLE IF EXISTS `%TABLE_PREFIX%draft`;
CREATE TABLE `%TABLE_PREFIX%draft` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`staff_id` int(11) unsigned NOT NULL,
`namespace` varchar(32) NOT NULL DEFAULT '',
`body` text NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
-- Migrate email templates to HTML
UPDATE `%TABLE_PREFIX%email_template`
SET `body` = REPLACE('\n', '<br/>',
......
......@@ -4,10 +4,23 @@ class NewHtmlTemplate extends MigrationTask {
var $description = "Adding new super-awesome HTML templates";
function run($runtime) {
$errors = array();
$i18n = new Internationalization('en_US');
$tpls = $i18n->getTemplate('email_template_group.yaml')->getData();
foreach ($tpls as $t)
EmailTemplateGroup::create($t);
EmailTemplateGroup::create($t, $errors);
$files = $i18n->getTemplate('file.yaml')->getData();
foreach ($files as $f) {
$id = AttachmentFile::create($f, $errors);
// Ensure the new files are never deleted (attached to Disk)
$sql ='INSERT INTO '.ATTACHMENT_TABLE
.' SET object_id=0, `type`=\'D\', inline=1'
.', file_id='.db_input($id);
db_query($sql);
}
}
}
return 'NewHtmlTemplate';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment