Skip to content
This repository was archived by the owner on Jun 15, 2022. It is now read-only.

Commit 14f5ca7

Browse files
committed
Merge branch 'fix/normalize-name' into docs/cleanup-docs-for-1.0.0
2 parents 64a6cb6 + f0e0636 commit 14f5ca7

27 files changed

+1265
-388
lines changed

.travis.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,40 @@ matrix:
1313
fast_finish: true
1414
include:
1515
- php: 7.2
16-
env: WP_VERSION=trunk WP_MULTISITE=0 RUN_PHPCS=1
16+
env: WP_VERSION=trunk WP_MULTISITE=0 WC_VERSION=latest RUN_PHPCS=1
1717
- php: 7.2
18-
env: WP_VERSION=trunk WP_MULTISITE=1
18+
env: WP_VERSION=trunk WP_MULTISITE=1 WC_VERSION=latest
1919
- php: 7.1
20-
env: WP_VERSION=latest WP_MULTISITE=0
20+
env: WP_VERSION=latest WP_MULTISITE=0 WC_VERSION=latest
21+
- php: 7.1
22+
env: WP_VERSION=latest WP_MULTISITE=0 WC_VERSION=3.2.6
2123
- php: 7.0
22-
env: WP_VERSION=latest WP_MULTISITE=0
24+
env: WP_VERSION=latest WP_MULTISITE=0 WC_VERSION=latest
2325

2426
# The following WooCommerce core test currently fails in multisite, with or without this
2527
# plugin being active:
2628
#
27-
# WC_Tests_Setup_Functions::test_wizard_in_cart_payment_gateways()
29+
# PHP 7.2, WP_VERSION=trunk WP_MULTISITE=1 WC_VERSION=latest
30+
# - WC_Tests_Setup_Functions::test_wizard_in_cart_payment_gateways()
31+
#
32+
# PHP 7.1, WP_VERSION=latest WP_MULTISITE=0 WC_VERSION=3.2.6
33+
# - WC_Tests_CRUD_Orders::test_get_billing_email
2834
allow_failures:
2935
- php: 7.2
30-
env: WP_VERSION=trunk WP_MULTISITE=1
36+
env: WP_VERSION=trunk WP_MULTISITE=1 WC_VERSION=latest
37+
- php: 7.1
38+
env: WP_VERSION=latest WP_MULTISITE=0 WC_VERSION=3.2.6
3139

3240

3341
before_script:
3442
- export PATH="$HOME/.composer/vendor/bin:$PATH"
43+
- phpenv config-rm xdebug.ini
44+
- |
45+
if [[ ${GITHUB_AUTH_TOKEN} != '' ]]; then
46+
composer config -g github-oauth.github.com $GITHUB_AUTH_TOKEN
47+
fi
3548
- bash tests/bin/install-wp-tests.sh woocommerce_test root '' localhost $WP_VERSION
49+
- bash tests/bin/set-woocommerce-version.sh $WC_VERSION
3650
- composer install --prefer-source
3751

3852
script:

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Contributing to WooCommerce Custom Order Tables
1+
# Contributing to WooCommerce Custom Orders Table
22

3-
Thank you for your interest in WooCommerce Custom Order Tables!
3+
Thank you for your interest in WooCommerce Custom Orders Table!
44

55

66
## Reporting bugs and/or suggesting new features
@@ -44,9 +44,9 @@ Once master has been updated, the release should be tagged, then `master` should
4444

4545
### Unit testing
4646

47-
WooCommerce Custom Order Tables uses [the WordPress core testing suite](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/) to provide automated tests for its functionality.
47+
WooCommerce Custom Orders Table uses [the WordPress core testing suite](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/) to provide automated tests for its functionality.
4848

49-
When submitting pull requests, please include relevant tests for your new features and bugfixes. This helps prevent regressions in future iterations of the plugin, and helps instill confidence in store owners using this to enhance their WooCommerce stores.
49+
When submitting pull requests, please include relevant tests for your new features and bug-fixes. This helps prevent regressions in future iterations of the plugin, and helps instill confidence in store owners using this to enhance their WooCommerce stores.
5050

5151
#### Test coverage
5252

README.md

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WooCommerce Order Tables
1+
# WooCommerce Custom Orders Table
22

33
[![Build Status](https://travis-ci.org/liquidweb/woocommerce-order-tables.svg?branch=fix%2Ftravis-config)](https://travis-ci.org/liquidweb/woocommerce-order-tables)
44

@@ -10,12 +10,60 @@ WooCommerce even with CRUD classes in core, still uses a custom post type for or
1010
### Here's how
1111
WooCommerce saves more than 40 custom fields per order— including those from plugins— inside the wp_postmeta table. If your store gets ~40 per day, that's 1600 rows (40 * 40) added to the postmeta table in a day.
1212

13-
In one month that number can be 48,000 new rows (1600 * 30) added to your postmeta table. The more rows in a table the longer it will take for a query to execute. WooCommerce Order Tables creates a new table for WooCommerce orders which would cut that number tremendously by making each custom field into a column so that 1 order = 1 row.
13+
In one month that number can be 48,000 new rows (1600 * 30) added to your postmeta table. The more rows in a table the longer it will take for a query to execute. WooCommerce Custom Orders Table creates a new table for WooCommerce orders which would cut that number tremendously by making each custom field into a column so that 1 order = 1 row.
1414

1515
## Installation
1616
This plugin uses a Composer autoloader. If you are working with code from the `master` branch in a development environment, the autoloader needs to be generated in order for the plugin to work. After cloning this repository, run `composer install` in the root directory of the plugin.
1717

1818
The packaged version of this plugin, which is available in [releases](https://github.com/liquidweb/WooCommerce-Order-Tables/releases), contains the autoloader. This means that end users should not need to worry about running the `composer install` command to get things working. Just grab the latest release and go, but be sure to backup your database first!
1919

20-
## How to use
21-
To be able migrate orders that are stored in the post type `shop_order` on your store, you will need to run a couple of WP-CLI commands. This plugin includes two WP-CLI commands, one is for getting how many orders have not been migrated yet into the order table `wp wc-order-table count`. The other WP-CLI command is to migrate the orders to the `woocommerce_order` database table, that command is `wp wc-order-table migrate --batch=500 --page=1`. So the default batch number of the orders to process is 1000, so you can adjust the batch number as needed.
20+
## Migrating order data
21+
22+
After installing and activating the plugin, you'll need to migrate orders from post meta into the newly-created orders table.
23+
24+
The easiest way to accomplish this is via [WP-CLI](http://wp-cli.org/), and the plugin ships with three commands to help:
25+
26+
### Counting the orders to be migrated
27+
28+
If you'd like to see the number of orders that have yet to be moved into the orders table, you can quickly retrieve this value with the `count` command:
29+
30+
```
31+
$ wp wc-order-table count
32+
```
33+
34+
### Migrate order data from post meta to the orders table
35+
36+
The `migrate` command will flatten the most common post meta values for WooCommerce orders into a flat database table, optimized for performance.
37+
38+
```
39+
$ wp wc-order-table migrate
40+
```
41+
42+
Orders are queried in batches (determined via the `--batch-size` option) in order to reduce the memory footprint of the command (e.g. "only retrieve {$size} orders at a time). Some environments may require a lower value than the default of 1000.
43+
44+
#### Options
45+
46+
<dl>
47+
<dt>batch-size</dt>
48+
<dd>The number of orders to process in each batch. Default is 1000 orders.</dd>
49+
</dl>
50+
51+
52+
### Copying data from the orders table into post meta
53+
54+
If you require the post meta fields to be present (or are removing the custom orders table plugin), you may rollback the migration at any time with the `backfill` command.
55+
56+
```
57+
$ wp wc-order-table backfill
58+
```
59+
60+
This command does the opposite of `migrate`, looping through the orders table and saving each column into the corresponding post meta key. Be aware that this may dramatically increase the size of your post meta table!
61+
62+
#### Options
63+
64+
<dl>
65+
<dt>batch-size</dt>
66+
<dd>The number of orders to process in each batch. Default is 1000 orders.</dd>
67+
<dt>batch</dt>
68+
<dd>The batch number to start from when migrating data. Default is 1.</dd>
69+
</dl>

composer.json

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,32 @@
11
{
2-
"name": "liquidweb/wc-custom-order-table",
3-
"description": "Store WooCommerce order data in a custom table.",
2+
"name": "liquidweb/woocommerce-custom-orders-table",
3+
"description": "Store WooCommerce order data in a custom table for improved performance",
44
"type": "wordpress-plugin",
5-
"license": "GPL-2.0",
6-
"require": {
7-
"php": ">=5.2",
8-
"composer/installers": "^1.4",
9-
"xrstf/composer-php52": "^1.0"
10-
},
5+
"license": "GPL-2.0-only",
6+
"repositories": [
7+
{
8+
"type": "vcs",
9+
"url": "https://github.com/liquidweb/woocommerce"
10+
}
11+
],
1112
"require-dev": {
1213
"php": "^7.0",
1314
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
1415
"wimg/php-compatibility": "^8.1",
15-
"woocommerce/woocommerce": "dev-master",
16+
"woocommerce/woocommerce": "dev-feature/more-order-tests",
1617
"woocommerce/woocommerce-sniffs": "^0.0.1",
1718
"wp-coding-standards/wpcs": "^0.14"
1819
},
19-
"autoload": {
20-
"classmap": [
21-
"includes"
22-
]
23-
},
2420
"autoload-dev": {
2521
"classmap": [
22+
"tests/test-tools",
2623
"vendor/woocommerce/woocommerce/tests/framework"
24+
],
25+
"files": [
26+
"tests/test-tools/utils.php"
2727
]
2828
},
2929
"scripts": {
30-
"post-install-cmd": [
31-
"xrstf\\Composer52\\Generator::onPostInstallCmd"
32-
],
33-
"post-update-cmd": [
34-
"xrstf\\Composer52\\Generator::onPostInstallCmd"
35-
],
36-
"post-autoload-dump": [
37-
"xrstf\\Composer52\\Generator::onPostInstallCmd"
38-
],
3930
"test-coverage": [
4031
"phpunit --testsuite=plugin --coverage-html=tests/coverage"
4132
]

composer.lock

Lines changed: 36 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)