| @@ -1,76 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace AcyMailing\Helpers; | |
| 4 | - | |
| 5 | -use AcyMailing\Classes\PluginClass; | |
| 6 | -use AcyMailing\Core\AcymObject; | |
| 7 | - | |
| 8 | -class UpdateHelper extends AcymObject | |
| 9 | -{ | |
| 10 | - use Update\Cms; | |
| 11 | - use Update\Configuration; | |
| 12 | - use Update\DefaultData; | |
| 13 | - use Update\SQLPatch; | |
| 14 | - use Update\Patchv6; | |
| 15 | - use Update\Patchv7; | |
| 16 | - use Update\Patchv8; | |
| 17 | - use Update\Patchv9; | |
| 18 | - use Update\Patchv10; | |
| 19 | - use Update\Patchv11; | |
| 20 | - | |
| 21 | - const FIRST_EMAIL_NAME_KEY = 'ACYM_FIRST_EMAIL_NAME'; | |
| 22 | - const BOUNCE_VERSION = 9; | |
| 23 | - | |
| 24 | - private string $level = 'starter'; | |
| 25 | - private string $version = '11.0.2'; | |
| 26 | - private string $previousVersion; | |
| 27 | - private bool $isUpdating = false; | |
| 28 | - | |
| 29 | - public bool $firstInstallation = true; | |
| 30 | - | |
| 31 | - public function deleteNewSplashScreenInstall(): void | |
| 32 | - { | |
| 33 | - // First installation or installing the same version => don't show the splashscreen | |
| 34 | - if (!$this->isUpdating || (!empty($this->previousVersion) && version_compare($this->previousVersion, $this->version, '='))) { | |
| 35 | - $splashscreenJson = ACYM_PARTIAL.'update'.DS.'changelogs_splashscreen.json'; | |
| 36 | - | |
| 37 | - if (file_exists($splashscreenJson)) { | |
| 38 | - acym_deleteFile($splashscreenJson); | |
| 39 | - } | |
| 40 | - } | |
| 41 | - } | |
| 42 | - | |
| 43 | - public function updateAddons(): void | |
| 44 | - { | |
| 45 | - acym_checkPluginsVersion(); | |
| 46 | - | |
| 47 | - $pluginClass = new PluginClass(); | |
| 48 | - $pluginsToUpdate = $pluginClass->getNotUptoDatePlugins(); | |
| 49 | - foreach ($pluginsToUpdate as $onePlugin) { | |
| 50 | - $pluginClass->updateAddon($onePlugin); | |
| 51 | - } | |
| 52 | - } | |
| 53 | - | |
| 54 | - private function updateQuery(string $query, string $messageType = 'enqueue'): bool | |
| 55 | - { | |
| 56 | - try { | |
| 57 | - $res = acym_query($query); | |
| 58 | - } catch (\Exception $e) { | |
| 59 | - $res = null; | |
| 60 | - } | |
| 61 | - | |
| 62 | - if ($res === null) { | |
| 63 | - $message = isset($e) ? $e->getMessage() : substr(acym_stripTags(acym_getDBError()), 0, 200).'...'; | |
| 64 | - | |
| 65 | - if ($messageType === 'enqueue') { | |
| 66 | - acym_enqueueMessage($message, 'error'); | |
| 67 | - } elseif ($messageType === 'display') { | |
| 68 | - acym_display($message, 'error'); | |
| 69 | - } | |
| 70 | - | |
| 71 | - return false; | |
| 72 | - } | |
| 73 | - | |
| 74 | - return true; | |
| 75 | - } | |
| 76 | -} | |