| @@ -200,8 +200,9 @@ | ||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | private function migrateConfig(array $params): int |
| 203 | 203 | { |
| 204 | + //Mail Settings | |
| 204 | 205 | $fieldsMatchMailSettings = [ |
| 205 | 206 | 'add_names' => 'add_names', |
| 206 | 207 | 'bounce_email' => 'bounce_email', |
| 207 | 208 | 'charset' => 'charset', |
| @@ -234,8 +235,9 @@ | ||
| 234 | 235 | 'smtp_username' => 'smtp_username', |
| 235 | 236 | 'special_chars' => 'special_chars', |
| 236 | 237 | ]; |
| 237 | 238 | |
| 239 | + //Queue Process | |
| 238 | 240 | $fieldsMatchQueueProcess = [ |
| 239 | 241 | 'cron_frequency' => 'cron_frequency', |
| 240 | 242 | 'cron_fromip' => 'cron_fromip', |
| 241 | 243 | 'cron_last' => 'cron_last', |
| @@ -249,12 +251,14 @@ | ||
| 249 | 251 | 'queue_try' => 'queue_try', |
| 250 | 252 | 'queue_type' => 'queue_type', |
| 251 | 253 | ]; |
| 252 | 254 | |
| 255 | + //Subscription | |
| 253 | 256 | $fieldsMatchSubscription = [ |
| 254 | 257 | 'require_confirmation' => 'require_confirmation', |
| 255 | 258 | ]; |
| 256 | 259 | |
| 260 | + //Security | |
| 257 | 261 | $fieldsMatchSecurity = [ |
| 258 | 262 | 'allowedfiles' => 'allowed_files', |
| 259 | 263 | 'email_checkdomain' => 'email_checkdomain', |
| 260 | 264 | 'recaptcha_secretkey' => 'recaptcha_secretkey', |
| @@ -272,8 +276,9 @@ | ||
| 272 | 276 | 'unsub_message' => 'unsub_message', |
| 273 | 277 | 'welcome_message' => 'welcome_message', |
| 274 | 278 | ]; |
| 275 | 279 | |
| 280 | + //Bounce handling | |
| 276 | 281 | $fieldsMatchBounce = [ |
| 277 | 282 | 'bounce_email' => 'bounce_email', |
| 278 | 283 | 'bounce_server' => 'bounce_server', |
| 279 | 284 | 'bounce_port' => 'bounce_port', |
| @@ -575,8 +580,9 @@ | ||
| 575 | 580 | if ('default_value' === $columnConnection[$key] && in_array($oneField->type, ['date', 'birthday'])) { |
| 576 | 581 | $value = preg_replace('@[^0-9]@', '/', $value); |
| 577 | 582 | } |
| 578 | 583 | if ('value' === $columnConnection[$key]) { |
| 584 | + //Decode value from v5 | |
| 579 | 585 | $allValues = explode("\n", $value); |
| 580 | 586 | $returnedValues = []; |
| 581 | 587 | foreach ($allValues as $id => $oneVal) { |
| 582 | 588 | $line = explode('::', trim($oneVal)); |
| @@ -755,16 +761,19 @@ | ||
| 755 | 761 | $fileName = substr($oneAttachment->filename, strrpos($oneAttachment->filename, DS)); |
| 756 | 762 | $uploadFolder = str_replace(['/', '\\'], DS, acym_getFilesFolder()); |
| 757 | 763 | $v7Location = $uploadFolder.$fileName; |
| 758 | 764 | |
| 765 | + // if the file doesn't exist, don't add it | |
| 759 | 766 | $v5Path = acym_cleanPath(ACYM_ROOT.DS.$oneAttachment->filename); |
| 760 | 767 | if (!file_exists($v5Path)) continue; |
| 761 | 768 | |
| 769 | + // copy the file to the v7 files location | |
| 762 | 770 | $v7Path = acym_cleanPath(ACYM_ROOT.DS.$v7Location); |
| 763 | 771 | if (!file_exists($v7Path)) { |
| 764 | 772 | acym_copyFile($v5Path, $v7Path); |
| 765 | 773 | } |
| 766 | 774 | |
| 775 | + // add the attachment to the new mail entry | |
| 767 | 776 | $mail['attachments'][] = (object)[ |
| 768 | 777 | 'filename' => $v7Location, |
| 769 | 778 | 'size' => $oneAttachment->size, |
| 770 | 779 | ]; |
| @@ -771,8 +780,9 @@ | ||
| 771 | 780 | } |
| 772 | 781 | } |
| 773 | 782 | $mail['attachments'] = acym_escapeDB(json_encode($mail['attachments'])); |
| 774 | 783 | |
| 784 | + // Create the related campaign | |
| 775 | 785 | if ($mailType === MailClass::TYPE_STANDARD) { |
| 776 | 786 | $stats = acym_loadResult('SELECT COUNT(mailid) FROM #__acymailing_stats WHERE mailid = '.intval($oneMail->mailid)); |
| 777 | 787 | $isSent = !empty($stats); |
| 778 | 788 | |
| @@ -788,8 +798,9 @@ | ||
| 788 | 798 | ]; |
| 789 | 799 | $campaignsToInsert[] = '('.implode(', ', $campaign).')'; |
| 790 | 800 | } |
| 791 | 801 | |
| 802 | + // Create the related follow-up | |
| 792 | 803 | if ($mailType === MailClass::TYPE_FOLLOWUP) { |
| 793 | 804 | $v5Campaign = acym_loadObject( |
| 794 | 805 | 'SELECT l.listid, l.published, l.name |
| 795 | 806 | FROM #__acymailing_listmail AS lm |
| @@ -796,8 +807,9 @@ | ||
| 796 | 807 | JOIN #__acymailing_list AS l ON l.listid = lm.listid |
| 797 | 808 | WHERE mailid = '.intval($oneMail->mailid) |
| 798 | 809 | ); |
| 799 | 810 | |
| 811 | + // If the followup campaign doesn't exist, create it | |
| 800 | 812 | if (empty($followupsCreated[$v5Campaign->listid])) { |
| 801 | 813 | $followupListIds = acym_loadResultArray('SELECT listid FROM #__acymailing_listcampaign WHERE campaignid = '.intval($v5Campaign->listid)); |
| 802 | 814 | $followupCampaign = new \stdClass(); |
| 803 | 815 | $followupCampaign->name = $v5Campaign->name; |
| @@ -1395,8 +1407,9 @@ | ||
| 1395 | 1407 | 'DELETE FROM #__acym_user_stat', |
| 1396 | 1408 | 'DELETE FROM #__acym_url_click', |
| 1397 | 1409 | 'DELETE FROM #__acym_mail_stat', |
| 1398 | 1410 | 'DELETE FROM #__acym_mail', |
| 1411 | + 'UPDATE #__acym_configuration SET `value` = 0 WHERE `name` = "favorite_template"', | |
| 1399 | 1412 | ]; |
| 1400 | 1413 | |
| 1401 | 1414 | return $this->finalizeClean($queryClean); |
| 1402 | 1415 | } |