PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.11.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.11.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 10.11.1, at back/Helpers/UpdateHelper.php

75 lines 2.0 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 = '10.11.1';
25 private string $previousVersion;
26 private bool $isUpdating = false;
27
28 public bool $firstInstallation = true;
29
30 public function deleteNewSplashScreenInstall(): void
31 {
32 if (!$this->isUpdating || (!empty($this->previousVersion) && version_compare($this->previousVersion, $this->version, '='))) {
33 $splashscreenJson = ACYM_PARTIAL.'update'.DS.'changelogs_splashscreen.json';
34
35 if (file_exists($splashscreenJson)) {
36 @unlink($splashscreenJson);
37 }
38 }
39 }
40
41 public function updateAddons(): void
42 {
43 acym_checkPluginsVersion();
44
45 $pluginClass = new PluginClass();
46 $pluginsToUpdate = $pluginClass->getNotUptoDatePlugins();
47 foreach ($pluginsToUpdate as $onePlugin) {
48 $pluginClass->updateAddon($onePlugin);
49 }
50 }
51
52 private function updateQuery(string $query, string $messageType = 'enqueue'): bool
53 {
54 try {
55 $res = acym_query($query);
56 } catch (\Exception $e) {
57 $res = null;
58 }
59
60 if ($res === null) {
61 $message = isset($e) ? $e->getMessage() : substr(strip_tags(acym_getDBError()), 0, 200).'...';
62
63 if ($messageType === 'enqueue') {
64 acym_enqueueMessage($message, 'error');
65 } elseif ($messageType === 'display') {
66 acym_display($message, 'error');
67 }
68
69 return false;
70 }
71
72 return true;
73 }
74 }
75