Jump to content

Fatal error when delete content of "caches" table


eangulo
 Share

Recommended Posts

Hello everyone,

Usually in many CMS database tables prefixed or suffixed with "cache" can be manually cleared without a problem because the system will populate them on the "next page request". Actually in Processwire I am expecting this behaviour:

[On PW 3.x]

  1. Manually clear table "caches" in database
  2. Go to "client" side (not in the admin panel)
  3. All references to my "/site/modules" in my template files does not work : wire("modules")->get(""), $modules->get("") and modules()->get("")
    1. PHP error:  Fatal error: Uncaught TypeError: Return value...
    2. My _init.php file are not able to find the references to my /site/modules/
  4.  The client side not working because this PHP fatal error.

If I go to the admin panel "Admin -> Modules" and I trigger the action "Check for New Modules" in the top-right corner in the page, it populates the caches table with the required information and them the client side works.

It is normal? Or I am doing something wrong ?

A solution could be to manually call the script that the button "Check for New Modules" calls, but I want to know if  I am doing something wrong here.

Thank you in advance guys ! 

Link to comment
Share on other sites

Always do backups before manually changing something in the DB.

I never touched the caches DB-table. I only delete assets/cache/ stuff from the file-system if I need to (rarely). Perhaps delete those file-caches too and it will then try to re-create all DB-caches? 

Link to comment
Share on other sites

Hi @dragan,

Yes that's a very good advice, I always do this kind of manipulation in a local environnement.

Maybe I'm comparing to much Processwire with others CMS/CMF. Maybe the "caches" table that contains the system registry entries should never be cleared manually.

(caches table system registry)

  • Modules.info
  • Modules.site/modules/ (This is the one causing the Fatal PHP error, after "caches" table is manually cleared and the system is not generating it automatically)
  • Modules.wire/modules/
  • ... and so on

If @ryan design it that way, I understand :).

But I think it would be nice, if the rebuild caches table's content script can generate the content for this one too "Modules.site/modules/".

Thank you,

  • Like 1
Link to comment
Share on other sites

Just now, eangulo said:

but I was looking for an explanation for this behaviour to explain it to my team.

I think it's an oversight that should be fixed - I think you should post a Github issue for Ryan to think about. He may not agree but I think that is the best way forward.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...