| 1 |
<?php |
| 2 |
|
| 3 |
namespace AcyMailing\Helpers\Update; |
| 4 |
|
| 5 |
use AcyMailing\Controllers\ConfigurationController; |
| 6 |
|
| 7 |
trait SQLPatch |
| 8 |
{ |
| 9 |
public function updateSQL(): void |
| 10 |
{ |
| 11 |
if (!$this->isUpdating) { |
| 12 |
return; |
| 13 |
} |
| 14 |
|
| 15 |
$config = acym_config(); |
| 16 |
|
| 17 |
$this->updateFor603(); |
| 18 |
$this->updateFor610(); |
| 19 |
$this->updateFor612(); |
| 20 |
$this->updateFor613(); |
| 21 |
$this->updateFor614(); |
| 22 |
$this->updateFor615($config); |
| 23 |
$this->updateFor616(); |
| 24 |
$this->updateFor617(); |
| 25 |
$this->updateFor622($config); |
| 26 |
$this->updateFor640(); |
| 27 |
$this->updateFor650(); |
| 28 |
$this->updateFor660(); |
| 29 |
$this->updateFor670(); |
| 30 |
$this->updateFor692(); |
| 31 |
$this->updateFor6100(); |
| 32 |
$this->updateFor6102(); |
| 33 |
$this->updateFor6104(); |
| 34 |
$this->updateFor6110(); |
| 35 |
$this->updateFor6120(); |
| 36 |
$this->updateFor6130(); |
| 37 |
$this->updateFor6140(); |
| 38 |
$this->updateFor6150(); |
| 39 |
$this->updateFor6160(); |
| 40 |
$this->updateFor6170(); |
| 41 |
$this->updateFor6180(); |
| 42 |
$this->updateFor6181(); |
| 43 |
$this->updateFor6190(); |
| 44 |
|
| 45 |
$this->updateFor700($config); |
| 46 |
$this->updateFor710(); |
| 47 |
$this->updateFor720($config); |
| 48 |
$this->updateFor721(); |
| 49 |
$this->updateFor740($config); |
| 50 |
$this->updateFor750($config); |
| 51 |
$this->updateFor755(); |
| 52 |
$this->updateFor759(); |
| 53 |
$this->updateFor7510(); |
| 54 |
$this->updateFor760(); |
| 55 |
$this->updateFor761(); |
| 56 |
$this->updateFor762(); |
| 57 |
$this->updateFor776(); |
| 58 |
$this->updateFor781(); |
| 59 |
$this->updateFor792(); |
| 60 |
$this->updateFor793(); |
| 61 |
$this->updateFor794(); |
| 62 |
$this->updateFor796(); |
| 63 |
|
| 64 |
$this->updateFor800(); |
| 65 |
$this->updateFor810(); |
| 66 |
$this->updateFor811(); |
| 67 |
$this->updateFor850(); |
| 68 |
$this->updateFor860(); |
| 69 |
$this->updateFor862(); |
| 70 |
$this->updateFor870(); |
| 71 |
$this->updateFor872($config); |
| 72 |
$this->updateFor873($config); |
| 73 |
$this->updateFor874($config); |
| 74 |
$this->updateFor881($config); |
| 75 |
|
| 76 |
$this->updateFor920($config); |
| 77 |
$this->updateFor930(); |
| 78 |
$this->updateFor931(); |
| 79 |
$this->updateFor940($config); |
| 80 |
$this->updateFor961(); |
| 81 |
$this->updateFor970(); |
| 82 |
$this->updateFor980(); |
| 83 |
$this->updateFor990(); |
| 84 |
$this->updateFor9101(); |
| 85 |
$this->updateFor9102(); |
| 86 |
$this->updateFor9110(); |
| 87 |
|
| 88 |
$this->updateFor1000(); |
| 89 |
$this->updateFor1020($config); |
| 90 |
$this->updateFor1050(); |
| 91 |
$this->updateFor1060(); |
| 92 |
$this->updateFor1062(); |
| 93 |
$this->updateFor1065(); |
| 94 |
$this->updateFor1070(); |
| 95 |
$this->updateFor1082(); |
| 96 |
$this->updateFor1090($config); |
| 97 |
} |
| 98 |
|
| 99 |
public function checkDB(): void |
| 100 |
{ |
| 101 |
$configController = new ConfigurationController(); |
| 102 |
$messages = $configController->checkDB(false); |
| 103 |
|
| 104 |
if (empty($messages)) { |
| 105 |
return; |
| 106 |
} |
| 107 |
|
| 108 |
$isError = false; |
| 109 |
$textMsgs = []; |
| 110 |
foreach ($messages as $oneMsg) { |
| 111 |
if ($oneMsg['error']) { |
| 112 |
$isError = true; |
| 113 |
} |
| 114 |
$textMsgs[] = $oneMsg['msg']; |
| 115 |
} |
| 116 |
|
| 117 |
if ($isError && !empty($textMsgs)) { |
| 118 |
acym_enqueueMessage(implode('<br />', $textMsgs), 'warning'); |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
private function isPreviousVersionAtLeast(string $versionNumber): bool |
| 123 |
{ |
| 124 |
return version_compare($this->previousVersion, $versionNumber, '>='); |
| 125 |
} |
| 126 |
} |
| 127 |
|