PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.1
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
acymailing / back / Helpers / UpdateHelper.php

UpdateHelper.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.1, at back/Helpers/UpdateHelper.php

76 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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
20 const FIRST_EMAIL_NAME_KEY = 'ACYM_FIRST_EMAIL_NAME';
21 const BOUNCE_VERSION = 9;
22
23 private string $level = 'starter';
24 private string $version = '11.0.1';
25 private string $previousVersion;
26 private bool $isUpdating = false;
27
28 public bool $firstInstallation = true;
29
30 public function deleteNewSplashScreenInstall(): void
31 {
32 // First installation or installing the same version => don't show the splashscreen
33 if (!$this->isUpdating || (!empty($this->previousVersion) && version_compare($this->previousVersion, $this->version, '='))) {
34 $splashscreenJson = ACYM_PARTIAL.'update'.DS.'changelogs_splashscreen.json';
35
36 if (file_exists($splashscreenJson)) {
37 acym_deleteFile($splashscreenJson);
38 }
39 }
40 }
41
42 public function updateAddons(): void
43 {
44 acym_checkPluginsVersion();
45
46 $pluginClass = new PluginClass();
47 $pluginsToUpdate = $pluginClass->getNotUptoDatePlugins();
48 foreach ($pluginsToUpdate as $onePlugin) {
49 $pluginClass->updateAddon($onePlugin);
50 }
51 }
52
53 private function updateQuery(string $query, string $messageType = 'enqueue'): bool
54 {
55 try {
56 $res = acym_query($query);
57 } catch (\Exception $e) {
58 $res = null;
59 }
60
61 if ($res === null) {
62 $message = isset($e) ? $e->getMessage() : substr(acym_stripTags(acym_getDBError()), 0, 200).'...';
63
64 if ($messageType === 'enqueue') {
65 acym_enqueueMessage($message, 'error');
66 } elseif ($messageType === 'display') {
67 acym_display($message, 'error');
68 }
69
70 return false;
71 }
72
73 return true;
74 }
75 }
76