This commit reverts commits 2f8a3eae49 and 17e97c2580 that were created to defer transient cleanup (see #20537) and avoid deadlocks on the wp_options table (see #20528 and #17632). The problem is that deferring transient cleanup to a cron job created an issue when creating or importing multiple products at once (see #21100 and https://github.com/woocommerce/wc-smooth-generator/issues/14#issuecomment-413342136) and has the potential to impact the checkout as well if we start using more versioned transients for orders.
This problem is happening because when importing or creating multiple products at once, for each product that is created or imported, WooCommerce core enqueues a few 'delete_version_transients' cron events. Events are enqueued faster than they are executed and after a few hundred products are generated, the size of the cron queue, which is stored in a single wp_options entry, starts to impact WordPress performance in general.
To reduce the chance of deadlocks happening again after this change, I already created another PR to optimize the query used to delete transients (#21274) by avoiding an unnecessary filesort, and I'm planning, on a subsequent commit, to improve it further by prefixing the transient name with its version instead of suffixing it as it is currently done. But the ultimate solution for high traffic stores is to use a persistent cache plugin.
Ability to define a cache version only based on country, and not a region, city, etc.
Improve website performance by decreasing the number of different versions.
In my case, i was able to define v=[country_code] which is more URL friendly.
This commit removes the `ORDER BY option_id` part of the query to remove the version transients from the `wp_options` table. This change should help users having performance issues with this query (see for example #21215) and, as far as I can see, ordering is not necessary in this context.
Removing the `ORDER BY` from the query means that MySQL won't have to use filesort:
```
MySQL [wccore]> explain DELETE FROM wp_options WHERE option_name LIKE '\\_transient\\_%1510258328' ORDER BY option_id LIMIT 1000;
+----+-------------+------------+------------+-------+---------------+-------------+---------+-------+------+----------+-----------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------+------------+-------+---------------+-------------+---------+-------+------+----------+-----------------------------+
| 1 | DELETE | wp_options | NULL | range | option_name | option_name | 766 | const | 67 | 100.00 | Using where; Using filesort |
+----+-------------+------------+------------+-------+---------------+-------------+---------+-------+------+----------+-----------------------------+
1 row in set (0.02 sec)
MySQL [wccore]> explain DELETE FROM wp_options WHERE option_name LIKE '\\_transient\\_%1510258328' LIMIT 1000;
+----+-------------+------------+------------+-------+---------------+-------------+---------+-------+------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------+------------+-------+---------------+-------------+---------+-------+------+----------+-------------+
| 1 | DELETE | wp_options | NULL | range | option_name | option_name | 766 | const | 67 | 100.00 | Using where |
+----+-------------+------------+------------+-------+---------------+-------------+---------+-------+------+----------+-------------+
1 row in set (0.00 sec)
```
Third-party code can set the limit of transients to be deleted to 0 using the filter `woocommerce_delete_version_transients_limit`. If this happens, the code shouldn't schedule a cron event to delete more transients to avoid flooding the list of cron jobs.
Fixes#19890
* wp hook is too late to fire the nocache_headers filter, some caching plugins read it before that it seems.
* Create do_not_cache_page helper function and call that instead of nocache_headers
* Must add checks to prevent caching on certain pages as well
* Nothing to return
Wordpress function get_queried_object_id() returns conflicting IDs
for pages and product category archives which in current
implementation results in product category archives possibly not
being cached if their tag ID conflicts with Woocommerce's special
page IDs - cart, checkout, etc.
Let's switch to implementation using is_page() to address this.
If is_blog_installed() is false then skip some installation steps that
are performed on the 'init' action and which require the database to be
available
* i18n: Remove some HTML tags from translation strings
* i18n: simpler translation string
* i18n: translations strings with surrounding `<strong>` HTML tags should be moved outside the translation string
* i18n: Avoide using `<code>' HTML tags in translation strings
* i18n: Split the notice to avoide using HTML tags in translation strings