Plugin Directory


Ignore:
Timestamp:
10/18/2026 11:12:11 PM (8 hours ago)
Author:
yuracode
Message:

Release YuraCode Security 1.0.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • yuracode-security/trunk/uninstall.php

    r3696012 r3753699  
    99\YuraCodeSecurity\Autoloader::register();
    1010
     11// The .htaccess block and its backups are one per network on multisite:
     12// remove them once, from the managing (main) site. HtaccessManager skips
     13// the removal when uninstall runs on a subsite.
    1114\YuraCodeSecurity\Firewall\HtaccessManager::remove();
    12 
    1315\YuraCodeSecurity\Firewall\HtaccessManager::cleanup_backups();
    14 
    15 delete_option( 'yuracode-security_settings' );
    1616
    1717global $wpdb;
    1818
    19 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- clearing transients by prefix has no WP API; standard uninstall pattern.
    20 $wpdb->query(
    21         $wpdb->prepare(
    22                 "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s",
    23                 '_transient_yuracode-security_%',
    24                 '_transient_timeout_yuracode-security_%'
    25         )
    26 );
     19// Settings and transients live per site, so sweep every site of the
     20// network; on a single-site install this is one plain pass.
     21$site_ids = is_multisite() ? get_sites( array( 'fields' => 'ids', 'number' => 0 ) ) : array( null );
     22
     23foreach ( $site_ids as $site_id ) {
     24        if ( null !== $site_id ) {
     25                switch_to_blog( (int) $site_id );
     26        }
     27
     28        delete_option( 'yuracode-security_settings' );
     29
     30        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- clearing transients by prefix has no WP API; standard uninstall pattern.
     31        $wpdb->query(
     32                $wpdb->prepare(
     33                        "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s",
     34                        '_transient_yuracode-security_%',
     35                        '_transient_timeout_yuracode-security_%'
     36                )
     37        );
     38
     39        if ( null !== $site_id ) {
     40                restore_current_blog();
     41        }
     42}
Note: See TracChangeset for help on using the changeset viewer.