PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 3.1.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v3.1.0
5.12.0 5.13.0 5.13.1 5.11.0 5.10.0 5.9.0 5.8.0 5.8.1 5.7.0 5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 All 47 releases
double-opt-in / OnUpdate.php

OnUpdate.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 3.1.0, at OnUpdate.php

87 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 forge12\contactform7\CF7DoubleOptIn;
4
5 use Forge12\Shared\Logger;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit;
9 }
10
11 function onUpdate() {
12 $logger = Logger::getInstance();
13
14 $logger->info( 'Running onUpdate routine', [
15 'plugin' => 'double-opt-in',
16 'class' => __CLASS__ ?? null,
17 'method' => __FUNCTION__,
18 ] );
19
20 $currentVersion = get_site_option( FORGE12_OPTIN_SLUG . '_version' );
21
22 if ( version_compare( $currentVersion, '1.7' ) < 0 ) {
23 $logger->info( 'Updating to version 1.7', [
24 'plugin' => 'double-opt-in',
25 'current' => $currentVersion,
26 'target' => '1.7',
27 ] );
28
29 createTableOptinCategories();
30 $logger->debug( 'createTableOptinCategories executed', [
31 'plugin' => 'double-opt-in',
32 ] );
33
34 createTableOptin();
35 $logger->debug( 'createTableOptin executed', [
36 'plugin' => 'double-opt-in',
37 ] );
38
39 update_option( FORGE12_OPTIN_SLUG . '_version', '1.7' );
40 $logger->info( 'Version updated to 1.7', [
41 'plugin' => 'double-opt-in',
42 ] );
43 }
44
45 if ( version_compare( $currentVersion, '2.0' ) < 0 ) {
46 $logger->info( 'Updating to version 2.0', [
47 'plugin' => 'double-opt-in',
48 'current' => $currentVersion,
49 'target' => '2.0',
50 ] );
51
52 createTableOptin();
53 $logger->debug( 'createTableOptin executed', [
54 'plugin' => 'double-opt-in',
55 ] );
56
57 update_option( FORGE12_OPTIN_SLUG . '_version', '2.0' );
58 $logger->info( 'Version updated to 2.0', [
59 'plugin' => 'double-opt-in',
60 ] );
61 }
62
63 if ( version_compare( $currentVersion, '3.0.1' ) < 0 ) {
64 $logger->info( 'Updating to version 3.0.1', [
65 'plugin' => 'double-opt-in',
66 'current' => $currentVersion,
67 'target' => '3.0.1',
68 ] );
69
70 createTableOptin();
71 $logger->debug( 'createTableOptin executed', [
72 'plugin' => 'double-opt-in',
73 ] );
74
75 update_option( FORGE12_OPTIN_SLUG . '_version', '3.0.1' );
76 $logger->info( 'Version updated to 3.0.1', [
77 'plugin' => 'double-opt-in',
78 ] );
79 }
80
81 $logger->info( 'onUpdate routine finished', [
82 'plugin' => 'double-opt-in',
83 ] );
84 }
85
86 onUpdate();
87