PluginProbe ʕ •ᴥ•ʔ
Modern Image Formats / 2.7.0
Modern Image Formats v2.7.0
2.7.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 2.0.0 2.0.1 2.0.2 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.5.1 2.6.0 2.6.1
webp-uploads / uninstall.php
webp-uploads Last commit date
deprecated.php 11 hours ago helper.php 11 hours ago hooks.php 11 hours ago image-edit.php 11 hours ago load.php 11 hours ago picture-element.php 11 hours ago readme.txt 11 hours ago rest-api.php 11 hours ago settings.php 11 hours ago uninstall.php 11 hours ago
uninstall.php
45 lines
1 <?php
2 /**
3 * Plugin uninstaller logic.
4 *
5 * @package webp-uploads
6 * @since 1.1.0
7 */
8
9 declare( strict_types = 1 );
10
11 // If uninstall.php is not called by WordPress, bail.
12 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13 exit;
14 }
15
16 // 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).
17 if ( is_multisite() ) {
18 $webp_uploads_site_ids = get_sites(
19 array(
20 'fields' => 'ids',
21 'number' => 100,
22 'update_site_cache' => false,
23 'update_site_meta_cache' => false,
24 )
25 );
26
27 foreach ( $webp_uploads_site_ids as $webp_uploads_site_id ) {
28 switch_to_blog( $webp_uploads_site_id ); // @phpstan-ignore argument.type (get_sites( 'fields' => 'ids' ) returns int[], but php-stubs/wordpress-stubs uses a sealed array shape in its conditional return type so the narrowing is lost when extra args are passed. TODO: Fix upstream in php-stubs/wordpress-stubs and remove.)
29 webp_uploads_delete_plugin_option();
30 restore_current_blog();
31 }
32 }
33
34 webp_uploads_delete_plugin_option();
35
36 /**
37 * Delete the current site's option.
38 *
39 * @since 1.1.0
40 */
41 function webp_uploads_delete_plugin_option(): void {
42 delete_option( 'perflab_generate_webp_and_jpeg' );
43 delete_option( 'perflab_generate_all_fallback_sizes' );
44 }
45