| @@ -3,8 +3,9 @@ | ||
| 3 | 3 | namespace AcyMailing\Helpers\Update; |
| 4 | 4 | |
| 5 | 5 | use AcyMailing\Classes\ActionClass; |
| 6 | 6 | use AcyMailing\Classes\ConditionClass; |
| 7 | +use AcyMailing\Classes\ConfigurationClass; | |
| 7 | 8 | use AcyMailing\Classes\FieldClass; |
| 8 | 9 | use AcyMailing\Classes\ListClass; |
| 9 | 10 | use AcyMailing\Classes\MailClass; |
| 10 | 11 | use AcyMailing\Classes\PluginClass; |
| @@ -13,9 +14,9 @@ | ||
| 13 | 14 | use AcyMailing\Helpers\UpdateHelper; |
| 14 | 15 | |
| 15 | 16 | trait Patchv6 |
| 16 | 17 | { |
| 17 | - private function updateFor603() | |
| 18 | + private function updateFor603(): void | |
| 18 | 19 | { |
| 19 | 20 | if ($this->isPreviousVersionAtLeast('6.0.3')) { |
| 20 | 21 | return; |
| 21 | 22 | } |
| @@ -39,8 +40,9 @@ | ||
| 39 | 40 | $this->updateQuery('ALTER TABLE #__acym_rule CHANGE `id` `id` INT NOT NULL AUTO_INCREMENT'); |
| 40 | 41 | $this->updateQuery('ALTER TABLE #__acym_rule ADD COLUMN `increment_stats` TINYINT(3) NOT NULL'); |
| 41 | 42 | $this->updateQuery('ALTER TABLE #__acym_rule ADD COLUMN `execute_action_after` INT NOT NULL'); |
| 42 | 43 | |
| 44 | + // Use translation keys for name and email fields | |
| 43 | 45 | $this->updateQuery('UPDATE #__acym_field SET `name` = "ACYM_NAME" WHERE `id` = 1 AND `name` = "Name"'); |
| 44 | 46 | $this->updateQuery('UPDATE #__acym_field SET `name` = "ACYM_EMAIL" WHERE `id` = 2 AND `name` = "Email"'); |
| 45 | 47 | $this->updateQuery('UPDATE #__acym_field SET `backend_profile` = 1, `backend_listing` = 1 WHERE `id` IN (1, 2)'); |
| 46 | 48 | |
| @@ -51,9 +53,9 @@ | ||
| 51 | 53 | $this->updateQuery('UPDATE #__acym_configuration SET `value` = '.acym_escapeDB(ACYM_LOGS_FOLDER.'report_{year}_{month}.log').' WHERE `name` = "cron_savepath"'); |
| 52 | 54 | } |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | - private function updateFor610() | |
| 57 | + private function updateFor610(): void | |
| 56 | 58 | { |
| 57 | 59 | if ($this->isPreviousVersionAtLeast('6.1.0')) { |
| 58 | 60 | return; |
| 59 | 61 | } |
| @@ -68,9 +70,10 @@ | ||
| 68 | 70 | `report` TEXT NULL, |
| 69 | 71 | `tree` LONGTEXT NULL, |
| 70 | 72 | PRIMARY KEY (`id`) |
| 71 | 73 | ) |
| 72 | - ENGINE = InnoDB;' | |
| 74 | + ENGINE = InnoDB | |
| 75 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 73 | 76 | ); |
| 74 | 77 | $this->updateQuery( |
| 75 | 78 | 'CREATE TABLE IF NOT EXISTS `#__acym_step` ( |
| 76 | 79 | `id` INT NOT NULL AUTO_INCREMENT, |
| @@ -85,9 +88,10 @@ | ||
| 85 | 88 | REFERENCES `#__acym_automation` (`id`) |
| 86 | 89 | ON DELETE NO ACTION |
| 87 | 90 | ON UPDATE NO ACTION |
| 88 | 91 | ) |
| 89 | - ENGINE = InnoDB;' | |
| 92 | + ENGINE = InnoDB | |
| 93 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 90 | 94 | ); |
| 91 | 95 | $this->updateQuery( |
| 92 | 96 | 'CREATE TABLE IF NOT EXISTS `#__acym_condition` ( |
| 93 | 97 | `id` INT NOT NULL AUTO_INCREMENT, |
| @@ -99,9 +103,10 @@ | ||
| 99 | 103 | REFERENCES `#__acym_step` (`id`) |
| 100 | 104 | ON DELETE NO ACTION |
| 101 | 105 | ON UPDATE NO ACTION |
| 102 | 106 | ) |
| 103 | - ENGINE =InnoDB;' | |
| 107 | + ENGINE =InnoDB | |
| 108 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 104 | 109 | ); |
| 105 | 110 | $this->updateQuery( |
| 106 | 111 | 'CREATE TABLE IF NOT EXISTS `#__acym_action` ( |
| 107 | 112 | `id` INT NOT NULL AUTO_INCREMENT, |
| @@ -115,9 +120,10 @@ | ||
| 115 | 120 | REFERENCES `#__acym_condition` (`id`) |
| 116 | 121 | ON DELETE NO ACTION |
| 117 | 122 | ON UPDATE NO ACTION |
| 118 | 123 | ) |
| 119 | - ENGINE =InnoDB;' | |
| 124 | + ENGINE =InnoDB | |
| 125 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 120 | 126 | ); |
| 121 | 127 | |
| 122 | 128 | $this->updateQuery('ALTER TABLE #__acym_user ADD COLUMN `automation` VARCHAR(50) NOT NULL'); |
| 123 | 129 | |
| @@ -143,9 +149,9 @@ | ||
| 143 | 149 | ); |
| 144 | 150 | } |
| 145 | 151 | } |
| 146 | 152 | |
| 147 | - private function updateFor612() | |
| 153 | + private function updateFor612(): void | |
| 148 | 154 | { |
| 149 | 155 | if ($this->isPreviousVersionAtLeast('6.1.2')) { |
| 150 | 156 | return; |
| 151 | 157 | } |
| @@ -180,9 +186,9 @@ | ||
| 180 | 186 | $fieldClass->save($field); |
| 181 | 187 | } |
| 182 | 188 | } |
| 183 | 189 | |
| 184 | - private function updateFor613() | |
| 190 | + private function updateFor613(): void | |
| 185 | 191 | { |
| 186 | 192 | if ($this->isPreviousVersionAtLeast('6.1.3')) { |
| 187 | 193 | return; |
| 188 | 194 | } |
| @@ -189,9 +195,9 @@ | ||
| 189 | 195 | |
| 190 | 196 | $this->updateQuery('UPDATE #__acym_user_has_list SET `status` = 1 WHERE `status` = 2'); |
| 191 | 197 | } |
| 192 | 198 | |
| 193 | - private function updateFor614() | |
| 199 | + private function updateFor614(): void | |
| 194 | 200 | { |
| 195 | 201 | if ($this->isPreviousVersionAtLeast('6.1.4')) { |
| 196 | 202 | return; |
| 197 | 203 | } |
| @@ -206,9 +212,9 @@ | ||
| 206 | 212 | |
| 207 | 213 | $this->updateQuery('ALTER TABLE #__acym_automation ADD `admin` TINYINT(3) NULL'); |
| 208 | 214 | } |
| 209 | 215 | |
| 210 | - private function updateFor615($config) | |
| 216 | + private function updateFor615(ConfigurationClass $config): void | |
| 211 | 217 | { |
| 212 | 218 | if ($this->isPreviousVersionAtLeast('6.1.5')) { |
| 213 | 219 | return; |
| 214 | 220 | } |
| @@ -214,8 +220,9 @@ | ||
| 214 | 220 | } |
| 215 | 221 | |
| 216 | 222 | $this->updateQuery('ALTER TABLE #__acym_mail ADD `preheader` VARCHAR(255) NULL'); |
| 217 | 223 | |
| 224 | + // Fix bounce rule "blocked by recipient filters | |
| 218 | 225 | $wrongRuleAddresses = acym_loadObjectList('SELECT `id`, `action_message` FROM `#__acym_rule` WHERE `action_message` LIKE "%\"forward_to\":\"\'%"'); |
| 219 | 226 | if (!empty($wrongRuleAddresses)) { |
| 220 | 227 | foreach ($wrongRuleAddresses as $oneRule) { |
| 221 | 228 | $actions = json_decode($oneRule->action_message, true); |
| @@ -223,18 +230,17 @@ | ||
| 223 | 230 | $this->updateQuery('UPDATE `#__acym_rule` SET `action_message` = '.acym_escapeDB(json_encode($actions)).' WHERE `id` = '.intval($oneRule->id)); |
| 224 | 231 | } |
| 225 | 232 | } |
| 226 | 233 | |
| 234 | + // We remove the google+ option from the saved config | |
| 227 | 235 | $socialIcons = json_decode($config->get('social_icons', '{}'), true); |
| 228 | 236 | if (!empty($socialIcons['google'])) { |
| 229 | 237 | unset($socialIcons['google']); |
| 230 | 238 | |
| 231 | - $newConfig = new \stdClass(); | |
| 232 | - $newConfig->social_icons = json_encode($socialIcons); | |
| 233 | - $config->save($newConfig); | |
| 239 | + $config->saveConfig(['social_icons' => json_encode($socialIcons)]); | |
| 234 | 240 | } |
| 235 | 241 | |
| 236 | - | |
| 242 | + // Then remove the google+ button from the emails containing it | |
| 237 | 243 | $mailsWithGoogle = acym_loadObjectList('SELECT `id`, `body` FROM `#__acym_mail` WHERE `body` LIKE "%googleplus%"'); |
| 238 | 244 | foreach ($mailsWithGoogle as $oneMail) { |
| 239 | 245 | $body = preg_replace('#<a [^>]*googleplus[^>]*>[^<]*<img [^>]*>[^<]*</a>#Uis', '', $oneMail->body); |
| 240 | 246 | if (empty($body)) continue; |
| @@ -241,11 +247,13 @@ | ||
| 241 | 247 | |
| 242 | 248 | $this->updateQuery('UPDATE `#__acym_mail` SET `body` = '.acym_escapeDB($body).' WHERE `id` = '.intval($oneMail->id)); |
| 243 | 249 | } |
| 244 | 250 | |
| 251 | + // Add fields for confirmation | |
| 245 | 252 | $this->updateQuery('ALTER TABLE #__acym_user ADD `confirmation_date` DATETIME DEFAULT NULL'); |
| 246 | 253 | $this->updateQuery('ALTER TABLE #__acym_user ADD `confirmation_ip` VARCHAR(16) DEFAULT NULL'); |
| 247 | 254 | |
| 255 | + //Handle Emoji support | |
| 248 | 256 | $mails = acym_loadObjectList('SELECT subject, id FROM #__acym_mail'); |
| 249 | 257 | $mailClass = new MailClass(); |
| 250 | 258 | $mails = $mailClass->encode($mails); |
| 251 | 259 | |
| @@ -253,14 +261,15 @@ | ||
| 253 | 261 | $this->updateQuery('UPDATE #__acym_mail SET `subject` = '.acym_escapeDB($oneMail->subject).' WHERE `id` = '.intval($oneMail->id)); |
| 254 | 262 | } |
| 255 | 263 | } |
| 256 | 264 | |
| 257 | - private function updateFor616() | |
| 265 | + private function updateFor616(): void | |
| 258 | 266 | { |
| 259 | 267 | if ($this->isPreviousVersionAtLeast('6.1.6')) { |
| 260 | 268 | return; |
| 261 | 269 | } |
| 262 | 270 | |
| 271 | + // Handle emojis in body, name, preheader and autosave | |
| 263 | 272 | $mails = acym_loadObjectList('SELECT `id`, `name`, `body`, `autosave`, `preheader` FROM #__acym_mail'); |
| 264 | 273 | $mailClass = new MailClass(); |
| 265 | 274 | $mails = $mailClass->encode($mails); |
| 266 | 275 | |
| @@ -272,9 +281,9 @@ | ||
| 272 | 281 | ); |
| 273 | 282 | } |
| 274 | 283 | } |
| 275 | 284 | |
| 276 | - private function updateFor617() | |
| 285 | + private function updateFor617(): void | |
| 277 | 286 | { |
| 278 | 287 | if ($this->isPreviousVersionAtLeast('6.1.7')) { |
| 279 | 288 | return; |
| 280 | 289 | } |
| @@ -294,16 +303,18 @@ | ||
| 294 | 303 | $conditionClass->save($condition); |
| 295 | 304 | } |
| 296 | 305 | } |
| 297 | 306 | |
| 298 | - private function updateFor622($config) | |
| 307 | + private function updateFor622(ConfigurationClass $config): void | |
| 299 | 308 | { |
| 300 | 309 | if ($this->isPreviousVersionAtLeast('6.2.2')) { |
| 301 | 310 | return; |
| 302 | 311 | } |
| 303 | 312 | |
| 313 | + // Get the allowed extensions | |
| 304 | 314 | $allowedExtensions = explode(',', $config->get('allowed_files')); |
| 305 | 315 | if (!empty($allowedExtensions)) { |
| 316 | + // Get the files in the upload folder | |
| 306 | 317 | $uploadFolder = trim(acym_cleanPath(html_entity_decode(ACYM_UPLOAD_FOLDER)), DS.' ').DS; |
| 307 | 318 | $uploadPath = acym_cleanPath(ACYM_ROOT.$uploadFolder.'userfiles'.DS); |
| 308 | 319 | |
| 309 | 320 | if (file_exists($uploadPath)) { |
| @@ -308,8 +319,9 @@ | ||
| 308 | 319 | |
| 309 | 320 | if (file_exists($uploadPath)) { |
| 310 | 321 | $files = acym_getFiles($uploadPath); |
| 311 | 322 | if (!empty($files)) { |
| 323 | + // Delete unallowed files | |
| 312 | 324 | foreach ($files as $fileName) { |
| 313 | 325 | if (!preg_match('#\.('.implode('|', $allowedExtensions).')$#Ui', $fileName)) { |
| 314 | 326 | acym_deleteFile($uploadPath.DS.$fileName); |
| 315 | 327 | } |
| @@ -318,14 +330,15 @@ | ||
| 318 | 330 | } |
| 319 | 331 | } |
| 320 | 332 | } |
| 321 | 333 | |
| 322 | - private function updateFor640() | |
| 334 | + private function updateFor640(): void | |
| 323 | 335 | { |
| 324 | 336 | if ($this->isPreviousVersionAtLeast('6.4.0')) { |
| 325 | 337 | return; |
| 326 | 338 | } |
| 327 | 339 | |
| 340 | + //we add new columns | |
| 328 | 341 | $this->updateQuery('ALTER TABLE #__acym_campaign ADD `sending_type` VARCHAR(16) DEFAULT NULL'); |
| 329 | 342 | $this->updateQuery('ALTER TABLE #__acym_campaign ADD `sending_params` TEXT DEFAULT NULL'); |
| 330 | 343 | $this->updateQuery('ALTER TABLE #__acym_campaign ADD `parent_id` INT DEFAULT NULL'); |
| 331 | 344 | $this->updateQuery('ALTER TABLE #__acym_campaign ADD `last_trigger` INT DEFAULT NULL'); |
| @@ -330,16 +343,19 @@ | ||
| 330 | 343 | $this->updateQuery('ALTER TABLE #__acym_campaign ADD `parent_id` INT DEFAULT NULL'); |
| 331 | 344 | $this->updateQuery('ALTER TABLE #__acym_campaign ADD `last_trigger` INT DEFAULT NULL'); |
| 332 | 345 | $this->updateQuery('ALTER TABLE #__acym_campaign ADD `next_trigger` INT DEFAULT NULL'); |
| 333 | 346 | |
| 347 | + //we fill the column sending_type | |
| 334 | 348 | $this->updateQuery('UPDATE #__acym_campaign SET `sending_type` = "now" WHERE `scheduled` = 0'); |
| 335 | 349 | $this->updateQuery('UPDATE #__acym_campaign SET `sending_type` = "scheduled" WHERE `scheduled` = 1'); |
| 350 | + //I do this because if we do that 'ALTER TABLE #__acym_campaign ADD `sending_params` TEXT DEFAULT "[]"' I have a sql error can't set default value for column sending_params in joomla | |
| 336 | 351 | $this->updateQuery('UPDATE #__acym_campaign SET `sending_params` = "[]"'); |
| 337 | 352 | |
| 353 | + //we delete the column scheduled | |
| 338 | 354 | $this->updateQuery('ALTER TABLE #__acym_campaign DROP `scheduled`'); |
| 339 | 355 | } |
| 340 | 356 | |
| 341 | - private function updateFor650() | |
| 357 | + private function updateFor650(): void | |
| 342 | 358 | { |
| 343 | 359 | if ($this->isPreviousVersionAtLeast('6.5.0')) { |
| 344 | 360 | return; |
| 345 | 361 | } |
| @@ -358,9 +374,10 @@ | ||
| 358 | 374 | `description` LONGTEXT NOT NULL, |
| 359 | 375 | `latest_version` VARCHAR (255) NOT NULL, |
| 360 | 376 | PRIMARY KEY (`id`) |
| 361 | 377 | ) |
| 362 | - ENGINE = InnoDB;' | |
| 378 | + ENGINE = InnoDB | |
| 379 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 363 | 380 | ); |
| 364 | 381 | |
| 365 | 382 | $pluginsBefore650 = [ |
| 366 | 383 | 'joomla' => [ |
| @@ -397,9 +414,9 @@ | ||
| 397 | 414 | } |
| 398 | 415 | $this->updateQuery('ALTER TABLE #__acym_campaign CHANGE `last_trigger` `last_generated` INT DEFAULT NULL'); |
| 399 | 416 | } |
| 400 | 417 | |
| 401 | - private function updateFor660() | |
| 418 | + private function updateFor660(): void | |
| 402 | 419 | { |
| 403 | 420 | if ($this->isPreviousVersionAtLeast('6.6.0')) { |
| 404 | 421 | return; |
| 405 | 422 | } |
| @@ -406,8 +423,9 @@ | ||
| 406 | 423 | |
| 407 | 424 | $mailClass = new MailClass(); |
| 408 | 425 | $firstEmail = $mailClass->getOneByName(acym_translation(UpdateHelper::FIRST_EMAIL_NAME_KEY)); |
| 409 | 426 | if (!empty($firstEmail)) { |
| 427 | + // If the user installed AcyMailing but didn't save the first template, we just complete the <em> | |
| 410 | 428 | $firstEmail->body = preg_replace( |
| 411 | 429 | '#(<em class="acym_remove_dynamic acymicon-close">)(</em>)#Uis', |
| 412 | 430 | '$1‍$2', |
| 413 | 431 | $firstEmail->body |
| @@ -413,11 +431,13 @@ | ||
| 413 | 431 | $firstEmail->body |
| 414 | 432 | ); |
| 415 | 433 | |
| 416 | 434 | |
| 435 | + // If he saved the first template, it has completely removed the dtext closing <em> | |
| 417 | 436 | |
| 418 | 437 | $closing = '<em class="acym_remove_dynamic acymicon-close">‍</em>'; |
| 419 | 438 | |
| 439 | + // 1 - the view it online | |
| 420 | 440 | $firstEmail->body = preg_replace( |
| 421 | 441 | '#(<span[^>]+data\-dynamic="{readonline}.+<span class="acym_online">[^<]+</span>[^<]*</a>[^<]*)(</span>)#Uis', |
| 422 | 442 | '$1'.$closing.'$2', |
| 423 | 443 | $firstEmail->body |
| @@ -422,8 +442,9 @@ | ||
| 422 | 442 | '$1'.$closing.'$2', |
| 423 | 443 | $firstEmail->body |
| 424 | 444 | ); |
| 425 | 445 | |
| 446 | + // 2 - the user first name | |
| 426 | 447 | $firstEmail->body = preg_replace( |
| 427 | 448 | '#(<span[^>]+data\-dynamic="{subscriber:name[^>]+>[^<]+)(</span>)#Uis', |
| 428 | 449 | '$1'.$closing.'$2', |
| 429 | 450 | $firstEmail->body |
| @@ -428,8 +449,9 @@ | ||
| 428 | 449 | '$1'.$closing.'$2', |
| 429 | 450 | $firstEmail->body |
| 430 | 451 | ); |
| 431 | 452 | |
| 453 | + // 3 - the unsubscribe link | |
| 432 | 454 | $firstEmail->body = preg_replace( |
| 433 | 455 | '#(<span[^>]+data\-dynamic="{unsubscribe}.+<span class="acym_unsubscribe">[^<]+</span>[^<]*</a>[^<]*)(</span>)#Uis', |
| 434 | 456 | '$1'.$closing.'$2', |
| 435 | 457 | $firstEmail->body |
| @@ -450,15 +472,17 @@ | ||
| 450 | 472 | |
| 451 | 473 | $installedAddons = acym_loadResultArray('SELECT folder_name FROM #__acym_plugin'); |
| 452 | 474 | |
| 453 | 475 | foreach ($joomlaPluginsBefore650 as $folderName) { |
| 476 | + // The add-on is installed, there's nothing to do | |
| 454 | 477 | if (in_array($folderName, $installedAddons) || !file_exists(ACYM_ADDONS_FOLDER_PATH.$folderName)) continue; |
| 455 | 478 | |
| 479 | + // The add-on is installed but not in the DB, this is an old version that hasn't been removed | |
| 456 | 480 | acym_deleteFolder(ACYM_ADDONS_FOLDER_PATH.$folderName); |
| 457 | 481 | } |
| 458 | 482 | } |
| 459 | 483 | |
| 460 | - private function updateFor670() | |
| 484 | + private function updateFor670(): void | |
| 461 | 485 | { |
| 462 | 486 | if ($this->isPreviousVersionAtLeast('6.7.0')) { |
| 463 | 487 | return; |
| 464 | 488 | } |
| @@ -470,9 +494,9 @@ | ||
| 470 | 494 | $this->updateQuery('ALTER TABLE #__acym_field CHANGE `backend_profile` `backend_edition` TINYINT(3) NULL'); |
| 471 | 495 | $this->updateQuery('ALTER TABLE #__acym_list ADD COLUMN `front_management` INT NULL'); |
| 472 | 496 | } |
| 473 | 497 | |
| 474 | - private function updateFor692() | |
| 498 | + private function updateFor692(): void | |
| 475 | 499 | { |
| 476 | 500 | if ($this->isPreviousVersionAtLeast('6.9.2')) { |
| 477 | 501 | return; |
| 478 | 502 | } |
| @@ -488,9 +512,9 @@ | ||
| 488 | 512 | } |
| 489 | 513 | } |
| 490 | 514 | } |
| 491 | 515 | |
| 492 | - private function updateFor6100() | |
| 516 | + private function updateFor6100(): void | |
| 493 | 517 | { |
| 494 | 518 | if ($this->isPreviousVersionAtLeast('6.10.0')) { |
| 495 | 519 | return; |
| 496 | 520 | } |
| @@ -512,13 +536,14 @@ | ||
| 512 | 536 | $this->updateQuery('DELETE FROM #__acym_user_has_field WHERE `value` = ""'); |
| 513 | 537 | |
| 514 | 538 | $phoneFields = acym_loadResultArray('SELECT `id` FROM #__acym_field WHERE `type` = "phone"'); |
| 515 | 539 | if (!empty($phoneFields)) { |
| 540 | + acym_arrayToInteger($phoneFields); | |
| 516 | 541 | $this->updateQuery('DELETE FROM #__acym_user_has_field WHERE `value` LIKE "%," AND `field_id` IN ('.implode(', ', $phoneFields).')'); |
| 517 | 542 | } |
| 518 | 543 | } |
| 519 | 544 | |
| 520 | - private function updateFor6102() | |
| 545 | + private function updateFor6102(): void | |
| 521 | 546 | { |
| 522 | 547 | if ($this->isPreviousVersionAtLeast('6.10.2')) { |
| 523 | 548 | return; |
| 524 | 549 | } |
| @@ -525,9 +550,9 @@ | ||
| 525 | 550 | |
| 526 | 551 | $this->updateQuery('ALTER TABLE #__acym_mail ADD COLUMN `links_language` VARCHAR(10) NOT NULL DEFAULT ""'); |
| 527 | 552 | } |
| 528 | 553 | |
| 529 | - private function updateFor6104() | |
| 554 | + private function updateFor6104(): void | |
| 530 | 555 | { |
| 531 | 556 | if ($this->isPreviousVersionAtLeast('6.10.4')) { |
| 532 | 557 | return; |
| 533 | 558 | } |
| @@ -551,9 +576,9 @@ | ||
| 551 | 576 | $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `media_folder` `media_folder` VARCHAR(100) NULL'); |
| 552 | 577 | $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `links_language` `links_language` VARCHAR(10) NOT NULL'); |
| 553 | 578 | } |
| 554 | 579 | |
| 555 | - private function updateFor6110() | |
| 580 | + private function updateFor6110(): void | |
| 556 | 581 | { |
| 557 | 582 | if ($this->isPreviousVersionAtLeast('6.11.0')) { |
| 558 | 583 | return; |
| 559 | 584 | } |
| @@ -578,9 +603,9 @@ | ||
| 578 | 603 | |
| 579 | 604 | $this->updateQuery('ALTER TABLE #__acym_list ADD `description` TEXT NOT NULL DEFAULT ""'); |
| 580 | 605 | } |
| 581 | 606 | |
| 582 | - private function updateFor6120() | |
| 607 | + private function updateFor6120(): void | |
| 583 | 608 | { |
| 584 | 609 | if ($this->isPreviousVersionAtLeast('6.12.0')) { |
| 585 | 610 | return; |
| 586 | 611 | } |
| @@ -590,9 +615,9 @@ | ||
| 590 | 615 | $this->updateQuery('ALTER TABLE #__acym_mail ADD `tracking` TINYINT(1) NOT NULL DEFAULT 1'); |
| 591 | 616 | $this->updateQuery('ALTER TABLE #__acym_plugin ADD `settings` LONGTEXT NULL'); |
| 592 | 617 | } |
| 593 | 618 | |
| 594 | - private function updateFor6130() | |
| 619 | + private function updateFor6130(): void | |
| 595 | 620 | { |
| 596 | 621 | if ($this->isPreviousVersionAtLeast('6.13.0')) { |
| 597 | 622 | return; |
| 598 | 623 | } |
| @@ -600,9 +625,9 @@ | ||
| 600 | 625 | $this->updateQuery('ALTER TABLE #__acym_plugin ADD `core` TINYINT(1) NOT NULL DEFAULT 0'); |
| 601 | 626 | $this->updateQuery('ALTER TABLE #__acym_plugin CHANGE `latest_version` `latest_version` VARCHAR(10) NOT NULL'); |
| 602 | 627 | } |
| 603 | 628 | |
| 604 | - private function updateFor6140() | |
| 629 | + private function updateFor6140(): void | |
| 605 | 630 | { |
| 606 | 631 | if ($this->isPreviousVersionAtLeast('6.14.0')) { |
| 607 | 632 | return; |
| 608 | 633 | } |
| @@ -622,17 +647,22 @@ | ||
| 622 | 647 | `delay` SMALLINT(10), |
| 623 | 648 | `pages` TEXT, |
| 624 | 649 | PRIMARY KEY (`id`) |
| 625 | 650 | ) |
| 626 | - ENGINE = InnoDB;' | |
| 651 | + ENGINE = InnoDB | |
| 652 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 627 | 653 | ); |
| 628 | 654 | |
| 655 | + // In a release, all the content insertion addons had the structure Volumes/workspace/acymailing/addons/folder_name/plugin.php instead of just folder_name/plugin.php | |
| 629 | 656 | if (file_exists(ACYM_ADDONS_FOLDER_PATH.'Volumes')) { |
| 630 | 657 | $wrongAddons = acym_getFolders(ACYM_ADDONS_FOLDER_PATH.'Volumes'.DS.'workspace'.DS.'acymailing'.DS.'addons'.DS); |
| 631 | 658 | |
| 632 | 659 | $pluginClass = new PluginClass(); |
| 633 | 660 | foreach ($wrongAddons as $oneGoneWrong) { |
| 634 | - $pluginClass->downloadAddon($oneGoneWrong, false); | |
| 661 | + $errorMessage = $pluginClass->downloadAddon($oneGoneWrong, false); | |
| 662 | + if (!empty($errorMessage)) { | |
| 663 | + acym_enqueueMessage($errorMessage, 'error'); | |
| 664 | + } | |
| 635 | 665 | } |
| 636 | 666 | |
| 637 | 667 | acym_deleteFolder(ACYM_ADDONS_FOLDER_PATH.'Volumes'); |
| 638 | 668 | } |
| @@ -641,9 +671,9 @@ | ||
| 641 | 671 | $this->updateQuery('ALTER TABLE #__acym_mail ADD `language` VARCHAR(10) NOT NULL'); |
| 642 | 672 | $this->updateQuery('ALTER TABLE #__acym_mail ADD `parent_id` INT NULL'); |
| 643 | 673 | } |
| 644 | 674 | |
| 645 | - private function updateFor6150() | |
| 675 | + private function updateFor6150(): void | |
| 646 | 676 | { |
| 647 | 677 | if ($this->isPreviousVersionAtLeast('6.15.0')) { |
| 648 | 678 | return; |
| 649 | 679 | } |
| @@ -655,9 +685,9 @@ | ||
| 655 | 685 | $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `language` `language` VARCHAR(10) NOT NULL DEFAULT ""'); |
| 656 | 686 | $this->updateQuery('ALTER TABLE `#__acym_mail` CHANGE `preheader` `preheader` TEXT NULL'); |
| 657 | 687 | } |
| 658 | 688 | |
| 659 | - private function updateFor6160() | |
| 689 | + private function updateFor6160(): void | |
| 660 | 690 | { |
| 661 | 691 | if ($this->isPreviousVersionAtLeast('6.16.0')) { |
| 662 | 692 | return; |
| 663 | 693 | } |
| @@ -671,9 +701,9 @@ | ||
| 671 | 701 | $this->updateQuery('ALTER TABLE `#__acym_form` ADD termspolicy_options LONGTEXT'); |
| 672 | 702 | $this->updateQuery('UPDATE `#__acym_form` SET `termspolicy_options` = "{\"termscond\":0,\"privacy\":0}" WHERE `termspolicy_options` is NULL'); |
| 673 | 703 | } |
| 674 | 704 | |
| 675 | - private function updateFor6170() | |
| 705 | + private function updateFor6170(): void | |
| 676 | 706 | { |
| 677 | 707 | if ($this->isPreviousVersionAtLeast('6.17.0')) { |
| 678 | 708 | return; |
| 679 | 709 | } |
| @@ -686,9 +716,10 @@ | ||
| 686 | 716 | `active` TINYINT(1) NOT NULL DEFAULT 1, |
| 687 | 717 | `filters` LONGTEXT NULL, |
| 688 | 718 | PRIMARY KEY (`id`) |
| 689 | 719 | ) |
| 690 | - ENGINE = InnoDB;' | |
| 720 | + ENGINE = InnoDB | |
| 721 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 691 | 722 | ); |
| 692 | 723 | $automationHelper = new AutomationHelper(); |
| 693 | 724 | $automationHelper->deleteUnusedEmails(); |
| 694 | 725 | $this->updateQuery('ALTER TABLE `#__acym_form` ADD cookie VARCHAR(30)'); |
| @@ -694,9 +725,9 @@ | ||
| 694 | 725 | $this->updateQuery('ALTER TABLE `#__acym_form` ADD cookie VARCHAR(30)'); |
| 695 | 726 | $this->updateQuery('UPDATE `#__acym_form` SET `cookie` = "{\"cookie_expiration\":1}" WHERE `cookie` IS NULL'); |
| 696 | 727 | } |
| 697 | 728 | |
| 698 | - private function updateFor6180() | |
| 729 | + private function updateFor6180(): void | |
| 699 | 730 | { |
| 700 | 731 | if ($this->isPreviousVersionAtLeast('6.18.0')) { |
| 701 | 732 | return; |
| 702 | 733 | } |
| @@ -720,9 +751,10 @@ | ||
| 720 | 751 | REFERENCES `#__acym_list`(`id`) |
| 721 | 752 | ON DELETE NO ACTION |
| 722 | 753 | ON UPDATE NO ACTION |
| 723 | 754 | ) |
| 724 | - ENGINE = InnoDB;' | |
| 755 | + ENGINE = InnoDB | |
| 756 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 725 | 757 | ); |
| 726 | 758 | $this->updateQuery( |
| 727 | 759 | 'CREATE TABLE IF NOT EXISTS `#__acym_followup_has_mail` ( |
| 728 | 760 | `mail_id` INT NOT NULL, |
| @@ -742,9 +774,10 @@ | ||
| 742 | 774 | REFERENCES `#__acym_followup`(`id`) |
| 743 | 775 | ON DELETE NO ACTION |
| 744 | 776 | ON UPDATE NO ACTION |
| 745 | 777 | ) |
| 746 | - ENGINE = InnoDB;' | |
| 778 | + ENGINE = InnoDB | |
| 779 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 747 | 780 | ); |
| 748 | 781 | |
| 749 | 782 | $this->updateQuery('ALTER TABLE `#__acym_list` ADD `type` VARCHAR(20) NOT NULL DEFAULT '.acym_escapeDB(ListClass::LIST_TYPE_STANDARD)); |
| 750 | 783 | $this->updateQuery('UPDATE `#__acym_list` SET `type` = '.acym_escapeDB(ListClass::LIST_TYPE_FRONT).' WHERE `front_management` = 1'); |
| @@ -765,13 +798,14 @@ | ||
| 765 | 798 | REFERENCES `#__acym_mail`(`id`) |
| 766 | 799 | ON DELETE NO ACTION |
| 767 | 800 | ON UPDATE NO ACTION |
| 768 | 801 | ) |
| 769 | - ENGINE = InnoDB;' | |
| 802 | + ENGINE = InnoDB | |
| 803 | + /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci*/;' | |
| 770 | 804 | ); |
| 771 | 805 | } |
| 772 | 806 | |
| 773 | - private function updateFor6181() | |
| 807 | + private function updateFor6181(): void | |
| 774 | 808 | { |
| 775 | 809 | if ($this->isPreviousVersionAtLeast('6.18.1')) { |
| 776 | 810 | return; |
| 777 | 811 | } |
| @@ -795,9 +829,9 @@ | ||
| 795 | 829 | $mailClass->save($email); |
| 796 | 830 | } |
| 797 | 831 | } |
| 798 | 832 | |
| 799 | - private function updateFor6190() | |
| 833 | + private function updateFor6190(): void | |
| 800 | 834 | { |
| 801 | 835 | if ($this->isPreviousVersionAtLeast('6.19.0')) { |
| 802 | 836 | return; |
| 803 | 837 | } |