'ids', 'number' => 0, ) ) as $site_id ) { switch_to_blog( (int) $site_id ); self::uninstall_site(); restore_current_blog(); } } /** * Clean the current site. */ private static function uninstall_site(): void { Capabilities::revoke(); if ( ! self::opted_in() ) { return; } foreach ( array_merge( self::OPTIONS, array( 'adafwc_delete_data_on_uninstall' ) ) as $option ) { delete_option( $option ); } } /** * Whether this site's owner asked for the data to go, as Agent * Firewall reads its switch: exactly "1". */ private static function opted_in(): bool { foreach ( self::OPT_IN as $option ) { if ( '1' === (string) get_option( $option, '' ) ) { return true; } } return false; } }