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

77 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 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.1.1';
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, false);
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 }
77