PluginProbe
Autoptimize / 3.1.4
Autoptimize v3.1.4
2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 All 107 releases
← All changes | classes/autoptimizeVersionUpdatesHandler.php +48 -0 2.7.23.1.4 View file →
@@ -52,8 +52,25 @@
52 52 }
53 53 $this->upgrade_from_2_4();
54 54 $major_update = false;
55 55 // No break, intentionally, so all upgrades are ran during a single request...
56 + case '2.7':
57 + $this->upgrade_from_2_7();
58 + $major_update = true;
59 + // No break, intentionally, so all upgrades are ran during a single request...
60 + case '2.8':
61 + // nothing.
62 + case '2.9':
63 + if ( version_compare( autoptimizeOptionWrapper::get_option( 'autoptimize_version', 'none' ), '2.9.999', 'lt' ) ) {
64 + $this->upgrade_from_2_9_before_compatibility();
65 + }
66 + $major_update = false;
67 + // No break, intentionally, so all upgrades are ran during a single request...
68 + case '3.0':
69 + // nothing.
70 + case '3.1':
71 + $this->upgrade_from_3_1();
72 + $major_update = false;
56 73 }
57 74
58 75 if ( true === $major_update ) {
59 76 $this->on_major_version_update();
@@ -246,7 +263,38 @@
246 263 if ( array_key_exists( 'autoptimize_extra_select_field_6', $extra_settings ) ) {
247 264 $imgopt_settings['autoptimize_imgopt_select_field_2'] = $extra_settings['autoptimize_extra_select_field_6'];
248 265 }
249 266 autoptimizeOptionWrapper::update_option( 'autoptimize_imgopt_settings', $imgopt_settings );
267 + }
268 + }
269 +
270 + /**
271 + * Remove CCSS request limit option + update jquery exclusion to include WordPress 5.6 jquery.min.js.
272 + */
273 + private function upgrade_from_2_7() {
274 + delete_option( 'autoptimize_ccss_rlimit' );
275 + $js_exclusions = get_option( 'autoptimize_js_exclude', '' );
276 + if ( strpos( $js_exclusions, 'js/jquery/jquery.js' ) !== false && strpos( $js_exclusions, 'js/jquery/jquery.min.js' ) === false ) {
277 + $js_exclusions .= ', js/jquery/jquery.min.js';
278 + autoptimizeOptionWrapper::update_option( 'autoptimize_js_exclude', $js_exclusions );
279 + }
280 + }
281 +
282 + /**
283 + * Set an option to indicate the AO installation predates the compatibility logic, this way we
284 + * can avoid adding compatibility code that is likely not needed and maybe not wanted as it
285 + * can introduce performance regressions.
286 + */
287 + private function upgrade_from_2_9_before_compatibility() {
288 + autoptimizeOptionWrapper::update_option( 'autoptimize_installed_before_compatibility', true );
289 + }
290 +
291 + /**
292 + * If the 404 handler is active, delete the current PHP-file so it can be re-created to fix the double underscore bug.
293 + */
294 + private function upgrade_from_3_1() {
295 + if ( autoptimizeCache::do_fallback() && version_compare( autoptimizeOptionWrapper::get_option( 'autoptimize_version', 'none' ), '3.1.2', 'lt' ) ) {
296 + $_fallback_php = trailingslashit( WP_CONTENT_DIR ) . 'autoptimize_404_handler.php';
297 + @unlink( $_fallback_php ); // @codingStandardsIgnoreLine
250 298 }
251 299 }
252 300 }