Merge pull request woocommerce/woocommerce-admin#441 from woocommerce/fix/437

Use WooCommerce's database prefix
This commit is contained in:
Peter Fabian 2018-09-21 10:01:53 +02:00 committed by GitHub
commit 0b68f52832
5 changed files with 13 additions and 13 deletions

View File

@ -191,7 +191,7 @@ class WC_Admin_Api_Init {
}
foreach ( $order->get_items() as $order_item ) {
$wpdb->replace(
$wpdb->prefix . 'wc_admin_order_product_lookup',
$wpdb->prefix . 'wc_order_product_lookup',
array(
'order_item_id' => $order_item->get_id(),
'order_id' => $order->get_id(),
@ -256,8 +256,8 @@ class WC_Admin_Api_Init {
$wc_tables,
array(
// TODO: will this work on multisite?
"{$wpdb->prefix}wc_admin_order_stats",
"{$wpdb->prefix}wc_admin_order_product_lookup",
"{$wpdb->prefix}wc_order_stats",
"{$wpdb->prefix}wc_order_product_lookup",
"{$wpdb->prefix}wc_order_tax_lookup",
"{$wpdb->prefix}wc_order_coupon_lookup",
)
@ -277,7 +277,7 @@ class WC_Admin_Api_Init {
}
$tables = "
CREATE TABLE {$wpdb->prefix}wc_admin_order_stats (
CREATE TABLE {$wpdb->prefix}wc_order_stats (
order_id bigint(20) unsigned NOT NULL,
date_created timestamp DEFAULT '0000-00-00 00:00:00' NOT NULL,
num_items_sold int(11) UNSIGNED DEFAULT 0 NOT NULL,
@ -290,7 +290,7 @@ class WC_Admin_Api_Init {
PRIMARY KEY (order_id),
KEY date_created (date_created)
) $collate;
CREATE TABLE {$wpdb->prefix}wc_admin_order_product_lookup (
CREATE TABLE {$wpdb->prefix}wc_order_product_lookup (
order_item_id BIGINT UNSIGNED NOT NULL,
order_id BIGINT UNSIGNED NOT NULL,
product_id BIGINT UNSIGNED NOT NULL,

View File

@ -19,7 +19,7 @@ class WC_Admin_Reports_Categories_Data_Store extends WC_Admin_Reports_Data_Store
*
* @var string
*/
const TABLE_NAME = 'wc_admin_order_product_lookup';
const TABLE_NAME = 'wc_order_product_lookup';
/**
* Order by setting used for sorting categories data.

View File

@ -23,12 +23,12 @@ class WC_Admin_Reports_Orders_Data_Store extends WC_Admin_Reports_Data_Store imp
*
* @var string
*/
const TABLE_NAME = 'wc_admin_order_stats';
const TABLE_NAME = 'wc_order_stats';
/**
* Cron event name.
*/
const CRON_EVENT = 'wc_admin_order_stats_update';
const CRON_EVENT = 'wc_order_stats_update';
protected $column_types = array(
'orders_count' => 'intval',
@ -170,11 +170,11 @@ class WC_Admin_Reports_Orders_Data_Store extends WC_Admin_Reports_Data_Store imp
$where_clause .= " AND {$orders_stats_table}.order_id IN (
SELECT
DISTINCT {$wpdb->prefix}wc_admin_order_product_lookup.order_id
DISTINCT {$wpdb->prefix}wc_order_product_lookup.order_id
FROM
{$wpdb->prefix}wc_admin_order_product_lookup
{$wpdb->prefix}wc_order_product_lookup
WHERE
{$wpdb->prefix}wc_admin_order_product_lookup.product_id IN ({$allowed_products_str})
{$wpdb->prefix}wc_order_product_lookup.product_id IN ({$allowed_products_str})
)";
}

View File

@ -18,7 +18,7 @@ class WC_Admin_Reports_Products_Data_Store extends WC_Admin_Reports_Data_Store i
*
* @var string
*/
const TABLE_NAME = 'wc_admin_order_product_lookup';
const TABLE_NAME = 'wc_order_product_lookup';
/**
* Mapping columns to data type to return correct response types.

View File

@ -17,7 +17,7 @@ function wc_admin_order_product_lookup_entry( $order_id ) {
foreach ( $order->get_items() as $order_item ) {
$wpdb->replace(
$wpdb->prefix . 'wc_admin_order_product_lookup',
$wpdb->prefix . 'wc_order_product_lookup',
array(
'order_item_id' => $order_item->get_id(),
'order_id' => $order->get_id(),