Closed Fabien-Flerchinger closed 3 years ago
This one sounds like an opcache issue or autloader issue hanging on to an old reference. It should autoclear as part of a GPM update, but you can try clearing it manually: https://ma.ttias.be/how-to-clear-php-opcache
If you have the ability, a simpler solution is to restart your webserver/php-fpm.
@FabulousF @rhukster I'm having this issue too.
I'm building Grav on CI/CD, and deploying it to another server.
The build is essentially composer install --optimize-autoloader --no-dev
and some node/sass stuff relating to the theme. Nothing special. The deployment reloads apache to get rid of the opcache, and this has worked for many other applications for many years.
Everything works, apart from the Sitemap plugin crashing with error: "Class 'Grav\Plugin\Sitemap\SitemapEntry' not found"
I'm not super familiar with Grav and the way it autoloads classes, and I can't seem to figure out what's going wrong here, but it seems like an autoloader issue.
Grav seems to perform some magic here and not load classes according to the PSR4 spec.
I.e. the class in question is:
\Grav\Plugin\Sitemap\SitemapEntry
and the directory:
/user/plugins/sitemap/classes/SitemapEntry.php
I haven't tried @FabulousF's "fix" as I'm unsure why that would fix it properly.
--
Okay, I found the fix. I'm going to post this comment anyway in case it's useful for others.
--
It seems that at some point in the past, SitemapEntry.php
was named sitemapentry.php
, and something with the case-insensitive filesystem of OSX + Git went wrong. Locally it worked because I had run gpm update locally, but Git/OSX didn't notice the filename case change. I had to run git mv -f sitemapentry.php SitemapEntry.php
+ redeploy for it to work.
I saw thats this issue was closed but i still found an error. In my case i basically installed last version of plugin. Then locally all works well with declaration ( sitemap.php ) :
use Grav\Plugin\Sitemap\SitemapEntry;
Everytime i deploy to one server, there is an error : Class 'Grav\Plugin\Sitemap\SitemapEntry' not found
So i renamed to :
use Grav\Plugin\Sitemap\sitemapentry;
Just after that everything works fine. Can you please advice about this error? Thank you.
Thats an urgent topic