Support » Plugin: Asset CleanUp: Page Speed Booster » There has been a critical error on your website. Please check your admin email

  • Resolved vishwajeet

    (@vishwajeetyadavpatil)


    Hi,

    I tried the first time this plugin and it increased score very effectively. I have an issue though when configured plugin as per my need, whenever I try to change some settings and click update settings the site is showing the error message “There has been a critical error on your website. Please check your site admin email inbox for instructions.”
    Also, the options Disable Gutenberg CSS and Disable comments sitewide getting disabled automatically. Whenever I try to enable and it fetches the same error and next time I have to remove them from bulk changes option.

    Received following error details:

    WordPress version 5.3.2
    Current theme: Divi Child (version 4.0.6.1575023650)
    Current plugin: Asset CleanUp: Page Speed Booster (version 1.3.5.9)
    PHP version 7.2.28

    Error Details
    =============

    An error of type E_ERROR was caused in line 883 of the file
    /home/bodyone/public_html/wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/OptimizeCommon.php.
    Error message: Uncaught UnexpectedValueException:
    RecursiveDirectoryIterator::__construct(/home/bodyone/public_html/wp-content/cache/asset-cleanup//css/):
    failed to open dir: No such file or directory in
    /home/bodyone/public_html/wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/OptimizeCommon.php:883
    Stack trace:
    #0 /home/bodyone/public_html/wp-content/plugins/wp-asset-clean-up/classes/OptimiseAssets/OptimizeCommon.php(883):
    RecursiveDirectoryIterator->__construct('/home/bodyone/p...', 4096)
    #1 /home/bodyone/public_html/wp-content/plugins/wp-asset-clean-up/classes/Settings.php(560):
    WpAssetCleanUp\OptimiseAssets\OptimizeCommon::clearAllCache()
    #2 /home/bodyone/public_html/wp-content/plugins/wp-asset-clean-up/classes/Settings.php(319):
    WpAssetCleanUp\Settings->update(Array)
    #3 /home/bodyone/public_html/wp-includes/class-wp-hook.php(288):
    WpAssetCleanUp\Settings->saveSettings('')
    #4 /home/bodyone/public_html/wp-includes/class-wp-hook.php(312):
    WP_Hook->apply_filters(NULL, Array)
    #5 /home/bodyone/public_html/wp-incl

    Thanks,

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gabe Livan

    (@gabelivan)

    @vishwajeetyadavpatil thank you for reporting this error and my apologies for this inconvenience! What surprises me is that the error is related to a missing directory and what particular directory is verified if it exists or not just before RecursiveDirectoryIterator is triggered.

    The code that does the verification is the following:
    if ( ! is_dir($targetedDir) ) { continue; }
    This instructs the script to jump to the next directory (from the array) if the current checked one doesn’t exist (reference: https://plugins.trac.wordpress.org/browser/wp-asset-clean-up/tags/1.3.6.0/classes/OptimiseAssets/OptimizeCommon.php#L897)

    I have a suspicion that (based on your server’s configuration) something is funny there and RecursiveDirectoryIterator is not ignoring // (very unlikely as this wasn’t reported by anyone and it has been always working for me, but let’s assume this is an isolated case and at least we can check if replacing the // with / will fix it (the next version of the plugin won’t have two forward slashes anymore).

    If you can, please edit /classes/OptimiseAssets/OptimizeCommon.php and add the following line:
    $targetedDir = rtrim(str_replace('//', '/', $targetedDir), '/'); // clean it

    just BEFORE
    if ( ! is_dir($targetedDir) ) { continue; }

    Let me know if that fixes it! Looking forward to your reply and into fixing this for anyone having the same problem!

    Plugin Author Gabe Livan

    (@gabelivan)

    @vishwajeetyadavpatil an an extra note: please make sure the directory /wp-content/cache/asset-cleanup/css exists (it shouldn’t have been deleted by the plugin, something funny might have happened if it’s missing) and it’s writable.

    Thread Starter vishwajeet

    (@vishwajeetyadavpatil)

    Hi @gabelivan

    Thanks for the reply. I reinstalled the plugin and it is working fine now and can’t regenerate the issue to try out your solution. If it does this again, I will go through it and let you know.

    Thanks again,

    Plugin Author Gabe Livan

    (@gabelivan)

    @vishwajeetyadavpatil perhaps the directory was missing and couldn’t be re-created for some reason. Anyway, I’m glad it works now! Let me know if the issue comes up again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘There has been a critical error on your website. Please check your admin email’ is closed to new replies.