I'm trying to create a small script in tools folder to install the default email templates in the empty tables 'email_templates_default' and 'email_templates_default_data' for all installed languages.
I'm trying with the next code:
- Code: Select all
<?php
require(dirname(__FILE__) . '/bootstrap.inc.php');
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
$emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename());
foreach ($this->installedLocales as $locale) {
$emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale));
}
?>
or
- Code: Select all
<?php
require(dirname(__FILE__) . '/bootstrap.inc.php');
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
foreach ($emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename(), true) as $sql) {
$this->executeSQL($sql);
}
foreach ($this->installedLocales as $locale) {
foreach ($emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale), true) as $sql) {
$this->executeSQL($sql);
}
}
?>
but when I run the script (i.e. "php tools/reloadEmailTemplates.php") nothing happens. Still empty tables.
How would you fix it? Have you thought to include something like this in OJS? It would be very useful!
On the other hand, how to make the script clear tables before without having to do it manually?
Thanks,
Cheers.
