芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/woocommerce/uninstall.php
get_var( "SHOW TABLES LIKE '{$wpdb->prefix}woocommerce_attribute_taxonomies';" ) ) { $wc_attributes = array_filter( (array) $wpdb->get_col( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies;" ) ); } else { $wc_attributes = array(); } // Tables. WC_Install::drop_tables(); // Delete options. $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'woocommerce\_%';" ); $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'widget\_woocommerce\_%';" ); // Delete usermeta. $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'woocommerce\_%';" ); // Delete our data from the post and post meta tables, and remove any additional tables we created. $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'product', 'product_variation', 'shop_coupon', 'shop_order', 'shop_order_refund' );" ); $wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" ); $wpdb->query( "DELETE FROM {$wpdb->comments} WHERE comment_type IN ( 'order_note' );" ); $wpdb->query( "DELETE meta FROM {$wpdb->commentmeta} meta LEFT JOIN {$wpdb->comments} comments ON comments.comment_ID = meta.comment_id WHERE comments.comment_ID IS NULL;" ); foreach ( wc_get_container()->get( OrdersTableDataStore::class )->get_all_table_names() as $cot_table ) { // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared $wpdb->query( "DROP TABLE IF EXISTS {$cot_table}" ); } // Delete terms if > WP 4.2 (term splitting was added in 4.2). if ( version_compare( $wp_version, '4.2', '>=' ) ) { // Delete term taxonomies. foreach ( array( 'product_cat', 'product_tag', 'product_shipping_class', 'product_type' ) as $_taxonomy ) { $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $_taxonomy, ) ); } // Delete term attributes. foreach ( $wc_attributes as $_taxonomy ) { $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => 'pa_' . $_taxonomy, ) ); } // Delete orphan relationships. $wpdb->query( "DELETE tr FROM {$wpdb->term_relationships} tr LEFT JOIN {$wpdb->posts} posts ON posts.ID = tr.object_id WHERE posts.ID IS NULL;" ); // Delete orphan terms. $wpdb->query( "DELETE t FROM {$wpdb->terms} t LEFT JOIN {$wpdb->term_taxonomy} tt ON t.term_id = tt.term_id WHERE tt.term_id IS NULL;" ); // Delete orphan term meta. if ( ! empty( $wpdb->termmeta ) ) { $wpdb->query( "DELETE tm FROM {$wpdb->termmeta} tm LEFT JOIN {$wpdb->term_taxonomy} tt ON tm.term_id = tt.term_id WHERE tt.term_id IS NULL;" ); } } // Clear any cached data that has been removed. wp_cache_flush(); }