PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Helpers/Update/Patchv7.php +32 -29 10.0.1 → 11.1.0 View file →
@@ -5,8 +5,9 @@
5 5 use AcyMailing\Classes\ActionClass;
6 6 use AcyMailing\Classes\AutomationClass;
7 7 use AcyMailing\Classes\CampaignClass;
8 8 use AcyMailing\Classes\ConditionClass;
9 +use AcyMailing\Classes\ConfigurationClass;
9 10 use AcyMailing\Classes\FieldClass;
10 11 use AcyMailing\Classes\FormClass;
11 12 use AcyMailing\Classes\MailClass;
12 13 use AcyMailing\Classes\MailStatClass;
@@ -15,9 +16,9 @@
15 16 use AcyMailing\Controllers\ConfigurationController;
16 17
17 18 trait Patchv7
18 19 {
19 - private function updateFor700($config)
20 + private function updateFor700(ConfigurationClass $config): void
20 21 {
21 22 if ($this->isPreviousVersionAtLeast('7.0.0')) {
22 23 return;
23 24 }
@@ -29,11 +30,9 @@
29 30 unset($socialIcons[$oneSocial]);
30 31 }
31 32 }
32 33
33 - $newConfig = new \stdClass();
34 - $newConfig->social_icons = json_encode($socialIcons);
35 - $config->save($newConfig);
34 + $config->saveConfig(['social_icons' => json_encode($socialIcons)]);
36 35
37 36 $this->updateQuery('ALTER TABLE `#__acym_form` ADD `redirection_options` TEXT');
38 37 $formClass = new FormClass();
39 38 $forms = $formClass->getAll();
@@ -55,14 +54,15 @@
55 54 $segmentClass = new SegmentClass();
56 55 $segmentClass->updateSegments();
57 56 }
58 57
59 - private function updateFor710()
58 + private function updateFor710(): void
60 59 {
61 60 if ($this->isPreviousVersionAtLeast('7.1.0')) {
62 61 return;
63 62 }
64 63
64 + // Welcome and unsubscribe emails have template = 1 for some reason
65 65 $this->updateQuery(
66 66 'UPDATE #__acym_mail
67 67 SET `type` = '.acym_escapeDB(MailClass::TYPE_TEMPLATE).'
68 68 WHERE `template` = 1
@@ -74,16 +74,16 @@
74 74 $fieldClass = new FieldClass();
75 75 $fieldClass->insertLanguageField();
76 76 }
77 77
78 - private function updateFor720($config)
78 + private function updateFor720(ConfigurationClass $config): void
79 79 {
80 80 if ($this->isPreviousVersionAtLeast('7.2.0')) {
81 81 return;
82 82 }
83 83
84 - $config->save(['built_by_update' => 1]);
85 - $config->save(['display_built_by' => 0]);
84 + $config->saveConfig(['built_by_update' => 1]);
85 + $config->saveConfig(['display_built_by' => 0]);
86 86 $this->updateQuery('ALTER TABLE #__acym_user CHANGE `language` `language` VARCHAR(20) NOT NULL DEFAULT ""');
87 87 $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `language` `language` VARCHAR(20) NOT NULL DEFAULT ""');
88 88 $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `links_language` `links_language` VARCHAR(20) NOT NULL DEFAULT ""');
89 89
@@ -91,9 +91,9 @@
91 91 $this->updateQuery('ALTER TABLE #__acym_field ADD `translation` LONGTEXT NULL');
92 92 $this->updateQuery('ALTER TABLE #__acym_mail ADD `translation` TEXT NULL');
93 93 }
94 94
95 - private function updateFor721()
95 + private function updateFor721(): void
96 96 {
97 97 if ($this->isPreviousVersionAtLeast('7.2.1')) {
98 98 return;
99 99 }
@@ -100,9 +100,9 @@
100 100
101 101 $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `translation` `translation` TEXT NULL');
102 102 }
103 103
104 - private function updateFor740($config)
104 + private function updateFor740(ConfigurationClass $config): void
105 105 {
106 106 if ($this->isPreviousVersionAtLeast('7.4.0')) {
107 107 return;
108 108 }
@@ -175,9 +175,9 @@
175 175 $ruleClass = new RuleClass();
176 176 $ruleClass->save($rule);
177 177
178 178 $captchaOption = $config->get('captcha', 0);
179 - $config->save([
179 + $config->saveConfig([
180 180 'captcha' => intval($captchaOption) === 1 ? 'acym_ireCaptcha' : 'none',
181 181 ]);
182 182
183 183 $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `from_name` `from_name` VARCHAR(100) NULL');
@@ -185,9 +185,9 @@
185 185 $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `reply_to_name` `reply_to_name` VARCHAR(100) NULL');
186 186 $this->updateQuery('ALTER TABLE #__acym_mail CHANGE `reply_to_email` `reply_to_email` VARCHAR(100) NULL');
187 187 }
188 188
189 - private function updateFor750($config)
189 + private function updateFor750(ConfigurationClass $config): void
190 190 {
191 191 if ($this->isPreviousVersionAtLeast('7.5.0')) {
192 192 return;
193 193 }
@@ -198,9 +198,9 @@
198 198 }
199 199
200 200 $news = $config->get('last_news', '');
201 201 if (!empty($news)) {
202 - $config->save(
202 + $config->saveConfig(
203 203 [
204 204 'last_news' => base64_encode($news),
205 205 ],
206 206 false
@@ -215,14 +215,15 @@
215 215 $mailStatsClass = new MailStatClass();
216 216 $mailStatsClass->migrateTrackingSale();
217 217 }
218 218
219 - private function updateFor755()
219 + private function updateFor755(): void
220 220 {
221 221 if ($this->isPreviousVersionAtLeast('7.5.5')) {
222 222 return;
223 223 }
224 224
225 + $actionClass = new ActionClass();
225 226 $automationClass = new AutomationClass();
226 227 $adminAutomations = $automationClass->getAutomationsAdmin();
227 228
228 229 if (empty($adminAutomations)) {
@@ -230,9 +231,9 @@
230 231 }
231 232
232 233 $mailClass = new MailClass();
233 234 foreach ($adminAutomations as $oneAutomation) {
234 - $actions = $automationClass->getActionsByAutomationId(intval($oneAutomation->id));
235 + $actions = $actionClass->getActionsByAutomationId($oneAutomation->id);
235 236 foreach ($actions as $oneAction) {
236 237 $oneAction->actions = json_decode($oneAction->actions, true);
237 238 foreach ($oneAction->actions as $action) {
238 239 if (empty($action['acy_add_queue']['mail_id'])) continue;
@@ -245,9 +246,9 @@
245 246 }
246 247 }
247 248 }
248 249
249 - private function updateFor759()
250 + private function updateFor759(): void
250 251 {
251 252 if ($this->isPreviousVersionAtLeast('7.5.9')) {
252 253 return;
253 254 }
@@ -268,9 +269,9 @@
268 269 }
269 270 }
270 271 }
271 272
272 - private function updateFor7510()
273 + private function updateFor7510(): void
273 274 {
274 275 if ($this->isPreviousVersionAtLeast('7.5.10') || ACYM_CMS !== 'joomla') {
275 276 return;
276 277 }
@@ -291,9 +292,9 @@
291 292 }
292 293 }
293 294 }
294 295
295 - private function updateFor760()
296 + private function updateFor760(): void
296 297 {
297 298 if ($this->isPreviousVersionAtLeast('7.6.0')) {
298 299 return;
299 300 }
@@ -302,9 +303,9 @@
302 303 $this->updateQuery('ALTER TABLE #__acym_mail DROP `library`');
303 304 $this->updateQuery('ALTER TABLE #__acym_user_has_list ADD `unsubscribe_reason` TEXT NULL');
304 305 }
305 306
306 - private function updateFor761()
307 + private function updateFor761(): void
307 308 {
308 309 if ($this->isPreviousVersionAtLeast('7.6.1')) {
309 310 return;
310 311 }
@@ -312,10 +313,11 @@
312 313 $this->updateQuery('ALTER TABLE #__acym_user_has_list DROP COLUMN `unsubscribe_reason`');
313 314 $this->updateQuery('ALTER TABLE #__acym_history ADD `unsubscribe_reason` TEXT NULL');
314 315
315 316 $fieldClass = new FieldClass();
316 - $dateCustomFields = $fieldClass->getFieldsByType('date');
317 + $dateCustomFields = $fieldClass->getFieldsByType(['date']);
317 318
319 + // Convert the already saved data into the new format
318 320 foreach ($dateCustomFields as $oneField) {
319 321 $oneField->option = json_decode($oneField->option);
320 322
321 323 $formatToDisplay = explode('%', $oneField->option->format);
@@ -328,8 +330,9 @@
328 330 $month = '00';
329 331 $day = '00';
330 332 $i = 0;
331 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
332 335 if (!isset($userDate[$i])) continue 2;
333 336
334 337 if ($one === 'd') {
335 338 $day = $userDate[$i];
@@ -353,9 +356,9 @@
353 356
354 357 $this->updateQuery('ALTER TABLE #__acym_user CHANGE `automation` `automation` VARCHAR(50) NOT NULL DEFAULT ""');
355 358 }
356 359
357 - private function updateFor762()
360 + private function updateFor762(): void
358 361 {
359 362 if ($this->isPreviousVersionAtLeast('7.6.2')) {
360 363 return;
361 364 }
@@ -364,9 +367,9 @@
364 367 $this->updateQuery('ALTER TABLE `#__acym_history` CHANGE `ip` `ip` VARCHAR(50)');
365 368 $this->updateQuery('ALTER TABLE `#__acym_user` CHANGE `confirmation_ip` `confirmation_ip` VARCHAR(50)');
366 369 }
367 370
368 - private function updateFor776()
371 + private function updateFor776(): void
369 372 {
370 373 if ($this->isPreviousVersionAtLeast('7.7.6')) {
371 374 return;
372 375 }
@@ -373,9 +376,9 @@
373 376
374 377 $this->updateQuery('ALTER TABLE `#__acym_list` ADD `display_name` VARCHAR(255) NULL');
375 378 }
376 379
377 - private function updateFor781()
380 + private function updateFor781(): void
378 381 {
379 382 if ($this->isPreviousVersionAtLeast('7.8.1')) {
380 383 return;
381 384 }
@@ -399,9 +402,9 @@
399 402 )'
400 403 );
401 404 }
402 405
403 - private function updateFor792()
406 + private function updateFor792(): void
404 407 {
405 408 if ($this->isPreviousVersionAtLeast('7.9.2')) {
406 409 return;
407 410 }
@@ -414,9 +417,9 @@
414 417 }
415 418 }
416 419 }
417 420
418 - private function updateFor793()
421 + private function updateFor793(): void
419 422 {
420 423 if ($this->isPreviousVersionAtLeast('7.9.3')) {
421 424 return;
422 425 }
@@ -434,9 +437,9 @@
434 437 }
435 438 }
436 439 }
437 440
438 - private function updateFor794()
441 + private function updateFor794(): void
439 442 {
440 443 if ($this->isPreviousVersionAtLeast('7.9.4')) {
441 444 return;
442 445 }
@@ -443,19 +446,19 @@
443 446
444 447 $this->updateQuery('ALTER TABLE `#__acym_custom_zone` ADD `image` VARCHAR(255) NULL');
445 448 }
446 449
447 - private function updateFor796()
450 + private function updateFor796(): void
448 451 {
449 452 if ($this->isPreviousVersionAtLeast('7.9.6') || !file_exists(ACYM_ADDONS_FOLDER_PATH.'couryeah')) {
450 453 return;
451 454 }
452 455
453 - unlink(ACYM_ADDONS_FOLDER_PATH.'couryeah');
456 + acym_deleteFile(ACYM_ADDONS_FOLDER_PATH.'couryeah');
454 457 $this->updateQuery('UPDATE #__acym_configuration SET `name` = "acymailer_domains" WHERE `name` = "couryeah_domains"');
455 458 }
456 459
457 - private function replaceHikaReminder($matches): string
460 + private function replaceHikaReminder(array $matches): string
458 461 {
459 462 $val = (int)$matches[1] * 86400;
460 463
461 464 return '"hikareminder":{"days":"'.$val.'"';