Geeklog-Core / geeklog

Geeklog - The Secure CMS.
https://www.geeklog.net
25 stars 19 forks source link

Sitemap Plugin Errors out when you add new items to a plugin that is not setup to use the sitemap in the Geeklog configuration #1068

Closed eSilverStrike closed 2 years ago

eSilverStrike commented 4 years ago

I was testing the media gallery plugin uploads and I was getting some XMLsitemap errors.

It looks like plugin_itemsaved_xmlsitemap doesn't check if the "type" config option has been set for $_XMLSMAP_CONF['priorities'][$type] or $_XMLSMAP_CONF['frequencies'][$type] so since the mediagallery has not been setup to use the XMLSitemap plugin in the configuration it fails when the sitemap tries to add new mediagallery photos (which it shouldn't be adding since it is not setup in the config).

Looking at the XMLSitemap Config it is a little confusing what is required to add a plugin to the sitemap. We should update the config docs (/docs/english/xmlsitemap.html) to better explain this.

For example you need to add the plugin to the "type", "priorities", and "frequencies". When you add the plugin to "type", the one for "frequencies" automatically gets added. You have to manually add the plugin to "priorities" (I assume one is required or should we default this setting in XMLSitemap plugin if missing?)

They can also enter the plugin for "lastmod" but that is not required.

Also what happens if we delete a plugin from the "type" config option? We should probably delete the type if it exists from "lastmod", "priorities", and "frequencies"

One last thing why is there an "exclude" config option. Isn't the "types" config option enough? I looked quickly at the code and couldn't tell if the "exclude" did anything else important.

eSilverStrike commented 4 years ago

@mystralkk Last commit was a partial fix. I just added a check when an item is saved. This fix may need to change if we decide "priorities" config option is not required.

Config docs also still need updating along with the other items mentioned above...

mystralkk commented 4 years ago

Fixed with change set c06c767