Commit Graph

124 Commits

Author SHA1 Message Date
Rodrigo Primo a91bc5b1ec phpcs fixes using phpcbf 2018-12-04 16:04:24 -02:00
Rodrigo Primo 24fd6f89c6 Merge branch 'master' into phpcs-wp-db 2018-12-04 15:39:19 -02:00
Rodrigo Primo 6ec2b26972 Update WordPress.DB.PreparedSQL.NotPrepared sniff name
The latest version of WPCS that was added to WC last week, changed the name of some sniffs. This commit updates the name of one of those sniffs from WordPress.WP.PreparedSQL.NotPrepared to WordPress.DB.PreparedSQL.NotPrepared.
2018-11-23 15:10:52 -02:00
Rodrigo Primo 57f44798cb Fix phpcs violations automatically using phpcbf 2018-11-23 12:57:51 -02:00
Gerhard 92e9f2811b Make the wc_download_log FK use table prefix for cases where multiple single install tables are used in the same DB. 2018-11-16 08:18:25 +02:00
Rodrigo Primo ece9f02776 Revert "First pass at using post_author instead of the post meta '_customer_user'"
This reverts commit 61c7abce4f.
2018-10-29 11:48:44 -03:00
Rodrigo Primo be4132e228 Revert "Set post_author to 0 for refund orders"
This reverts commit ad4304450d.
2018-10-29 11:47:00 -03:00
Rodrigo Primo 487ac201c0 Revert "Bump WC version to 3.4.0"
This reverts commit 7f43c39f2f.
2018-10-29 11:44:32 -03:00
Rodrigo Primo 8d80d1417c Revert "Add filter to list of post_types used to build the query to copy _customer_user to post_author"
This reverts commit 1f39f7d633.
2018-10-29 11:42:51 -03:00
Rodrigo Primo 1051b3fbeb Revert "Reposition wc_update_340_order_customer_id() function"
This reverts commit 35998e56cb.
2018-10-29 11:42:25 -03:00
Rodrigo Primo 911df7806f Revert "Migrate _customer_user to post_author in batches"
This reverts commit 4123cc6f7d.
2018-10-29 11:37:54 -03:00
Rodrigo Primo 1d9ab63134 Revert "Punt to WC version 3.5.0"
This reverts commit ccf10f6ab2.
2018-10-29 11:37:24 -03:00
Rodrigo Primo 3374ec7a74 Revert "Migrate data to post_author in a single go when using WP-CLI"
This reverts commit e02f3fbec4.
2018-10-29 11:25:55 -03:00
Rodrigo Primo ee6e0a345e Revert "Monitor only memory limit while running the data migration"
This reverts commit 923eeb2e43.
2018-10-29 11:19:52 -03:00
Rodrigo Primo ad31742ba1 Revert "Cache query to get the list of orders placed by the user ID 1"
This reverts commit 697421a9fa.
2018-10-29 11:17:39 -03:00
Rodrigo Primo 61045ecb6f Revert "Fix indentation"
This reverts commit 397e40f165.
2018-10-29 11:07:05 -03:00
Rodrigo Primo 0258f43589 Revert "Add @return for wc_update_350_order_customer_id() docblock"
This reverts commit 5c5cddf26a.
2018-10-29 11:06:15 -03:00
Rodrigo Primo 41d2e1cafd Change wp_woocommerce_sessions before dbDelta() is called
On PR #21245, I added a db update routine to change wp_woocommerce_sessions primary key from session_key char(32) to session_id bigint auto_increment as dbDelta() is unable to handle primary key changes (see https://core.trac.wordpress.org/ticket/40357). But I didn't realize that dbDelta() was actually trying to add a new primary key to the table without droping the old key first and this was generating the following error:

```
WordPress database error Multiple primary key defined for query ALTER TABLE wp_woocommerce_sessions ADD PRIMARY KEY  (`session_id`)
```

To prevent this error from happening, this commit moves the query that changes the primary key from db update routine to WC_Install::create_tables() so that it runs before dbDelta() is called.
2018-10-17 12:11:01 -03:00
Rodrigo Primo 0c77ea584b Revert "Do not try and create primary key using upgrade routine, dbdelta does that automatically. Just drop the key if it exists and add a new unique key."
This reverts commit d3e59b770b.
2018-10-17 11:20:39 -03:00
Rodrigo Primo 35bd8ba05d Revert "Do check on new key field instead and only run alter when not found."
This reverts commit a41df43cb0.
2018-10-17 11:20:27 -03:00
Gerhard a41df43cb0 Do check on new key field instead and only run alter when not found. 2018-10-15 14:13:21 +02:00
Gerhard d3e59b770b Do not try and create primary key using upgrade routine, dbdelta does that automatically. Just drop the key if it exists and add a new unique key. 2018-10-15 14:07:48 +02:00
Claudio Sanches 61f988db63
Merge branch 'master' into fix/product-review-type 2018-09-25 12:35:41 -03:00
claudiulodro d7afce5f4c Update routine to set reviews comment type 2018-09-20 09:28:39 -07:00
Rodrigo Primo 2740a686dc Change wp_woocommerce_sessions primary key
This commit changes wp_woocommerce_sessions primary key to the bigint field session_id. Before it was the char(32) field session_key. Doing this change primarily as it should reduce the occurrence of deadlocks, but also because it is not a good practice to use a char(32) field as the primary key of a table.
2018-08-31 16:56:30 -03:00
Rodrigo Primo bfebd30565
Merge pull request #20726 from itowhid06/master
Convert  hardcoded db prefix to dynamic db prefix. Fixes #20718
2018-07-16 14:21:45 -03:00
Gerhard Potgieter 36b6bd79c0 Add update routines to recreate user roles 2018-07-10 10:30:11 +02:00
Towhidul Islam 7a957cc130 Convert hardcoded db prefix to dynamic db prefix. Fixes #20718 2018-07-08 10:35:32 +06:00
Rodrigo Primo 5c5cddf26a Add @return for wc_update_350_order_customer_id() docblock 2018-06-18 15:17:39 -03:00
Rodrigo Primo 43d22a2349 Merge branch 'master' into update/use-post-author-for-customer-id 2018-06-18 15:17:19 -03:00
Gerhard Potgieter 36d1c318cb Download Log FK Contraint check (#20478)
This PR introduces a check on the permission_id FK to ensure that it is not added multiple times on upgrades. It also names the key specifically to ensure future changes to the key can be targeted properly and removes old keys that were added since 3.4.0.

* Add FK check before adding the FK. Also give the FK a name to avoid auto generated names and duplicate keys.

* Remove additional OR

* Remove additional OR

* Final FK check query

* Add foreign key cleanup routine to 3.4.3 db version

* Only check on named foreign key now that we have a cleanup routine in place, use specific phpcignore

* Rework formatting of SQL query

* Change way to fetch and add FK, can't use procedural SQL, needs to be done via statements.

* Add table name to lookup

* Only clean up FK on the wc_download_log table

* Remove erenouse bracket
2018-06-18 11:47:47 -03:00
Rodrigo Primo 397e40f165 Fix indentation 2018-06-11 11:14:04 -03:00
Rodrigo Primo f1f49bb27a Add WC 3.5.0 DB version update callback 2018-06-11 10:54:02 -03:00
Rodrigo Primo dd8bf8b522 Merge branch 'master' into update/use-post-author-for-customer-id 2018-06-11 10:44:14 -03:00
Mike Jolley 048b95e135 Correct code to run again 2018-05-25 16:36:07 +01:00
Mike Jolley 083c994732 Break up update routine and allow it run to multuple times 2018-05-25 14:18:19 +01:00
Rodrigo Primo c49059ce7a Merge branch 'master' into update/use-post-author-for-customer-id 2018-05-08 17:34:09 -03:00
Mike Jolley 250b7aecd5 Update function to set last active 2018-05-01 14:13:38 +01:00
Rodrigo Primo 697421a9fa Cache query to get the list of orders placed by the user ID 1 2018-04-19 10:14:02 -03:00
Rodrigo Primo 923eeb2e43 Monitor only memory limit while running the data migration
Turns out WP_Background_Process uses an arbitrary value of 20 seconds of wall clock time to measure PHP "time limit" (b0617a13c4/includes/libraries/wp-background-process.php (L385)) instead of cpu time which apparently it is not easy to measure in PHP. Since system calls (like database calls) are not included in the PHP maximum execution time, 20 seconds of wall clock is often way less than PHP time limit.

Thus, this commit removes the call to WP_Background_Process::time_exceeded() while running the function to migrate the post meta _customer_user to the field post_author. If the script times out, WP_Background_Process will restart it.
2018-04-17 16:07:18 -03:00
Rodrigo Primo e02f3fbec4 Migrate data to post_author in a single go when using WP-CLI 2018-04-17 16:07:11 -03:00
Mike Jolley ba3da2fc1f Use original code 2018-04-17 16:18:14 +01:00
Mike Jolley 9b043868e9 Update routine 2018-04-17 16:13:44 +01:00
Rodrigo Primo ccf10f6ab2 Punt to WC version 3.5.0 2018-04-17 11:12:46 -03:00
Rodrigo Primo 4123cc6f7d Migrate _customer_user to post_author in batches
This will make the update slower but safer when running in cheap servers.
2018-04-16 11:15:42 -03:00
Rodrigo Primo 35998e56cb Reposition wc_update_340_order_customer_id() function
So that it is listed together with WC 3.3 update functions
2018-04-11 15:23:12 -03:00
Rodrigo Primo 36ca6ef901 Merge branch 'master' into update/use-post-author-for-customer-id 2018-04-11 15:19:58 -03:00
Peter Fabian a3d6dc1775 Changed county codes for Ireland according to ISO 2018-04-09 23:15:09 +02:00
Rodrigo Primo a7d2c5dd6e Merge branch 'master' into update/use-post-author-for-customer-id 2018-04-03 15:13:07 -03:00
Claudio Sanches a597ba3b84 Use short ABSPATH check 2018-03-08 18:31:01 -03:00