| @@ -52,8 +52,19 @@ | ||
| 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; | |
| 56 | 67 | } |
| 57 | 68 | |
| 58 | 69 | if ( true === $major_update ) { |
| 59 | 70 | $this->on_major_version_update(); |
| @@ -247,6 +258,27 @@ | ||
| 247 | 258 | $imgopt_settings['autoptimize_imgopt_select_field_2'] = $extra_settings['autoptimize_extra_select_field_6']; |
| 248 | 259 | } |
| 249 | 260 | autoptimizeOptionWrapper::update_option( 'autoptimize_imgopt_settings', $imgopt_settings ); |
| 250 | 261 | } |
| 262 | + } | |
| 263 | + | |
| 264 | + /** | |
| 265 | + * remove CCSS request limit option + update jquery exclusion to include WordPress 5.6 jquery.min.js. | |
| 266 | + */ | |
| 267 | + private function upgrade_from_2_7() { | |
| 268 | + delete_option( 'autoptimize_ccss_rlimit' ); | |
| 269 | + $js_exclusions = get_option( 'autoptimize_js_exclude', '' ); | |
| 270 | + if ( strpos( $js_exclusions, 'js/jquery/jquery.js' ) !== false && strpos( $js_exclusions, 'js/jquery/jquery.min.js' ) === false ) { | |
| 271 | + $js_exclusions .= ', js/jquery/jquery.min.js'; | |
| 272 | + autoptimizeOptionWrapper::update_option( 'autoptimize_js_exclude', $js_exclusions ); | |
| 273 | + } | |
| 274 | + } | |
| 275 | + | |
| 276 | + /** | |
| 277 | + * set an option to indicate the AO installation predates the compatibility logic, this way we | |
| 278 | + * can avoid adding compatibility code that is likely not needed and maybe not wanted as it | |
| 279 | + * can introduce performance regressions. | |
| 280 | + */ | |
| 281 | + private function upgrade_from_2_9_before_compatibility() { | |
| 282 | + autoptimizeOptionWrapper::update_option( 'autoptimize_installed_before_compatibility', true ); | |
| 251 | 283 | } |
| 252 | 284 | } |