Posted on: 05/31/09 01:57pm
By: LWC
The wiki says XMLSitemap is based on PLG_itemSaved and PLG_itemDeleted. But it does have a way to detect existing items when upgrading to v1.6.
So please mention how it's done so plugins could do it too (e.g. imagine MG with countless of existing items).
Re: How does XMLSitemap work in retrospect?
Posted on: 05/31/09 02:05pm
By: Dirk
On installation, it goes through all the existing posts using
PLG_getItemInfo[*1] . The functionality of that API function was extended in 1.6.0 to make that possible.
bye, Dirk
Re: How does XMLSitemap work in retrospect?
Posted on: 05/31/09 06:04pm
By: LWC
Is there an official way to make it run on another plugin?
Also, is there a way to automatically add a plugin to "XMLSitemap Main Settings"? And how does a plugin register itself in "Priority" and "Update frequency"?
Re: How does XMLSitemap work in retrospect?
Posted on: 05/31/09 06:20pm
By: Dirk
It's mostly automatic, actually. The XMLSitemap plugin can detect when another plugin is installed(*) and checks if that plugin supports the necessary API functions. If so, the plugin is added automatically. Frequency etc. are set to default values.
bye, Dirk
(*) assuming the other plugin uses the
autoinstall[*2]
Re: How does XMLSitemap work in retrospect?
Posted on: 05/31/09 08:07pm
By: LWC
But how can you re-install a plugin without losing its whole database?
Are the necessary API functions PLH_itemSaved, PLG_itemDeleted and PLG_getItemInfo?
Re: How does XMLSitemap work in retrospect?
Posted on: 06/01/09 09:25am
By: LWC
It seems the only way to do this for upgrades and/or for pre-v1.6 installations is by including this in the relevant function:
Text Formatted Code
function plugin_upgrade_<plugin_name>()
...
if (function_exists('plugin_pluginstatechange_xmlsitemap') && !in_array('<plugin_name>', $_XMLSMAP_CONF['types']))
plugin_pluginstatechange_xmlsitemap('<plugin_name>', 'installed');
Text Formatted Code
function plugin_install_<plugin_name>() / function plugin_install_now()
...
if (function_exists('plugin_pluginstatechange_xmlsitemap'))
plugin_pluginstatechange_xmlsitemap('<plugin_name>', 'installed');
It then sends a "*" (i.e. request for all IDs) to plugin_getiteminfo_<plugin_name>.
Re: How does XMLSitemap work in retrospect?
Posted on: 06/01/09 09:29am
By: Dirk
Go to Configuration > XMLSitemap > Contents of sitemap, add a new entry for your plugin. What's so complicated about this?
bye, Dirk
Re: How does XMLSitemap work in retrospect?
Posted on: 06/01/09 09:32am
By: LWC
Because I'm talking as a plugin developer, not a plugin user.
Re: How does XMLSitemap work in retrospect?
Posted on: 06/01/09 12:35pm
By: jmucchiello
But since the user can add the plugin to the sitemap if they want there is no reason for the plugin developer to do that.
Re: How does XMLSitemap work in retrospect?
Posted on: 06/01/09 03:39pm
By: LWC
I doubt most users would appreciate that (let alone actually do that).
Re: How does XMLSitemap work in retrospect?
Posted on: 06/01/09 03:54pm
By: Dirk
Oh give us a break please ...
The scenario you're describing only affects plugins that already support the required functions. How many are there? The ones that are bundled with 1.6.0 and, I guess, your MultiFAQ plugin.
Once 1.6.0 is out and users install a new plugin that supports the new API functions, XMLSitemap will pick it up automatically.
So this only affects the unlikely scenario of having content in a plugin that already has the new functions and upgrading such a site to 1.6.0. I guess other than your own site, this won't affect anyone. And for you, there's still the option to add the plugin manually once.
Talk about blowing things out of proportion ...
Besides, you shouldn't try and access the internals of other plugins (as you posted above).
bye, Dirk
Re: How does XMLSitemap work in retrospect?
Posted on: 06/01/09 06:02pm
By: LWC
I'm not sure whether to take it as a compliment or not. You basically claim I'm the only plugin developer out there who will ever want to add v1.6 functions to an existing external plugin. It really doesn't look good if no one thinks MG, the forum, etc. have even the slightest chance to ever support v1.6 functions for sites that installed these plugins before v1.6.
Re: How does XMLSitemap work in retrospect?
Posted on: 06/01/09 09:54pm
By: jmucchiello
No, he's saying that once people upgrade to 1.6, they will add mg and forum to the xmlsitemap list manually. Then when mg and forum support the new functionality, there won't be anything for the plugin writer to do since the admin will have already taken care of it. On the other hand, if the admin does not manually add these plugins to the xmlsitemap list, then perhaps the admin doesn't want them on the site map and it would behoove the plugin author not to modify things behind the admin's back.
Re: How does XMLSitemap work in retrospect?
Posted on: 06/02/09 03:10am
By: LWC
Does manual addition add existing items or only new ones (until a site upgrade/installing a new plugin)?
Re: How does XMLSitemap work in retrospect?
Posted on: 06/04/09 11:05am
By: LWC
It seems the answer is only new ones. In any case, I've released MultiFAQ v3.1.2 with sitemap support. When it decides which questions to include, it also takes in consideration the permissions of the questions' topics and whether their language is disabled in the FAQ.
It made me notice function STORY_getItemInfo is only called when creating/editing stories and not when editing/deleting topics. A loop should be called upon changing a topic's permissions/deleting the topic, to add/delete in the sitemap every story that belongs to that topic.