getgrav / grav-plugin-sitemap

Grav Sitemap Plugin
https://getgrav.org
MIT License
42 stars 42 forks source link

Wrong file name for SitemapEntry.php #85

Closed zouloux closed 3 years ago

zouloux commented 3 years ago

Naming this class's file sitemapentry.php (as lowercase) will fail autoloader to require this file on case aware file systems. Renaming it to SitemapEntry.php allows it to be loaded correctly on any system. Thanks a lot

zouloux commented 3 years ago

Ok just saw it has been patched but not released yet 😅

Fabien-Flerchinger commented 3 years ago

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

zouloux commented 3 years ago

Hi @FabulousF, I rename file with Ci for now, so if plugin update is done by Admin it will fail. We may propose a PR, we can also do a fork and install it manually. No perfect solution but I think they need time to process updates.

Fabien-Flerchinger commented 3 years ago

Hi @zouloux, ok thank you for your response. For instance i did manually my changes, waiting for official update.

rhukster commented 3 years ago

Never noticed a problem on any server I host with. Or local which also uses a case sensitive file system, but that doesn’t mean it’s not an issue.

I’ll take a look at this today

rhukster commented 3 years ago

Are you guys on the latest 2.0.2 version of sitemap? It was released a couple of weeks ago. This has the SitemapEntry.php case issue was actually fixed in 2.0.1 back in July.

If you still have an issue it might be related to an out of date composer autoloader. I've updated that in this commit: https://github.com/getgrav/grav-plugin-sitemap/commit/9e3ea464ca677fc7c1aeccf584ea898b4060d856

You could test by downloading the zip file of the develop branch here: https://github.com/getgrav/grav-plugin-sitemap/archive/develop.zip and replacing your files.

Fabien-Flerchinger commented 3 years ago

Hello @rhukster, thx for feedback. Yes i'm using last version of plugin and also last version of Grav.

I think maybe i'll try to update composer : bin/grav composer --update

right?

rhukster commented 3 years ago

That updates Grav's vendor libraries / autoloader, what you need to try is to update the ones in the sitemap plugin. So you have to:

cd user/plugins/sitemap
composer update

Assuming you have composer installed on the system.

Or grab the zip I linked to and replace the sitemap plugin.

Fabien-Flerchinger commented 3 years ago

ok i'll try thank you

Fabien-Flerchinger commented 3 years ago

Hi back. I had an outdated version of Composer. I did well cmd : composer update into ( user/plugins/sitemap )

System updated those two files :

user/plugins/sitemap/composer.lock user/plugins/sitemap/vendor/composer/autoload_real.php

Then i changed again name i did before :

Grav\Plugin\Sitemap\SitemapEntry; instead of Grav\Plugin\Sitemap\sitemapentry;

I have now same error than before :

Class 'Grav\Plugin\Sitemap\SitemapEntry' not found

Screenshot 2020-12-29 at 15 47 47
rhukster commented 3 years ago

Don't change anything in the sitemap plugin, it does work fine as-is. It's just your system that is holding on to old references. Try clearing PHP opcache, or restarting the PHP-FPM process, or rebooting the server.