Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Remove last error check #4941

Merged
merged 2 commits into from Apr 21, 2022

Conversation

engahmeds3ed
Copy link
Contributor

Description

Here

$error = error_get_last();
// Delete the transient when any error happens.
if ( null !== $error ) {
delete_transient( 'rocket_rucss_as_tables_count' );
return;
}

we used this check to delete the transient that has the number of Action Scheduler's tables not to make this query with each init but now disabled this caching in admin side so no need to use this code.

Also @vmanthos told me today the following (Many thanks Boss):

I've seen at least two tickets where no used CSS was generated because there was some kind of error: Constant WP_CACHE already defined

So with any error in the log, we are bailing out there and this may lead the CRON JOB not to be scheduled especially when the customer has php8 so many errors are in the log.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves an existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  1. Define WP_CACHE twice into wp-config.php before enabling RUCSS
  2. Enable RUCSS
  3. Check the CRON JOB if it's scheduled or not inside action scheduler tools page

Checklist:

Please delete the options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@engahmeds3ed engahmeds3ed self-assigned this Apr 18, 2022
@engahmeds3ed
Copy link
Contributor Author

Here also I changed the way we detect missing Action Scheduler tables to use try catch instead of adding our code in a callback for the hook shutdown.

Copy link

@Mai-Saad Mai-Saad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected with both update/fresh install when wp_cache defines twice or using PHP 8.1+, and when actions table is deleted but this fix exists on current branch

@engahmeds3ed engahmeds3ed changed the base branch from develop to release/3.11.0.5 April 20, 2022 21:21
@engahmeds3ed engahmeds3ed merged commit e219e90 into release/3.11.0.5 Apr 21, 2022
@engahmeds3ed engahmeds3ed deleted the fix/remove_last_error_check branch April 21, 2022 11:25
@engahmeds3ed engahmeds3ed mentioned this pull request Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants