igaster/laravel-theme

Issues when cache = on

Nuranto opened this issue · 4 comments

When cache is on, the theme inheritance stops to work. I don't know why.

I saw there is a specific way of dealing with cache, is there a reason you did not use laravel's cache system ?

Hello @Nuranto,

This is not the same with laravel cache. (ie Application Cache)

This is a permanent cache of theme structure to avoid scanning folders and paths. It is the same concept with compiled blade templates, or configuration caching etc...

About your problem:

  • Did you run the theme:refresh-cache artisan command to rebuild the cache?
  • Can you provide more information? ie the problem is locating some assets, or some views on a parent theme.

Hello @igaster

  • Yes, I did launched theme:refresh-cache
  • Error is : View [index] not found. . The index view is in the herited default theme, and not in the current theme. Every other view that are in the current theme works fine. If I disable cache, it works again.
  • I've digged a bit more : the file vendor/igaster/laravel-theme/src/stubs/cache.stub is not being modified at all. I thought about some right permission issue*, but it seems it is not the case (i can touch file with php-fpm's user). My vendor dir is a symlink, but I tried to replace it with a real dir, and the bug persisted... So... I don't know...

* about this, wouldn't it better to store the cache file in storage/framework/ with other caches ? So we're quite sure the folder has the right permissions ?

I also have a problem with caching. A serious one.
My problem is present even when the cache option is set to false in config\themes.php.

I asked my friend who is a guru in PHP programming and he has concluded, that the problem is in the themes_path variable. It should not be set as null but as, for instance,
'themes_path' => resource_path('views'),. Otherwise the package loses track of the precedence as of where to check for template files first.

Still, at this moment I tried everything (including theme:refresh-cache and php artisan cache:clear' and php artisan config:clear) and in my app's local instance the app takes file from the main folder and not the theme folder (the theme is set properly, which I check with the \Theme::getSetting('cssframework')`.

Hello @UnrulyNatives, you can try to disable theme cache completely... check the themes.php config file