3, 'blocking' => false, 'headers' => array( 'Content-Type' => 'application/json', 'X-ZC-Site' => (string) $zeroconfig_opts['site_id'], 'Authorization' => 'Bearer ' . $zeroconfig_opts['site_token'], ), 'body' => '{}', ) ); } // The ownership check's one-time code, if a registration was still pending. if ( is_array( $zeroconfig_opts ) && ! empty( $zeroconfig_opts['pending_reg']['challenge'] ) ) { delete_transient( 'zeroconfig_verify_' . md5( (string) $zeroconfig_opts['pending_reg']['challenge'] ) ); } delete_option( 'zeroconfig' ); delete_option( 'zeroconfig_edge_last' ); delete_option( 'zeroconfig_upstream_queue' ); delete_option( 'zeroconfig_health' ); delete_option( 'zeroconfig_purge_gen' ); global $wpdb; $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'zeroconfig\_lock\_%'" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- every lock row, whatever its name, once at uninstall foreach ( array( 'zeroconfig_edge', 'zeroconfig_activation_redirect', 'zeroconfig_disable_cleaned', 'zeroconfig_gc_lock', 'zeroconfig_dropin_retry', 'zeroconfig_issue_url' ) as $zeroconfig_transient ) { delete_transient( $zeroconfig_transient ); } foreach ( array( 'zeroconfig_heartbeat', 'zeroconfig_critical', 'zeroconfig_gc', 'zeroconfig_selftest', 'zeroconfig_selftest_poll', 'zeroconfig_deferred_purge', 'zeroconfig_upstream_purge', 'zeroconfig_warm', 'zeroconfig_edge_check', 'zeroconfig_claim' ) as $zeroconfig_hook ) { wp_unschedule_hook( $zeroconfig_hook ); } $zeroconfig_dir = WP_CONTENT_DIR . '/cache/zeroconfig'; // phpcs:disable WordPress.WP.AlternativeFunctions.file_system_operations_rmdir -- empties and removes our own cache folder once, at uninstall. if ( is_dir( $zeroconfig_dir ) ) { try { $zeroconfig_it = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $zeroconfig_dir, FilesystemIterator::SKIP_DOTS ), RecursiveIteratorIterator::CHILD_FIRST ); foreach ( $zeroconfig_it as $zeroconfig_f ) { if ( $zeroconfig_f->isDir() ) { rmdir( $zeroconfig_f->getPathname() ); } else { wp_delete_file( $zeroconfig_f->getPathname() ); } } rmdir( $zeroconfig_dir ); } catch ( Exception $zeroconfig_e ) { // A folder we cannot read: leave what is left rather than stop the uninstall. unset( $zeroconfig_e ); } } $zeroconfig_dropin = WP_CONTENT_DIR . '/advanced-cache.php'; if ( is_file( WP_CONTENT_DIR . '/advanced-cache.php' ) && false !== strpos( (string) file_get_contents( WP_CONTENT_DIR . '/advanced-cache.php' ), 'ZEROCONFIG_DROPIN' ) ) { wp_delete_file( $zeroconfig_dropin ); }