| @@ -8,17 +8,14 @@ | ||
| 8 | 8 | use AcyMailing\Classes\RuleClass; |
| 9 | 9 | |
| 10 | 10 | trait Patchv8 |
| 11 | 11 | { |
| 12 | - private function updateFor800(ConfigurationClass $config): void | |
| 12 | + private function updateFor800(): void | |
| 13 | 13 | { |
| 14 | 14 | if ($this->isPreviousVersionAtLeast('8.0.0')) { |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - $secretKey = $config->get('smtp_secret'); | |
| 19 | - $config->save(['smtp_type' => empty($secretKey) ? 'password' : 'oauth']); | |
| 20 | - | |
| 21 | 18 | $this->updateQuery( |
| 22 | 19 | 'CREATE TABLE IF NOT EXISTS `#__acym_mailbox_action` ( |
| 23 | 20 | `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
| 24 | 21 | `name` varchar(255) DEFAULT NULL, |
| @@ -41,9 +38,10 @@ | ||
| 41 | 38 | `active` tinyint(4) NOT NULL DEFAULT 0, |
| 42 | 39 | PRIMARY KEY (`id`), |
| 43 | 40 | INDEX `index_#__acym_mailbox_action1`(`name` ASC) |
| 44 | 41 | ) |
| 45 | - ENGINE = InnoDB;' | |
| 42 | + ENGINE = InnoDB | |
| 43 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 46 | 44 | ); |
| 47 | 45 | } |
| 48 | 46 | |
| 49 | 47 | private function updateFor810(): void |
| @@ -149,9 +147,9 @@ | ||
| 149 | 147 | $groupsAuthorized[] = $group; |
| 150 | 148 | } |
| 151 | 149 | } |
| 152 | 150 | |
| 153 | - $config->save(['acl_'.$page => implode(',', $groupsAuthorized)]); | |
| 151 | + $config->saveConfig(['acl_'.$page => implode(',', $groupsAuthorized)]); | |
| 154 | 152 | } |
| 155 | 153 | |
| 156 | 154 | $queries = file_get_contents(ACYM_BACK.'tables.sql'); |
| 157 | 155 | $tables = explode('CREATE TABLE IF NOT EXISTS ', $queries); |
| @@ -275,9 +273,10 @@ | ||
| 275 | 273 | REFERENCES `#__acym_mail`(`id`) |
| 276 | 274 | ON DELETE NO ACTION |
| 277 | 275 | ON UPDATE NO ACTION |
| 278 | 276 | ) |
| 279 | - ENGINE = InnoDB;' | |
| 277 | + ENGINE = InnoDB | |
| 278 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 280 | 279 | ); |
| 281 | 280 | } |
| 282 | 281 | |
| 283 | 282 | private function updateFor862(): void |
| @@ -298,8 +297,9 @@ | ||
| 298 | 297 | AND mail.type = '.acym_escapeDB(MailClass::TYPE_STANDARD) |
| 299 | 298 | ); |
| 300 | 299 | |
| 301 | 300 | if (!empty($mailsToClean)) { |
| 301 | + acym_arrayToInteger($mailsToClean); | |
| 302 | 302 | $this->updateQuery('DELETE FROM #__acym_mail_archive WHERE mail_id IN ('.implode(',', $mailsToClean).')'); |
| 303 | 303 | $mailClass = new MailClass(); |
| 304 | 304 | $mailClass->delete($mailsToClean); |
| 305 | 305 | } |
| @@ -323,11 +323,9 @@ | ||
| 323 | 323 | $socialIcons = json_decode($config->get('social_icons', '{}'), true); |
| 324 | 324 | if (empty($socialIcons['X'])) { |
| 325 | 325 | $socialIcons['X'] = ACYM_IMAGES.'logo/x.png'; |
| 326 | 326 | |
| 327 | - $newConfig = new \stdClass(); | |
| 328 | - $newConfig->social_icons = json_encode($socialIcons); | |
| 329 | - $config->save($newConfig); | |
| 327 | + $config->saveConfig(['social_icons' => json_encode($socialIcons)]); | |
| 330 | 328 | } |
| 331 | 329 | } |
| 332 | 330 | |
| 333 | 331 | private function updateFor873(ConfigurationClass $config): void |
| @@ -337,22 +335,18 @@ | ||
| 337 | 335 | } |
| 338 | 336 | |
| 339 | 337 | $socialIcons = json_decode($config->get('social_icons', '{}'), true); |
| 340 | 338 | |
| 341 | - if (!empty($socialIcons['X'])) { | |
| 342 | - unset($socialIcons['X']); | |
| 339 | + if (!empty($socialIcons['X']) || empty($socialIcons['x'])) { | |
| 340 | + if (!empty($socialIcons['X'])) { | |
| 341 | + unset($socialIcons['X']); | |
| 342 | + } | |
| 343 | 343 | |
| 344 | - $newConfig = new \stdClass(); | |
| 345 | - $newConfig->social_icons = json_encode($socialIcons); | |
| 346 | - $config->save($newConfig); | |
| 347 | - } | |
| 344 | + if (empty($socialIcons['x'])) { | |
| 345 | + $socialIcons['x'] = ACYM_IMAGES.'logo/x.png'; | |
| 346 | + } | |
| 348 | 347 | |
| 349 | - if (empty($socialIcons['x'])) { | |
| 350 | - $socialIcons['x'] = ACYM_IMAGES.'logo/x.png'; | |
| 351 | - | |
| 352 | - $newConfig = new \stdClass(); | |
| 353 | - $newConfig->social_icons = json_encode($socialIcons); | |
| 354 | - $config->save($newConfig); | |
| 348 | + $config->saveConfig(['social_icons' => json_encode($socialIcons)]); | |
| 355 | 349 | } |
| 356 | 350 | } |
| 357 | 351 | |
| 358 | 352 | private function updateFor874(ConfigurationClass $config): void |
| @@ -360,9 +354,9 @@ | ||
| 360 | 354 | if ($this->isPreviousVersionAtLeast('8.7.4') || ACYM_CMS !== 'joomla') { |
| 361 | 355 | return; |
| 362 | 356 | } |
| 363 | 357 | |
| 364 | - $config->save(['malicious_scan' => 1]); | |
| 358 | + $config->saveConfig(['malicious_scan' => 1]); | |
| 365 | 359 | } |
| 366 | 360 | |
| 367 | 361 | private function updateFor881(ConfigurationClass $config): void |
| 368 | 362 | { |
| @@ -369,11 +363,12 @@ | ||
| 369 | 363 | if ($this->isPreviousVersionAtLeast('8.7.0')) { |
| 370 | 364 | return; |
| 371 | 365 | } |
| 372 | 366 | |
| 367 | + // Replace backslashes by slashes in the upload folder option | |
| 373 | 368 | $uploadFolder = $config->get('uploadfolder'); |
| 374 | 369 | if (!empty($uploadFolder) && strpos($uploadFolder, '\\') !== false) { |
| 375 | 370 | $uploadFolder = str_replace('\\', '/', $uploadFolder); |
| 376 | - $config->save(['uploadfolder' => $uploadFolder]); | |
| 371 | + $config->saveConfig(['uploadfolder' => $uploadFolder]); | |
| 377 | 372 | } |
| 378 | 373 | } |
| 379 | 374 | } |