<?php if (!defined('WP_UNINSTALL_PLUGIN') && !defined('WP_CLI')) { exit; } if (!defined('WC1C_PLUGIN_DIR')) { define('WC1C_PLUGIN_DIR', __DIR__ . '/'); } if (!defined('WC1C_DATA_DIR')) { $upload_dir = wp_upload_dir(); define('WC1C_DATA_DIR', "{$upload_dir['basedir']}/woocommerce-1c/"); } require WC1C_PLUGIN_DIR . "exchange.php"; wc1c_disable_time_limit(); global $wpdb; if (is_dir(WC1C_DATA_DIR)) { $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(WC1C_DATA_DIR, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST); foreach ($iterator as $path => $item) { $item->isDir() ? rmdir($path) : unlink($path); } rmdir(WC1C_DATA_DIR); } // $term_meta_keys = $wpdb->get_col("SELECT DISTINCT meta_key FROM $wpdb->termmeta WHERE meta_key LIKE 'wc1c_%'"); // if ($term_meta_keys) { // foreach ($term_meta_keys as $term_meta_key) { // delete_woocommerce_term_meta(null, $term_meta_key, null, true); // } // } // // $option_names = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE 'wc1c_%'"); // foreach ($option_names as $option_name) {
function wc1c_set_transaction_mode() { global $wpdb, $wc1c_is_transaction; wc1c_disable_time_limit(); register_shutdown_function('wc1c_transaction_shutdown_function'); $wpdb->show_errors(false); $wc1c_is_transaction = true; $wpdb->query("START TRANSACTION"); wc1c_check_wpdb_error(); }