Commit Graph

515 Commits

Author SHA1 Message Date
Andy Skelton 3e5ce05d86
Faster foreign key check when installing/upgrading
Using WooCommerce on a multisite network using the hyperdb drop-in, the foreign key check fails although there is a foreign key.

32037e37dd/includes/class-wc-install.php (L745-L763)

The first problem is that hyperdb wasn't designed to route `information_schema` queries. After patching hyperdb, the query is routed to the correct database.

The second problem is that the query still finds zero foreign keys because `$wpdb->dbname` is blank when the query is generated. Hyperdb only has a dbname in the context of a query being executed; hyperdb extracts the table name, then maps that to the correct database.

Although we could find a way to support such `information_schema` queries, they are also not preferred because they are notoriously slow. On WordPress.com they take 300ms, versus 3ms for a `SHOW CREATE TABLE` which similarly reveals the existence of the foreign key.

The proposed changes simplify the check, make it faster, and make it work with hyperdb.
2020-07-27 16:39:42 -05:00
Claudio Sanches be106af910 Added upgrade routine to sanitize all coupon codes 2020-07-27 16:50:23 -03:00
Claudio Sanches 2947700029 Removed Features settings and home screen option 2020-07-15 22:58:51 -03:00
vedanshujain 4500e86198 Shorten class and method names to reduce redundancy in naming. 2020-07-15 15:20:18 +05:30
vedanshujain 1e68ce5dc9 Move function to src for better code architecture 2020-07-14 23:31:56 +05:30
Jory Hogeveen cde1bd019b
Allow public access to get_core_capabilities()
Allow role manager plugins to get these capabilties
2020-07-08 13:44:27 +02:00
vedanshujain 50b08a75ab Show community forum link if wccom is not connected 2020-07-02 16:28:33 +05:30
Peter Fabian c35c4f1f08
Merge pull request #26395 from woocommerce/revert-26226-revert-25708-update/reserve-stock-for-checkout
Introduce a `reserved stock` class and database table to prevent race conditions during checkout
2020-06-16 11:38:10 +02:00
Paul Sealock c7ad889f93 Homescreen: add option and setting 2020-06-15 13:38:02 +12:00
vedanshujain 79e13edff0 This commit adds two changes for reserved stock functionality:
1. Use '0000-00-00 00:00:00' instead of CURRENT_TIMESTAMP as default value to support MySQL 5.6
2. Return early if DB version is less than 430 because then it would mean that required wc_reserved_stock table might not be present.
2020-06-05 19:20:06 +05:30
Vedanshu Jain b45373fe0c Revert "Revert "Introduce a `reserved stock` class and database table to prevent race conditions during checkout"" 2020-06-05 15:18:01 +05:30
vedanshujain e0de059f23 Use seperate db version to better track changes 2020-06-04 22:38:13 +05:30
vedanshujain 4fce106f14 Use `_` instead of `-` as per convention. 2020-06-04 20:33:38 +05:30
Claudio Sanches 6afbed0c14 Fixed coding standards 2020-06-01 23:55:17 -03:00
vedanshujain 440f40a976 Changed back method to private because we figured a workaround in earlier test 2020-05-26 23:59:28 +05:30
vedanshujain e89ee25f36 Better option names to properly describe their intention.
Additionally, allow an option in `verify_base_tables` to call `create_table` method. This will be useful if someone wants to fix the their database.
2020-05-26 23:26:45 +05:30
vedanshujain 418741a0b2 Add unit test for verify_base_tables function 2020-05-22 18:32:04 +05:30
vedanshujain fafa44bde0 Modified notice to also handle when REST API does not have verify tool. 2020-05-22 18:32:03 +05:30
vedanshujain 3acc03c804 Add `verify_base_db` method to check if all base tables are present.
Optionally, also adds a notice in case all db tables are not present. Returns list of tables.

Note that we only check missing tables and don't care about exact table structure because many time tables are modified by merchants to better suit their needs (indexes, collations etc).
2020-05-22 18:30:11 +05:30
Claudio Sanches dcabbcb964 Open file in binary mode 2020-05-06 23:25:33 -03:00
Claudio Sanches 39633855f3 Only fetch the uploads info and do not attempt to create the uploads directory 2020-05-06 23:21:31 -03:00
Claudio Sanches 7634f54235 Use "Options -Indexes" for redirect download method 2020-05-06 23:20:56 -03:00
Vedanshu Jain ee119e0a7e
Revert "Introduce a `reserved stock` class and database table to prevent race conditions during checkout" 2020-04-21 15:37:21 +05:30
Vedanshu Jain 3bf473517d
Merge pull request #25708 from woocommerce/update/reserve-stock-for-checkout
Introduce a `reserved stock` class and database table to prevent race conditions during checkout
2020-04-07 02:16:22 +05:30
Vedanshu Jain a8d60a8864
Merge pull request #25856 from woocommerce/fix-reset-action-scheduler-db-update-routine
Fix minor inconsistencies in the WC 4.0 database update routines
2020-04-06 18:07:39 +05:30
Mike Jolley 62e099bd84 Add table schema 2020-04-03 15:55:15 +01:00
Jeff Stieler 6a8d8b27d9
Fix missing notes table on 4.0.0 upgrade. (#25891)
* Don't attempt to create a WC-Admin note before the tables exist.
2020-03-13 12:20:41 -06:00
Rodrigo Primo f32c062739 The db update routine that updates the db version should be the last one
This commit simply changes the order of the database update callbacks
for WC 4.0 to make sure that wc_update_400_db_version is the last one.
2020-03-10 09:31:45 -03:00
Rodrigo Primo cd75870267 Add the wc_update_400_ prefix to db update routine
The db update routine that resets action scheduler migration status was
missing the wc_update_400_ prefix. Doing this for the sake of
consistency.
2020-03-10 09:27:30 -03:00
vedanshujain 4b3977868b Display only wc-admin notices when enabled to avoid duplicate notices 2020-03-05 16:53:10 +05:30
Peter Fabian 7fdee5b03e
Merge pull request #25707 from woocommerce/fix/as-460
Mark AS migration pending when updating WC to ensure migration happens.
2020-02-25 22:03:45 +01:00
Peter Fabian 63486a1cb0 Force the saving of notices for the 'install' notice to prevent performance problems for all notices, while also making it less prone to race conditions during the installation. 2020-02-25 15:00:37 +01:00
Peter Fabian 992c6538dc Force the saving of notices only for the 'update' notice to prevent performance problems. 2020-02-25 14:58:02 +01:00
Peter Fabian 7ec65a1b35 Added the WC Admin enabled db update notice. 2020-02-23 21:59:03 +01:00
vedanshujain 90ab985cfb Mark AS migration pending when updating WC to ensure migration happens.
Ideally https://github.com/woocommerce/action-scheduler/pull/470 should take care of this issue, but since we have AS 3.x in the wild without fix in the PR, this change is also necessary.
2020-02-19 18:19:11 +05:30
Peter Fabian 5fc2e8fba9 Only skip the store_notices during new install in AS. 2020-02-07 11:06:35 +01:00
Jeff Stieler 3cf9d76ed4 Fix wc_admin_daily event schedule persistence.
Avoid an option update race condition.
2020-02-04 16:04:27 -08:00
Christopher Allford 57734ca8ce Merge branch 'master' into refactor/add-jetpack-constants 2020-02-04 14:36:35 -08:00
Rohan V e2cb1dea73
Fix codestyle 2020-02-04 19:44:05 +05:30
Rohan Vakharia 4be33acd66
Merge branch 'master' into master 2020-02-04 19:23:22 +05:30
Peter Fabian 7a24aaecd5 Updated versions to 4.0. 2020-02-03 23:36:52 +01:00
Christopher Allford 6ad091a9b7 Changed all of the constant accesses into corresponding Automattic\Jetpack\Constants usages 2020-01-28 21:21:29 -08:00
Mike Jolley 2638879bdc Add columns to schema and update routine 2020-01-20 14:21:42 +00:00
Christopher Allford 2b503e0409 Changed the MaxMind database update process to move the existing archive instead of deleting it 2020-01-15 10:24:13 -08:00
Christopher Allford c34a5b6ffe Added an update task to increase the database version 2020-01-14 13:39:47 -08:00
Christopher Allford e851160927 Removed the erroneous space on the woocommerce_geoip_updater scheduled event 2020-01-14 13:20:41 -08:00
Christopher Allford b577b8a386 Changed the geoip update cron to run every 15 days to better comply with MaxMind's TOS 2020-01-13 17:02:41 -08:00
Christopher Allford ef0eccf0ac Added upgrade step for removing the legacy MaxMind database 2020-01-13 11:18:14 -08:00
Christopher Allford 02ee3f695e Moved the database update from the WC_Geolocation class to the MaxMind-specific integration 2020-01-09 23:22:42 -08:00
Rohan V 83c88e47a5
Add fix to increase column size for existing installations 2019-12-18 13:24:18 +05:30
Rohan V 2541786ef5
Increase field size for new installation 2019-12-18 12:49:32 +05:30
Claudio Sanches 08d301779b Set max index length for slug in tax class table 2019-07-09 17:59:16 -03:00
Claudio Sanches b178f1be1f Set initial tax classes 2019-07-09 15:13:02 -03:00
Claudio Sanches 1425b0c3b6 Crate tables before create options 2019-07-09 15:12:34 -03:00
Claudio Sanches 958a970255 Include missing wc_tax_rate_classes in WC_Install::get_tables 2019-07-09 15:02:07 -03:00
Claudio Sanches db06d3dbae Merge branch 'master' into update/22164-tax-rate-class-table 2019-07-08 18:12:23 -03:00
Claudio Sanches a4b8184464
Merge pull request #23950 from parmarhardip/fix-23944
Currency changes applied for 'São Tomé and Príncipe dobra' and 'Mauritanian ouguiya'
2019-07-08 16:12:53 -03:00
MD0123-Hardip 530d53c428 added new 370 function for currency updater. 2019-06-25 15:17:16 +05:30
Claudio Sanches d17b96646c Fixed database update tool, fixing System Status, REST API and CLI 2019-06-19 17:19:13 -03:00
Mike Jolley f113d26e44 Update routine 2019-03-20 15:27:43 +00:00
Mike Jolley 5d1020300e wc_tax_rate_classes table 2019-03-20 14:19:11 +00:00
Gerhard 778245bc43 Revert test 2019-03-20 16:06:11 +02:00
Gerhard 4edd63fedf usort not uasort 2019-03-20 14:06:13 +02:00
Gerhard fb0e2db448 Keep track of version numbers in seperate variable before sorting it 2019-03-20 14:05:12 +02:00
Gerhard 6234b7bd13 uasort does not return a value but instead works by reference. 2019-03-20 14:00:26 +02:00
Gerhard b97e780b0b Use version_compare for finding the latest version and not max as it is not string friendly. 2019-03-20 13:56:57 +02:00
Mike Jolley 520c517410
Merge pull request #23019 from woocommerce/update/onsale-lookup
onsale lookup table
2019-03-14 11:10:35 +00:00
Mike Jolley 6995e6ec84
Merge pull request #22981 from woocommerce/update/22976
Updating geolocation download to avoid wp_upload_dir and direct filesystem access
2019-03-13 17:41:54 +00:00
Mike Jolley 53896e3149 onsale lookup 2019-03-13 17:14:20 +00:00
Mike Jolley 20d7603dd6 Merge branch 'fix/21034' 2019-03-12 13:47:08 +00:00
Mike Jolley 4ab3cc2204 Merge branch 'update/21017' 2019-03-12 13:45:48 +00:00
Mike Jolley 638812cdd3
Merge pull request #22904 from woocommerce/update/20577
Updates - Docs and ActionScheduler implementation
2019-03-12 13:21:48 +00:00
Mike Jolley b71a7ac4ee Stray 1 2019-03-11 10:29:14 +00:00
Mike Jolley 87bce1f4a2 Reduce inital delay for geo data 2019-03-08 18:20:31 +00:00
Mike Jolley ddb134fe45 Redirection improvements 2019-03-08 15:11:23 +00:00
Mike Jolley a3c2dcd8f2 Update from master 2019-03-08 09:50:56 +00:00
Mike Jolley 663f724bdd Cleanup methods 2019-03-07 15:08:22 +00:00
Mike Jolley 3173167e7e Update indexes 2019-03-07 14:47:46 +00:00
Mike Jolley 0782d39a55 Stock status 2019-03-07 14:32:20 +00:00
Mike Jolley 1ab455ec09 virtual and downloadable 2019-03-07 14:07:51 +00:00
Mike Jolley dfc539c051 SKU column 2019-03-07 13:34:28 +00:00
Mike Jolley a697c97472 Add rating_count to lookup table 2019-03-06 14:03:44 +00:00
Mike Jolley 16a0a3e27e Update from master 2019-03-05 19:03:01 +00:00
Mike Jolley d03f5d4373 Index by ID and cache 2019-03-05 16:49:45 +00:00
Gerhard Potgieter 5a6cc36fce
Merge branch 'master' into experiment/product-sorting-index 2019-03-05 14:04:11 +02:00
Mike Jolley 5af9d968e5 Update from master 2019-03-01 10:29:17 +00:00
Mike Jolley d407581618 Update types of decimal fields 2019-02-28 14:01:13 +00:00
Gerhard b8a5a9ec55 Add update routine to add user_order_remaining_expires index and hook it up to the installer for 3.6.0 2019-02-28 15:36:55 +02:00
Gerhard 207a5ef4b3 Add user_order_remaining_expires index to woocommerce_downloadable_product_permissions create table statement. 2019-02-28 15:30:17 +02:00
Mike Jolley 9948c63185 Revise index 2019-02-28 13:12:12 +00:00
Mike Jolley b903086251 Fix callbacks and remove logging 2019-02-28 11:52:56 +00:00
Mike Jolley d59b1c39d7 Remove force link - it can be done in AS 2019-02-28 11:15:58 +00:00
Mike Jolley d990b5192f Switch to action scheduler 2019-02-28 11:11:08 +00:00
Gerhard 3dde01570a Remove wp_clear_scheduled_hook for the plugin and theme background installer that does not run via cron anymore. 2019-02-26 12:44:27 +02:00
Gerhard 1e21ebe367 Remove the callbacks only 2019-02-26 12:25:12 +02:00
Gerhard ccbb8313b6 Revert "Remove old hooks for woocommerce_theme_background_installer and woocommerce_plugin_background_installer. There are no scheduled events for these anymore and the Wizard has it's own theme/plugin installer that uses the shutdown hook instead of cron."
This reverts commit 0f771bf4fe.
2019-02-26 12:24:56 +02:00
Gerhard 0f771bf4fe Remove old hooks for woocommerce_theme_background_installer and woocommerce_plugin_background_installer. There are no scheduled events for these anymore and the Wizard has it's own theme/plugin installer that uses the shutdown hook instead of cron. 2019-02-21 12:50:12 +02:00
Mike Jolley 35d2161fa9 Stock lookup 2019-02-15 13:05:46 +00:00
Mike Jolley 3309276e82 Renamed table to wc_product_meta_lookup 2019-02-15 12:37:45 +00:00
Mike Jolley 08e8c76eab Update tests 2019-02-15 12:16:59 +00:00