Jump to content

Clearing System Cache breaks my theme

Recommended Posts


I've moved my installation from one server to another and if I copy the datastore and uploads from the old server to the new one everything works, but since the old site is our staging/test-installation the domain is different and things are loaded from that old domain on the live site (which gives me cors error).

So what I did was that I tried to clear the system cache and when I do that all hell breaks lose.

All CSS and JS are gone (e.g not reproduced in /uploads) and all I see is:

InvalidArgumentException:  (0)
#0 /site/system/File/File.php(326): IPS\_Image::create()
#1 /site/system/Theme/Theme.php(709): IPS\_File::create()
#2 /site/system/Theme/Theme.php(4495) : eval()'d code(14): IPS\_Theme->resource()
#3 /site/system/Theme/Theme.php(5348): IPS\Theme\css_core_global___flags_css()
#4 /site/system/Theme/Theme.php(2543): IPS\_Theme::writeCss()
#5 /site/system/Theme/Theme.php(621): IPS\_Theme->compileCss()
#6 /site/system/Dispatcher/Standard.php(63): IPS\_Theme->css()
#7 /site/system/Dispatcher/Admin.php(89): IPS\Dispatcher\_Standard::baseCss()
#8 /site/system/Dispatcher/Dispatcher.php(110): IPS\Dispatcher\_Admin->init()
#9 /site/admin/index.php(13): IPS\_Dispatcher::i()
#10 {main}

and it looks like this:


any ideas on what might go wrong with this?
My first thought was that uploads and datastore couldn't write, but when I look in there I can see that new files have been created.

I seem to get 500 error (in network tab) when I try to go to /admin.


Link to comment
Share on other sites

I do have a lot of template_<hash>-files in uploads (and some in the datastore folder as well).

The uploads folder also contains css_build_0 and whatnot. So the directories are writable.

Trying to turn on debug logging now to see if I can get a more detailed error. The uploads/logs doesn't give me any kind of error strangely enough.

Link to comment
Share on other sites

It does say this:


[[Template core/admin/global/globalTemplate is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

What does the "support tool" refer to here and is it triggerable via REST? I looked up the clearCache controller and that doesn't seem to regenerate the files again after being run (but maybe that's done when the site is loaded for the first time?). I even tried to change it so that the cache would be stored in the DB but that had no effect at all.

I edited index.php and tried to write to /uploads when I loaded the page and that worked so the application can write to the uploads folder.

Any ideas @Marc Stridgen?

Edited by Jonas Erlandsson
Link to comment
Share on other sites

  • 2 weeks later...

We've figured part of this out now.

The system cache still breaks stuff but at least it won't kill the theme anymore.
However - it does not recreate the upload-folders that keeps my images for my CMS content so I had to manually re-create that again. I can re-upload the files.

I had a monthly_2021_12 folder containing content and when I run the clear system cache that got removed and not re-created.

Can you point me in the direction where the system cache gets recreated after clearing so that I can debug it?
Now it acts as a "remove all uploaded content" to me rather than a cache clearing mechanism.

Edited by Jonas Erlandsson
Markup looked weird. Hopefully reformatted.
Link to comment
Share on other sites

The system has created them and I can upload files in the system. The system can create files so it should be able to create folders (e.g uploads is writable by the system). It still won't recreate. That's why I want to debug why things aren't recreated. As I mentioned earlier in the thread I changed the index.php file so that it would create things in the uploads folder when I load the page and that worked so files can definitely be created. We've even had 777 permissions on the uploads folder but it still won't recreate it.

Can you point me to where things are being recreated so that I know where to start debug without having to trace it manually please? I'd be happy to share my findings here so it'd be a win win for everyone.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...