| @@ -1,13 +1,14 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace AcyMailing\Helpers\Update; |
| 4 | 4 | |
| 5 | +use AcyMailing\Classes\ConfigurationClass; | |
| 5 | 6 | use AcyMailing\Classes\UrlClickClass; |
| 6 | 7 | |
| 7 | 8 | trait Patchv9 |
| 8 | 9 | { |
| 9 | - private function updateFor920($config) | |
| 10 | + private function updateFor920(ConfigurationClass $config): void | |
| 10 | 11 | { |
| 11 | 12 | if ($this->isPreviousVersionAtLeast('9.2.0')) { |
| 12 | 13 | return; |
| 13 | 14 | } |
| @@ -15,11 +16,9 @@ | ||
| 15 | 16 | $socialIcons = json_decode($config->get('social_icons', '{}'), true); |
| 16 | 17 | if (empty($socialIcons['telegram'])) { |
| 17 | 18 | $socialIcons['telegram'] = ACYM_IMAGES.'logo/telegram.png'; |
| 18 | 19 | |
| 19 | - $newConfig = new \stdClass(); | |
| 20 | - $newConfig->social_icons = json_encode($socialIcons); | |
| 21 | - $config->save($newConfig); | |
| 20 | + $config->saveConfig(['social_icons' => json_encode($socialIcons)]); | |
| 22 | 21 | } |
| 23 | 22 | |
| 24 | 23 | $this->updateQuery('ALTER TABLE #__acym_mail_stat ADD COLUMN `click_unique` INT NOT NULL DEFAULT 0'); |
| 25 | 24 | $this->updateQuery('ALTER TABLE #__acym_mail_stat ADD COLUMN `click_total` INT NOT NULL DEFAULT 0'); |
| @@ -36,9 +35,9 @@ | ||
| 36 | 35 | } |
| 37 | 36 | } |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | - private function updateFor930() | |
| 39 | + private function updateFor930(): void | |
| 41 | 40 | { |
| 42 | 41 | if ($this->isPreviousVersionAtLeast('9.3.0')) { |
| 43 | 42 | return; |
| 44 | 43 | } |
| @@ -45,9 +44,9 @@ | ||
| 45 | 44 | |
| 46 | 45 | $this->updateQuery('ALTER TABLE #__acym_rule ADD COLUMN `description` VARCHAR(250) NULL AFTER `name`'); |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | - private function updateFor931() | |
| 48 | + private function updateFor931(): void | |
| 50 | 49 | { |
| 51 | 50 | if ($this->isPreviousVersionAtLeast('9.3.1')) { |
| 52 | 51 | return; |
| 53 | 52 | } |
| @@ -55,20 +54,21 @@ | ||
| 55 | 54 | $maxOrdering = acym_loadResult('SELECT MAX(ordering) FROM #__acym_rule'); |
| 56 | 55 | $this->updateQuery('UPDATE #__acym_rule SET `ordering` = '.intval($maxOrdering + 1).' WHERE `id` = 17'); |
| 57 | 56 | } |
| 58 | 57 | |
| 59 | - private function updateFor940($config) | |
| 58 | + private function updateFor940(ConfigurationClass $config): void | |
| 60 | 59 | { |
| 61 | 60 | if ($this->isPreviousVersionAtLeast('9.4.0')) { |
| 62 | 61 | return; |
| 63 | 62 | } |
| 64 | 63 | |
| 65 | - $config->save([ | |
| 64 | + $config->saveConfig([ | |
| 66 | 65 | 'from_email' => acym_strtolower($config->get('from_email')), |
| 67 | 66 | 'replyto_email' => acym_strtolower($config->get('replyto_email')), |
| 68 | 67 | 'bounce_email' => acym_strtolower($config->get('bounce_email')), |
| 69 | 68 | ]); |
| 70 | 69 | |
| 70 | + // Make sure that all domains in AcyMailer configuration are in lower cases | |
| 71 | 71 | $acymailerParams = $config->get('acymailer_domains', '[]'); |
| 72 | 72 | $acymailerParams = @json_decode($acymailerParams, true); |
| 73 | 73 | if (!empty($acymailerParams)) { |
| 74 | 74 | foreach ($acymailerParams as $domain => $domainParams) { |
| @@ -79,15 +79,15 @@ | ||
| 79 | 79 | |
| 80 | 80 | $acymailerParams[acym_strtolower($domain)] = $acymailerParams[$domain]; |
| 81 | 81 | unset($acymailerParams[$domain]); |
| 82 | 82 | } |
| 83 | - $config->save(['acymailer_domains' => json_encode($acymailerParams)]); | |
| 83 | + $config->saveConfig(['acymailer_domains' => json_encode($acymailerParams)]); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $this->updateQuery('ALTER TABLE `#__acym_field` DROP COLUMN `access`'); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - private function updateFor961() | |
| 89 | + private function updateFor961(): void | |
| 90 | 90 | { |
| 91 | 91 | if ($this->isPreviousVersionAtLeast('9.6.1')) { |
| 92 | 92 | return; |
| 93 | 93 | } |
| @@ -94,9 +94,9 @@ | ||
| 94 | 94 | |
| 95 | 95 | $this->updateQuery('ALTER TABLE `#__acym_mail` ADD INDEX `#__index_acym_mail2` (`type`)'); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - private function updateFor970() | |
| 98 | + private function updateFor970(): void | |
| 99 | 99 | { |
| 100 | 100 | if ($this->isPreviousVersionAtLeast('9.7.0')) { |
| 101 | 101 | return; |
| 102 | 102 | } |
| @@ -106,9 +106,9 @@ | ||
| 106 | 106 | $this->updateQuery('ALTER TABLE #__acym_followup ADD COLUMN `loop_delay` INT NULL'); |
| 107 | 107 | $this->updateQuery('ALTER TABLE #__acym_followup ADD COLUMN `loop_mail_skip` VARCHAR(255) NULL'); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - private function updateFor980() | |
| 110 | + private function updateFor980(): void | |
| 111 | 111 | { |
| 112 | 112 | if ($this->isPreviousVersionAtLeast('9.8.0')) { |
| 113 | 113 | return; |
| 114 | 114 | } |
| @@ -116,9 +116,9 @@ | ||
| 116 | 116 | $this->updateQuery('UPDATE #__acym_plugin SET `type` = "CORE" WHERE `type` = "ADDON" AND `folder_name` = "contact"'); |
| 117 | 117 | $this->updateQuery('ALTER TABLE #__acym_mail ADD COLUMN `bounce_email` VARCHAR(100) NULL'); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - private function updateFor990() | |
| 120 | + private function updateFor990(): void | |
| 121 | 121 | { |
| 122 | 122 | if ($this->isPreviousVersionAtLeast('9.9.0')) { |
| 123 | 123 | return; |
| 124 | 124 | } |
| @@ -135,14 +135,15 @@ | ||
| 135 | 135 | WHERE `body` LIKE "%images/poweredby_%"' |
| 136 | 136 | ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - private function updateFor9101() | |
| 139 | + private function updateFor9101(): void | |
| 140 | 140 | { |
| 141 | 141 | if ($this->isPreviousVersionAtLeast('9.10.1')) { |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | + // On some servers, there is a limit of 767 bytes for the index length, which corresponds to VARCHAR(191) | |
| 145 | 146 | $this->updateQuery('ALTER TABLE #__acym_user DROP INDEX `email_UNIQUE`'); |
| 146 | 147 | $this->updateQuery('ALTER TABLE #__acym_configuration CHANGE `name` `name` VARCHAR(190) NOT NULL'); |
| 147 | 148 | |
| 148 | 149 | $this->updateQuery('ALTER TABLE #__acym_mail_archive CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci'); |
| @@ -178,9 +179,9 @@ | ||
| 178 | 179 | |
| 179 | 180 | $this->updateQuery('TRUNCATE TABLE #__acym_mail_archive'); |
| 180 | 181 | } |
| 181 | 182 | |
| 182 | - private function updateFor9102() | |
| 183 | + private function updateFor9102(): void | |
| 183 | 184 | { |
| 184 | 185 | if ($this->isPreviousVersionAtLeast('9.10.2')) { |
| 185 | 186 | return; |
| 186 | 187 | } |
| @@ -213,9 +214,9 @@ | ||
| 213 | 214 | |
| 214 | 215 | $this->updateQuery('ALTER TABLE #__acym_user ADD UNIQUE INDEX `email_UNIQUE` (`email`(191) ASC)'); |
| 215 | 216 | } |
| 216 | 217 | |
| 217 | - private function updateFor9110() | |
| 218 | + private function updateFor9110(): void | |
| 218 | 219 | { |
| 219 | 220 | if ($this->isPreviousVersionAtLeast('9.11.0')) { |
| 220 | 221 | return; |
| 221 | 222 | } |