| @@ -30,11 +30,9 @@ | ||
| 30 | 30 | unset($socialIcons[$oneSocial]); |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $newConfig = new \stdClass(); | |
| 35 | - $newConfig->social_icons = json_encode($socialIcons); | |
| 36 | - $config->save($newConfig); | |
| 34 | + $config->saveConfig(['social_icons' => json_encode($socialIcons)]); | |
| 37 | 35 | |
| 38 | 36 | $this->updateQuery('ALTER TABLE `#__acym_form` ADD `redirection_options` TEXT'); |
| 39 | 37 | $formClass = new FormClass(); |
| 40 | 38 | $forms = $formClass->getAll(); |
| @@ -62,8 +60,9 @@ | ||
| 62 | 60 | if ($this->isPreviousVersionAtLeast('7.1.0')) { |
| 63 | 61 | return; |
| 64 | 62 | } |
| 65 | 63 | |
| 64 | + // Welcome and unsubscribe emails have template = 1 for some reason | |
| 66 | 65 | $this->updateQuery( |
| 67 | 66 | 'UPDATE #__acym_mail |
| 68 | 67 | SET `type` = '.acym_escapeDB(MailClass::TYPE_TEMPLATE).' |
| 69 | 68 | WHERE `template` = 1 |
| @@ -81,10 +80,10 @@ | ||
| 81 | 80 | if ($this->isPreviousVersionAtLeast('7.2.0')) { |
| 82 | 81 | return; |
| 83 | 82 | } |
| 84 | 83 | |
| 85 | - $config->save(['built_by_update' => 1]); | |
| 86 | - $config->save(['display_built_by' => 0]); | |
| 84 | + $config->saveConfig(['built_by_update' => 1]); | |
| 85 | + $config->saveConfig(['display_built_by' => 0]); | |
| 87 | 86 | $this->updateQuery('ALTER TABLE #__acym_user CHANGE `language` `language` VARCHAR(20) NOT NULL DEFAULT ""'); |
| 88 | 87 | $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `language` `language` VARCHAR(20) NOT NULL DEFAULT ""'); |
| 89 | 88 | $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `links_language` `links_language` VARCHAR(20) NOT NULL DEFAULT ""'); |
| 90 | 89 | |
| @@ -176,9 +175,9 @@ | ||
| 176 | 175 | $ruleClass = new RuleClass(); |
| 177 | 176 | $ruleClass->save($rule); |
| 178 | 177 | |
| 179 | 178 | $captchaOption = $config->get('captcha', 0); |
| 180 | - $config->save([ | |
| 179 | + $config->saveConfig([ | |
| 181 | 180 | 'captcha' => intval($captchaOption) === 1 ? 'acym_ireCaptcha' : 'none', |
| 182 | 181 | ]); |
| 183 | 182 | |
| 184 | 183 | $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `from_name` `from_name` VARCHAR(100) NULL'); |
| @@ -199,9 +198,9 @@ | ||
| 199 | 198 | } |
| 200 | 199 | |
| 201 | 200 | $news = $config->get('last_news', ''); |
| 202 | 201 | if (!empty($news)) { |
| 203 | - $config->save( | |
| 202 | + $config->saveConfig( | |
| 204 | 203 | [ |
| 205 | 204 | 'last_news' => base64_encode($news), |
| 206 | 205 | ], |
| 207 | 206 | false |
| @@ -222,8 +221,9 @@ | ||
| 222 | 221 | if ($this->isPreviousVersionAtLeast('7.5.5')) { |
| 223 | 222 | return; |
| 224 | 223 | } |
| 225 | 224 | |
| 225 | + $actionClass = new ActionClass(); | |
| 226 | 226 | $automationClass = new AutomationClass(); |
| 227 | 227 | $adminAutomations = $automationClass->getAutomationsAdmin(); |
| 228 | 228 | |
| 229 | 229 | if (empty($adminAutomations)) { |
| @@ -231,9 +231,9 @@ | ||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $mailClass = new MailClass(); |
| 234 | 234 | foreach ($adminAutomations as $oneAutomation) { |
| 235 | - $actions = $automationClass->getActionsByAutomationId(intval($oneAutomation->id)); | |
| 235 | + $actions = $actionClass->getActionsByAutomationId($oneAutomation->id); | |
| 236 | 236 | foreach ($actions as $oneAction) { |
| 237 | 237 | $oneAction->actions = json_decode($oneAction->actions, true); |
| 238 | 238 | foreach ($oneAction->actions as $action) { |
| 239 | 239 | if (empty($action['acy_add_queue']['mail_id'])) continue; |
| @@ -313,10 +313,11 @@ | ||
| 313 | 313 | $this->updateQuery('ALTER TABLE #__acym_user_has_list DROP COLUMN `unsubscribe_reason`'); |
| 314 | 314 | $this->updateQuery('ALTER TABLE #__acym_history ADD `unsubscribe_reason` TEXT NULL'); |
| 315 | 315 | |
| 316 | 316 | $fieldClass = new FieldClass(); |
| 317 | - $dateCustomFields = $fieldClass->getFieldsByType('date'); | |
| 317 | + $dateCustomFields = $fieldClass->getFieldsByType(['date']); | |
| 318 | 318 | |
| 319 | + // Convert the already saved data into the new format | |
| 319 | 320 | foreach ($dateCustomFields as $oneField) { |
| 320 | 321 | $oneField->option = json_decode($oneField->option); |
| 321 | 322 | |
| 322 | 323 | $formatToDisplay = explode('%', $oneField->option->format); |
| @@ -329,8 +330,9 @@ | ||
| 329 | 330 | $month = '00'; |
| 330 | 331 | $day = '00'; |
| 331 | 332 | $i = 0; |
| 332 | 333 | foreach ($formatToDisplay as $one) { |
| 334 | + // This is a value stored when the format was "%m%y" for example and the format changed to something else | |
| 333 | 335 | if (!isset($userDate[$i])) continue 2; |
| 334 | 336 | |
| 335 | 337 | if ($one === 'd') { |
| 336 | 338 | $day = $userDate[$i]; |
| @@ -450,9 +452,9 @@ | ||
| 450 | 452 | if ($this->isPreviousVersionAtLeast('7.9.6') || !file_exists(ACYM_ADDONS_FOLDER_PATH.'couryeah')) { |
| 451 | 453 | return; |
| 452 | 454 | } |
| 453 | 455 | |
| 454 | - unlink(ACYM_ADDONS_FOLDER_PATH.'couryeah'); | |
| 456 | + acym_deleteFile(ACYM_ADDONS_FOLDER_PATH.'couryeah'); | |
| 455 | 457 | $this->updateQuery('UPDATE #__acym_configuration SET `name` = "acymailer_domains" WHERE `name` = "couryeah_domains"'); |
| 456 | 458 | } |
| 457 | 459 | |
| 458 | 460 | private function replaceHikaReminder(array $matches): string |