This column will be used to limit the data selected to update the xmlsitemap table. The column will be set to 1 if it needs to update xmlsitemap table during the changes of the data. It will be reset to 0 after xmlsitemap has been updated in the hook_xmlsitemap_links implementation.
Comments
Comment #1
dave reidThis seems different from the use of {xmlsitemap}.status in the 6.x-2.x-dev branch (a TRUE/FALSE flag if the link should be visible in the sitemap). *NOTE*: I'm not yet sure if that's actually what I want to use, so take it with a grain of salt. :)
It sounds like you want it to be a flag for 'needs updating'. Could you walk me through how/why this column would be used?
Comment #2
Anonymous (not verified) commentedI want to add it to
The above query selects every row for the published nodes and then filters below to know to insert or update it. I would add
AND (xn.status = 1 OR xn.status IS NULL)to the WHERE clause to select a fewer set of data. The xn.status column will be NULL for new data. The hook_xmlsitemap_links function updates the xmlsitemap.priority column. If there is no change there is no reason to update it. Knowing when the data is changed is a benefit to reduce the DB selections.As for a status column in the xmlsitemap table; a xmlsitemap.priority of -1 will not appear on the sitemap report already. I don't think a status column just for that purpose is needed.
Comment #3
avpadernoRather then using
(xn.status = 1 OR xn.status IS NULL), it would better to use 1 for the default value of the field.This would reduce the complexity of the SQL query, and would eliminate the hitch I have when I see a field that is
NULLby default (:-)).Comment #4
Anonymous (not verified) commentedKiam that doesn't help. The value is NULL because the data join for a row that exists in {node} and not in {xmlsitemap_node}.
Comment #5
avpadernoAs the query reported uses an inner join, it gets the rows that are present in both the database tables. If you mean to change also the type of join being executed, then what I said is not valid anymore.
I am anyway contrary of using fields whose default value is
NULL;NULLhas a particular meaning, and it should be used just in left join queries (IMO).Taking as example the Drupal core code, there are very few cases where a database field has a default value of
NULL; I guess there must be a reason.Comment #6
Anonymous (not verified) commentedI've not said that the default attribute of the field would be NULL; the SELECT value will be. That aside the Drupal doesn't like NULL default values because not all fields can be and it is easier to construct the select statements because a db_query with '%s' with a NULL becomes '' and that isn't the same thing.
It is common to use NULL default values to reduce the amount of disk space used by the DB. The smarter engines will not output a NULL when the column allows NULL values thus reducing the DB footprint.
Comment #7
avpadernoI misunderstood the sentence, then.
For an example of how not proceed, see the 5.x-2 branch code, which has still an open report about a SQL query with a syntax error.
I am not sure it's a good idea to set a field to
NULL, if then I have to constantly add a check to verify is the field returned from the query isNULL, and maybe change its value to the one that should be really the default value.Would you use
NULLfor the site map priority, when its default value suggested by http://sitemaps.org is 0.5?Comment #8
Anonymous (not verified) commentedPostponed until after the RC release.
Comment #9
avpadernoI am going to add the status field, but to use it to tag the rows in the central database table that are enabled, and usable to populate the sitemap.
Comment #10
avpadernoThe field has been added; the code still needs to be changed to use it.
Comment #11
dave reidOne step closer to the 6.x-2.x branch now. Are we sure we're adding things just to fix bugs in the 6.x-1.x branch? :)
Comment #12
avpadernoWe are sure, indeed.
The beta3 version still doesn't populate the sitemap (except for me, it seems). I am now changing the code to use just two database tables for all the modules; this would allow the cron tasks to populate the table used to create the sitemap content, which can now be served after a single cron tasks execution.
If I am using a single table, then I need a table field that contains the status of the link, as
hook_xmlsitemap_links()will not used anymore; the only time where the modules will be able to update the status of a link is when they execute the Drupal core hooks.To notice that in the code I started to develop for the 6.x-2branch (see the revision 1.5.2.38.2.16) there was already a similar field, which I before called enabled; if now I am using status is because that is the name given to similar fields in Drupal core tables (see the system, or the node tables).
Comment #14
avpadernoThis task needs to be re-opened, now that the code has been rolled back to the point before this task has been implemented.
Comment #15
Anonymous (not verified) commentedAs I said in #8.
Comment #16
dave reidNot worth it anymore.