webp-uploads
Last commit date
deprecated.php
2 years ago
helper.php
1 year ago
hooks.php
1 year ago
image-edit.php
2 years ago
load.php
1 year ago
picture-element.php
1 year ago
readme.txt
1 year ago
rest-api.php
2 years ago
settings.php
1 year ago
uninstall.php
2 years ago
uninstall.php
42 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin uninstaller logic. |
| 4 | * |
| 5 | * @package webp-uploads |
| 6 | * @since 1.1.0 |
| 7 | */ |
| 8 | |
| 9 | // If uninstall.php is not called by WordPress, bail. |
| 10 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 11 | exit; |
| 12 | } |
| 13 | |
| 14 | // For a multisite, delete the option for all sites (however limited to 100 sites to avoid memory limit or timeout problems in large scale networks). |
| 15 | if ( is_multisite() ) { |
| 16 | $site_ids = get_sites( |
| 17 | array( |
| 18 | 'fields' => 'ids', |
| 19 | 'number' => 100, |
| 20 | 'update_site_cache' => false, |
| 21 | 'update_site_meta_cache' => false, |
| 22 | ) |
| 23 | ); |
| 24 | |
| 25 | foreach ( $site_ids as $site_id ) { |
| 26 | switch_to_blog( $site_id ); |
| 27 | webp_uploads_delete_plugin_option(); |
| 28 | restore_current_blog(); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | webp_uploads_delete_plugin_option(); |
| 33 | |
| 34 | /** |
| 35 | * Delete the current site's option. |
| 36 | * |
| 37 | * @since 1.1.0 |
| 38 | */ |
| 39 | function webp_uploads_delete_plugin_option(): void { |
| 40 | delete_option( 'perflab_generate_webp_and_jpeg' ); |
| 41 | } |
| 42 |