PluginProbe
Autoptimize / 3.1.16
Autoptimize v3.1.16
3.1.16 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 All 108 releases
← All changes | classes/autoptimizeVersionUpdatesHandler.php +49 -1 2.7.4 → 3.1.16 View file →
@@ -27,9 +27,8 @@
27 27 */
28 28 public function run_needed_major_upgrades()
29 29 {
30 30 $major_update = false;
31 -
32 31 switch ( $this->current_major_version ) {
33 32 case '1.6':
34 33 $this->upgrade_from_1_6();
35 34 $major_update = true;
@@ -52,8 +51,25 @@
52 51 }
53 52 $this->upgrade_from_2_4();
54 53 $major_update = false;
55 54 // No break, intentionally, so all upgrades are ran during a single request...
55 + case '2.7':
56 + $this->upgrade_from_2_7();
57 + $major_update = true;
58 + // No break, intentionally, so all upgrades are ran during a single request...
59 + case '2.8':
60 + // nothing.
61 + case '2.9':
62 + if ( version_compare( autoptimizeOptionWrapper::get_option( 'autoptimize_version', 'none' ), '2.9.999', 'lt' ) ) {
63 + $this->upgrade_from_2_9_before_compatibility();
64 + }
65 + $major_update = false;
66 + // No break, intentionally, so all upgrades are ran during a single request...
67 + case '3.0':
68 + // nothing.
69 + case '3.1':
70 + $this->upgrade_from_3_1();
71 + $major_update = false;
56 72 }
57 73
58 74 if ( true === $major_update ) {
59 75 $this->on_major_version_update();
@@ -246,7 +262,39 @@
246 262 if ( array_key_exists( 'autoptimize_extra_select_field_6', $extra_settings ) ) {
247 263 $imgopt_settings['autoptimize_imgopt_select_field_2'] = $extra_settings['autoptimize_extra_select_field_6'];
248 264 }
249 265 autoptimizeOptionWrapper::update_option( 'autoptimize_imgopt_settings', $imgopt_settings );
266 + }
267 + }
268 +
269 + /**
270 + * Remove CCSS request limit option + update jquery exclusion to include WordPress 5.6 jquery.min.js.
271 + */
272 + private function upgrade_from_2_7() {
273 + delete_option( 'autoptimize_ccss_rlimit' );
274 + $js_exclusions = get_option( 'autoptimize_js_exclude', '' );
275 + if ( strpos( $js_exclusions, 'js/jquery/jquery.js' ) !== false && strpos( $js_exclusions, 'js/jquery/jquery.min.js' ) === false ) {
276 + $js_exclusions .= ', js/jquery/jquery.min.js';
277 + autoptimizeOptionWrapper::update_option( 'autoptimize_js_exclude', $js_exclusions );
278 + }
279 + }
280 +
281 + /**
282 + * Set an option to indicate the AO installation predates the compatibility logic, this way we
283 + * can avoid adding compatibility code that is likely not needed and maybe not wanted as it
284 + * can introduce performance regressions.
285 + */
286 + private function upgrade_from_2_9_before_compatibility() {
287 + autoptimizeOptionWrapper::update_option( 'autoptimize_installed_before_compatibility', true );
288 + }
289 +
290 + /**
291 + * If the 404 handler is active, delete the current PHP-file so it can be re-created to fix the double underscore bug.
292 + */
293 + private function upgrade_from_3_1() {
294 + $_version_from_db = autoptimizeOptionWrapper::get_option( 'autoptimize_version', 'none' );
295 + if ( autoptimizeCache::do_fallback() && 'none' !== $_version_from_db && version_compare( $_version_from_db, '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 }