@@ -18,183 +18,183 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Install_Service { |
20 | 20 | |
21 | - /** |
|
22 | - * A {@link Wordlift_Log_Service} instance. |
|
23 | - * |
|
24 | - * @since 3.18.0 |
|
25 | - * @access private |
|
26 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
27 | - */ |
|
28 | - private $log; |
|
29 | - |
|
30 | - /** |
|
31 | - * The singleton instance. |
|
32 | - * |
|
33 | - * @since 3.18.0 |
|
34 | - * @access private |
|
35 | - * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance. |
|
36 | - */ |
|
37 | - private static $instance; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var array |
|
41 | - */ |
|
42 | - private $installs; |
|
43 | - |
|
44 | - /** |
|
45 | - * Wordlift_Install_Service constructor. |
|
46 | - * |
|
47 | - * @since 3.18.0 |
|
48 | - */ |
|
49 | - public function __construct() { |
|
50 | - |
|
51 | - /** Installs. */ |
|
52 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install.php'; |
|
53 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-1-0-0.php'; |
|
54 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-10-0.php'; |
|
55 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-12-0.php'; |
|
56 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-14-0.php'; |
|
57 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-15-0.php'; |
|
58 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-0.php'; |
|
59 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-3.php'; |
|
60 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-19-5.php'; |
|
61 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-20-0.php'; |
|
62 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-23-4.php'; |
|
63 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-24-2.php'; |
|
64 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
65 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-package-type.php'; |
|
66 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-25-0.php'; |
|
67 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-0.php'; |
|
68 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-1.php'; |
|
69 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-28-0.php'; |
|
70 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-32-0.php'; |
|
71 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-33-9.php'; |
|
72 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-36-0.php'; |
|
73 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-38-5.php'; |
|
74 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-39-1.php'; |
|
75 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-40-1.php'; |
|
76 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-40-2.php'; |
|
77 | - |
|
78 | - // Get the install services. |
|
79 | - $this->installs = array( |
|
80 | - new Wordlift_Install_1_0_0(), |
|
81 | - new Wordlift_Install_3_10_0(), |
|
82 | - new Wordlift_Install_3_12_0(), |
|
83 | - new Wordlift_Install_3_14_0(), |
|
84 | - new Wordlift_Install_3_15_0(), |
|
85 | - new Wordlift_Install_3_18_0(), |
|
86 | - new Wordlift_Install_3_18_3(), |
|
87 | - new Wordlift_Install_3_19_5(), |
|
88 | - new Wordlift_Install_3_20_0(), |
|
89 | - |
|
90 | - /* |
|
21 | + /** |
|
22 | + * A {@link Wordlift_Log_Service} instance. |
|
23 | + * |
|
24 | + * @since 3.18.0 |
|
25 | + * @access private |
|
26 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
27 | + */ |
|
28 | + private $log; |
|
29 | + |
|
30 | + /** |
|
31 | + * The singleton instance. |
|
32 | + * |
|
33 | + * @since 3.18.0 |
|
34 | + * @access private |
|
35 | + * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance. |
|
36 | + */ |
|
37 | + private static $instance; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var array |
|
41 | + */ |
|
42 | + private $installs; |
|
43 | + |
|
44 | + /** |
|
45 | + * Wordlift_Install_Service constructor. |
|
46 | + * |
|
47 | + * @since 3.18.0 |
|
48 | + */ |
|
49 | + public function __construct() { |
|
50 | + |
|
51 | + /** Installs. */ |
|
52 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install.php'; |
|
53 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-1-0-0.php'; |
|
54 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-10-0.php'; |
|
55 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-12-0.php'; |
|
56 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-14-0.php'; |
|
57 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-15-0.php'; |
|
58 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-0.php'; |
|
59 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-3.php'; |
|
60 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-19-5.php'; |
|
61 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-20-0.php'; |
|
62 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-23-4.php'; |
|
63 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-24-2.php'; |
|
64 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
65 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-package-type.php'; |
|
66 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-25-0.php'; |
|
67 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-0.php'; |
|
68 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-1.php'; |
|
69 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-28-0.php'; |
|
70 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-32-0.php'; |
|
71 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-33-9.php'; |
|
72 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-36-0.php'; |
|
73 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-38-5.php'; |
|
74 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-39-1.php'; |
|
75 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-40-1.php'; |
|
76 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-40-2.php'; |
|
77 | + |
|
78 | + // Get the install services. |
|
79 | + $this->installs = array( |
|
80 | + new Wordlift_Install_1_0_0(), |
|
81 | + new Wordlift_Install_3_10_0(), |
|
82 | + new Wordlift_Install_3_12_0(), |
|
83 | + new Wordlift_Install_3_14_0(), |
|
84 | + new Wordlift_Install_3_15_0(), |
|
85 | + new Wordlift_Install_3_18_0(), |
|
86 | + new Wordlift_Install_3_18_3(), |
|
87 | + new Wordlift_Install_3_19_5(), |
|
88 | + new Wordlift_Install_3_20_0(), |
|
89 | + |
|
90 | + /* |
|
91 | 91 | * This should be enabled with #852. |
92 | 92 | */ |
93 | - new Wordlift_Install_Package_Type(), |
|
94 | - new Wordlift_Install_3_23_4(), |
|
95 | - new Wordlift_Install_3_24_2(), |
|
96 | - new Wordlift_Install_3_25_0(), |
|
97 | - new Wordlift_Install_3_27_0(), |
|
98 | - new Wordlift_Install_3_27_1(), |
|
99 | - new Wordlift_Install_3_28_0(), |
|
100 | - // Add column to represent term |
|
101 | - new Wordlift_Install_3_32_0(), |
|
102 | - // Add the entities table. |
|
103 | - new Wordlift_Install_3_33_9(), |
|
104 | - // When woocommerce extension installed, acf4so should be installed automatically. |
|
105 | - new Wordlift_Install_3_36_0(), |
|
106 | - |
|
107 | - new Wordlift_Install_3_38_5(), |
|
108 | - new Wordlift_Install_3_39_1(), |
|
109 | - |
|
110 | - // See #1621. |
|
111 | - new Wordlift_Install_3_40_1(), |
|
112 | - |
|
113 | - // @link https://github.com/insideout10/wordlift-plugin/issues/1627 |
|
114 | - new Wordlift_Install_3_40_2(), |
|
115 | - ); |
|
116 | - self::$instance = $this; |
|
117 | - |
|
118 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
119 | - |
|
120 | - add_action( 'init', array( $this, 'install' ) ); |
|
121 | - |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Get the singleton instance. |
|
126 | - * |
|
127 | - * @since 3.18.0 |
|
128 | - */ |
|
129 | - public static function get_instance() { |
|
130 | - |
|
131 | - return self::$instance; |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * Loop thought all versions and install the updates. |
|
136 | - * |
|
137 | - * @return void |
|
138 | - * @since 3.18.0 |
|
139 | - * |
|
140 | - * @since 3.20.0 use a transient to avoid concurrent installation calls. |
|
141 | - */ |
|
142 | - public function install() { |
|
143 | - |
|
144 | - $version = null; |
|
145 | - |
|
146 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
147 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
148 | - /** @var Wordlift_Install $install */ |
|
149 | - foreach ( $this->installs as $install ) { |
|
150 | - // Get the install version. |
|
151 | - $version = $install->get_version(); |
|
152 | - |
|
153 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
154 | - || $install->must_install() ) { |
|
155 | - $class_name = get_class( $install ); |
|
156 | - |
|
157 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
158 | - // Install version. |
|
159 | - $install->install(); |
|
160 | - |
|
161 | - $this->log->info( "$class_name installed." ); |
|
162 | - |
|
163 | - // Bump the version. |
|
164 | - update_option( 'wl_db_version', $version ); |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
169 | - @delete_transient( '_wl_installing' ); |
|
170 | - |
|
171 | - } |
|
172 | - |
|
173 | - } |
|
174 | - |
|
175 | - private function install_required() { |
|
176 | - |
|
177 | - /** @var Wordlift_Install $install */ |
|
178 | - foreach ( $this->installs as $install ) { |
|
179 | - // Get the install version. |
|
180 | - $version = $install->get_version(); |
|
181 | - |
|
182 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
183 | - || $install->must_install() ) { |
|
184 | - return true; |
|
185 | - } |
|
186 | - } |
|
187 | - |
|
188 | - return false; |
|
189 | - } |
|
190 | - |
|
191 | - /** |
|
192 | - * Retrieve the current db version. |
|
193 | - * |
|
194 | - * @return type |
|
195 | - */ |
|
196 | - private function get_current_version() { |
|
197 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
198 | - } |
|
93 | + new Wordlift_Install_Package_Type(), |
|
94 | + new Wordlift_Install_3_23_4(), |
|
95 | + new Wordlift_Install_3_24_2(), |
|
96 | + new Wordlift_Install_3_25_0(), |
|
97 | + new Wordlift_Install_3_27_0(), |
|
98 | + new Wordlift_Install_3_27_1(), |
|
99 | + new Wordlift_Install_3_28_0(), |
|
100 | + // Add column to represent term |
|
101 | + new Wordlift_Install_3_32_0(), |
|
102 | + // Add the entities table. |
|
103 | + new Wordlift_Install_3_33_9(), |
|
104 | + // When woocommerce extension installed, acf4so should be installed automatically. |
|
105 | + new Wordlift_Install_3_36_0(), |
|
106 | + |
|
107 | + new Wordlift_Install_3_38_5(), |
|
108 | + new Wordlift_Install_3_39_1(), |
|
109 | + |
|
110 | + // See #1621. |
|
111 | + new Wordlift_Install_3_40_1(), |
|
112 | + |
|
113 | + // @link https://github.com/insideout10/wordlift-plugin/issues/1627 |
|
114 | + new Wordlift_Install_3_40_2(), |
|
115 | + ); |
|
116 | + self::$instance = $this; |
|
117 | + |
|
118 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
119 | + |
|
120 | + add_action( 'init', array( $this, 'install' ) ); |
|
121 | + |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Get the singleton instance. |
|
126 | + * |
|
127 | + * @since 3.18.0 |
|
128 | + */ |
|
129 | + public static function get_instance() { |
|
130 | + |
|
131 | + return self::$instance; |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * Loop thought all versions and install the updates. |
|
136 | + * |
|
137 | + * @return void |
|
138 | + * @since 3.18.0 |
|
139 | + * |
|
140 | + * @since 3.20.0 use a transient to avoid concurrent installation calls. |
|
141 | + */ |
|
142 | + public function install() { |
|
143 | + |
|
144 | + $version = null; |
|
145 | + |
|
146 | + if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
147 | + set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
148 | + /** @var Wordlift_Install $install */ |
|
149 | + foreach ( $this->installs as $install ) { |
|
150 | + // Get the install version. |
|
151 | + $version = $install->get_version(); |
|
152 | + |
|
153 | + if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
154 | + || $install->must_install() ) { |
|
155 | + $class_name = get_class( $install ); |
|
156 | + |
|
157 | + $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
158 | + // Install version. |
|
159 | + $install->install(); |
|
160 | + |
|
161 | + $this->log->info( "$class_name installed." ); |
|
162 | + |
|
163 | + // Bump the version. |
|
164 | + update_option( 'wl_db_version', $version ); |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
169 | + @delete_transient( '_wl_installing' ); |
|
170 | + |
|
171 | + } |
|
172 | + |
|
173 | + } |
|
174 | + |
|
175 | + private function install_required() { |
|
176 | + |
|
177 | + /** @var Wordlift_Install $install */ |
|
178 | + foreach ( $this->installs as $install ) { |
|
179 | + // Get the install version. |
|
180 | + $version = $install->get_version(); |
|
181 | + |
|
182 | + if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
183 | + || $install->must_install() ) { |
|
184 | + return true; |
|
185 | + } |
|
186 | + } |
|
187 | + |
|
188 | + return false; |
|
189 | + } |
|
190 | + |
|
191 | + /** |
|
192 | + * Retrieve the current db version. |
|
193 | + * |
|
194 | + * @return type |
|
195 | + */ |
|
196 | + private function get_current_version() { |
|
197 | + return get_option( 'wl_db_version', '0.0.0' ); |
|
198 | + } |
|
199 | 199 | |
200 | 200 | } |
@@ -49,31 +49,31 @@ discard block |
||
49 | 49 | public function __construct() { |
50 | 50 | |
51 | 51 | /** Installs. */ |
52 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install.php'; |
|
53 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-1-0-0.php'; |
|
54 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-10-0.php'; |
|
55 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-12-0.php'; |
|
56 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-14-0.php'; |
|
57 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-15-0.php'; |
|
58 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-0.php'; |
|
59 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-3.php'; |
|
60 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-19-5.php'; |
|
61 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-20-0.php'; |
|
62 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-23-4.php'; |
|
63 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-24-2.php'; |
|
64 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
65 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-package-type.php'; |
|
66 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-25-0.php'; |
|
67 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-0.php'; |
|
68 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-1.php'; |
|
69 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-28-0.php'; |
|
70 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-32-0.php'; |
|
71 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-33-9.php'; |
|
72 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-36-0.php'; |
|
73 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-38-5.php'; |
|
74 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-39-1.php'; |
|
75 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-40-1.php'; |
|
76 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-40-2.php'; |
|
52 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install.php'; |
|
53 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-1-0-0.php'; |
|
54 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-10-0.php'; |
|
55 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-12-0.php'; |
|
56 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-14-0.php'; |
|
57 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-15-0.php'; |
|
58 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-18-0.php'; |
|
59 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-18-3.php'; |
|
60 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-19-5.php'; |
|
61 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-20-0.php'; |
|
62 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-23-4.php'; |
|
63 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-24-2.php'; |
|
64 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-all-entity-types.php'; |
|
65 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-package-type.php'; |
|
66 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-25-0.php'; |
|
67 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-27-0.php'; |
|
68 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-27-1.php'; |
|
69 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-28-0.php'; |
|
70 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-32-0.php'; |
|
71 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-33-9.php'; |
|
72 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-36-0.php'; |
|
73 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-38-5.php'; |
|
74 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-39-1.php'; |
|
75 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-40-1.php'; |
|
76 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-40-2.php'; |
|
77 | 77 | |
78 | 78 | // Get the install services. |
79 | 79 | $this->installs = array( |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | ); |
116 | 116 | self::$instance = $this; |
117 | 117 | |
118 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
118 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
119 | 119 | |
120 | - add_action( 'init', array( $this, 'install' ) ); |
|
120 | + add_action('init', array($this, 'install')); |
|
121 | 121 | |
122 | 122 | } |
123 | 123 | |
@@ -143,30 +143,30 @@ discard block |
||
143 | 143 | |
144 | 144 | $version = null; |
145 | 145 | |
146 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
147 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
146 | + if ($this->install_required() && false === get_transient('_wl_installing')) { |
|
147 | + set_transient('_wl_installing', true, 5 * MINUTE_IN_SECONDS); |
|
148 | 148 | /** @var Wordlift_Install $install */ |
149 | - foreach ( $this->installs as $install ) { |
|
149 | + foreach ($this->installs as $install) { |
|
150 | 150 | // Get the install version. |
151 | 151 | $version = $install->get_version(); |
152 | 152 | |
153 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
154 | - || $install->must_install() ) { |
|
155 | - $class_name = get_class( $install ); |
|
153 | + if (version_compare($version, $this->get_current_version(), '>') |
|
154 | + || $install->must_install()) { |
|
155 | + $class_name = get_class($install); |
|
156 | 156 | |
157 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
157 | + $this->log->info("Current version is {$this->get_current_version()}, installing $class_name..."); |
|
158 | 158 | // Install version. |
159 | 159 | $install->install(); |
160 | 160 | |
161 | - $this->log->info( "$class_name installed." ); |
|
161 | + $this->log->info("$class_name installed."); |
|
162 | 162 | |
163 | 163 | // Bump the version. |
164 | - update_option( 'wl_db_version', $version ); |
|
164 | + update_option('wl_db_version', $version); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | 168 | // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
169 | - @delete_transient( '_wl_installing' ); |
|
169 | + @delete_transient('_wl_installing'); |
|
170 | 170 | |
171 | 171 | } |
172 | 172 | |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | private function install_required() { |
176 | 176 | |
177 | 177 | /** @var Wordlift_Install $install */ |
178 | - foreach ( $this->installs as $install ) { |
|
178 | + foreach ($this->installs as $install) { |
|
179 | 179 | // Get the install version. |
180 | 180 | $version = $install->get_version(); |
181 | 181 | |
182 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
183 | - || $install->must_install() ) { |
|
182 | + if (version_compare($version, $this->get_current_version(), '>') |
|
183 | + || $install->must_install()) { |
|
184 | 184 | return true; |
185 | 185 | } |
186 | 186 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @return type |
195 | 195 | */ |
196 | 196 | private function get_current_version() { |
197 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
197 | + return get_option('wl_db_version', '0.0.0'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | } |