wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Error message shall be displayed to user if RUCSS failed (rucss tables arenot created)

Open Mai-Saad opened this issue 4 years ago • 16 comments

Before submitting an issue please check that you’ve completed the following steps:

  • Made sure you’re on the latest version => yes
  • Used the search feature to ensure that the bug hasn’t been reported before => yes

Describe the bug When enabling RUCSS and tables couldn't be created in DB, a failure message shall be displayed to the user

To Reproduce Precondition:

  • Enable RUCSS => resources & used CSS tables are created in database
  • Delete those tables from the database

Steps to reproduce the behavior:

  1. Disable RUCSS and save
  2. Enable RUCSS
  3. Success message is displayed although processing 0 of 0

Expected behavior An error message is displayed to the user

Screenshots If applicable, add screenshots to help explain your problem. Screenshot from 2021-05-27 20-44-36

Additional context Add any other context about the problem here.

  • uninstall then install the plugin and activate WPR currently won't create tables due to this issue https://github.com/berlindb/core/issues/108 => to fix this now, you will need to delete resources options wpr_rucss_resources_version and wpr_rucss_used_css_version
  • In debug mode currently if we recheck RUCSS after step3 => will display that fetched is done n out of n, the process is done 0 out of 0 and RUCSS is complete

Backlog Grooming (for WP Media dev team use only)

  • [ ] Reproduce the problem
  • [ ] Identify the root cause
  • [ ] Scope a solution
  • [ ] Estimate the effort

Mai-Saad avatar May 27 '21 19:05 Mai-Saad

Addressed upstream in https://github.com/berlindb/core/issues/108. 🚀

JJJ avatar May 28 '21 03:05 JJJ

Related ticket: https://secure.helpscout.net/conversation/1645065559/297803/

vmanthos avatar Sep 30 '21 09:09 vmanthos

Related ticket - https://secure.helpscout.net/conversation/1645344219/297879/

DahmaniAdame avatar Sep 30 '21 10:09 DahmaniAdame

Related - https://secure.helpscout.net/conversation/1669836026/302972?folderId=273766

DahmaniAdame avatar Nov 02 '21 10:11 DahmaniAdame

Related - https://secure.helpscout.net/conversation/1714525891/312138

DahmaniAdame avatar Dec 03 '21 12:12 DahmaniAdame

Likely related: https://secure.helpscout.net/conversation/1742526549/316557/

NataliaDrause avatar Jan 03 '22 14:01 NataliaDrause

Related - https://secure.helpscout.net/conversation/1736871992/315893/ Tables were not created because of a faulty DB_CHARSET and DB_COLLATE combo. No information was relayed to the user.

DahmaniAdame avatar Jan 26 '22 10:01 DahmaniAdame

related: https://secure.helpscout.net/conversation/1851263971/337927

alfonso100 avatar Apr 22 '22 20:04 alfonso100

related: https://secure.helpscout.net/conversation/1859348732/339059

alfonso100 avatar Apr 25 '22 19:04 alfonso100

related: https://secure.helpscout.net/conversation/1882152963/342709

alfonso100 avatar May 20 '22 13:05 alfonso100

@vmanthos @webtrainingwheels If you have any ideas for the text needed for the notices, you're welcome to share :)

GeekPress avatar Jun 29 '22 13:06 GeekPress

Reproduce the problem

I was able to reproduce this issue

Identify the root cause

We don't have a method to check and display notice when related RUCSS tables are not created.

Scope a solution

  • Import the Resource and UsedCSS Database class into WP_Rocket\Engine\Optimization\RUCSS\Admin\Settings
use WP_Rocket\Engine\Optimization\RUCSS\Database\Tables\Resources;
use WP_Rocket\Engine\Optimization\RUCSS\Database\Tables\UsedCSS;
  • Then create a method to check if the usedcss table exists
$this->rucss_usedcss_table->exists()

Then display the valid text.

Estimate the effort

[S]

jeawhanlee avatar Jul 11 '22 13:07 jeawhanlee

The following text should be fine:

WP Rocket could not create the {{names_of_tables)} in the database which is/are necessary for the Remove Unused CSS feature to work. Please reach out to our support.

@webtrainingwheels Can you please check this?

Most of the time this won't be an issue with WP Rocket, but:

  1. with the host which prevents writing to the database or
  2. the database settings, e.g. DB_COLLATE: https://wp-media.slack.com/archives/C029G1B5HD2/p1643185904044200

If @camilamadronero can write a doc, we can replace the "Please reach out to our support." with a link to that.

vmanthos avatar Jul 11 '22 13:07 vmanthos

@vmanthos Thanks for the ping and I certainly can put together a new doc! I'm following this issue to see if using a doc is the final decision. And in the meantime, the fixes mentioned in the thread are fairly technical, so I'm just wondering if those are the ones to document.

camilamadronero-zz avatar Jul 11 '22 22:07 camilamadronero-zz

One note: we don't need to check for the resources table, as it's no longer used, and is going to be removed in 3.12

remyperona avatar Jul 12 '22 13:07 remyperona

Most of the time this won't be an issue with WP Rocket, but (...)

Let's write some code together that can help your team(s) confirm that database tables can be created before the utility (BerlinDB) tries and fails in front of your users 💖

99% of the time, if WordPress was able to create its own database tables, BerlinDB and WP Rocket should be able to too. If web-hosts are known for locking something down that you/we rely on, BerlinDB should handle those gracefully, and provide useful feedback for developers to use to make decisions about how to handle those situations in their applications (like WP Rocket here! 💗)


If I may offer a suggestion about the error message specifically, it may not be best to communicate the exact reason for this failure to users, since there may not be much they can do about it themselves (other than contact you).

For example, if the Notes app in your cell phone was unable to recover from some critical database error, how would you expect your next steps to be communicated and in a way that comforts you and maintains the integrity of the software. It's a lot to consider; it's delicate, and also somewhat urgent feeling at the time.

(Hope you don't mind me lurking and chiming in. Sorry if I'm rambling or derailing anything 😅)

JJJ avatar Jul 13 '22 19:07 JJJ

Related: https://secure.helpscout.net/conversation/1992140978/364599/

joejoe04 avatar Aug 31 '22 18:08 joejoe04

related: https://secure.helpscout.net/conversation/1994145263/365089/

worldwildweb avatar Sep 01 '22 07:09 worldwildweb

Related: https://secure.helpscout.net/conversation/1992140978/364599/ The cause was something new, in this case, it was due to object cache: Further details here: https://wp-media.slack.com/archives/C029G1B5HD2/p1663255224632399

joejoe04 avatar Sep 15 '22 17:09 joejoe04