Closed (fixed)
Project:
XML sitemap
Version:
7.x-2.x-dev
Component:
xmlsitemap
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 May 2008 at 08:35 UTC
Updated:
24 Jun 2008 at 13:18 UTC
Jump to comment: Most recent file
Comments
Comment #1
ehsan.akhgari commentedHere is a version of the patch which should apply cleanly on CVS. The code is basically the same, but I have adjusted the paths (thanks to siliconmeadow).
Comment #2
luti commentedPatch seems to work for me.
Comment #3
darren ohThe reason we use xmlsitemap_url() instead of url() is that performing separate database queries for thousands of links causes poor performance. xmlsitemap_url() needs to be given the correct alias rather than looking it up.
Comment #4
davedelong commentedOn a 6.2 production site, we decided to autogenerate a sitemap xml file, and we got everything in one query:
SELECT u.dst, n.changed FROM {node} AS n INNER JOIN (select distinct(src) as src, dst from {url_alias}) AS u ON (concat('node/', n.nid) = u.src)Once we execute that and have a record in a $record variable, getting the full URL is as simple as:
$url = 'http://www.example.com/' . $record['dst'];Perhaps that might help you?
Dave
Comment #5
darren ohThat's what the current code does. However, if the dst was not retrieved, it doesn't work.
Comment #6
darren ohThe problem is in xmlsitemap_node.install. pid must be allowed to be NULL.
Comment #7
davedelong commentedAh, I think I understand. The reason that works for us is because we have pathauto turned on and so everything has an alias, and we don't have to worry about some nodes not having them. However, that should be fixable with an IFNULL() statement in the query, no?
Comment #8
darren ohNo. xmlsitemap_node saves the pid and uses it to retrieve the alias. The xmlsitemap_node_enable() adds the pid to any link that has a null pid. However, xmlsitemap_node_schema() sets all pids to 0 initially.
Comment #9
darren ohComment #10
ehsan.akhgari commentedI'm not sure I understand what needs to be done here any more. Could someone please elaborate? I'm kind of new to Drupal development.
Comment #11
wayland76 commentedJust so we're all thinking the same thing, I think Darren is referring to the following code from xmlsitemap_node.install:
I note that 'not null' is set to false. This presumably means that nulls are allowed (which is what Darren is saying needs to happen). So I concur with ehsan -- I don't understand what needs to be done either.
Comment #12
darren ohIf NULLs are allowed, the only problem is the default value.
Comment #13
wayland76 commentedOk, great. I've attached a patch (in which we can see the beauty of the 6.x schema API), but I have a question: should previous_comment or priority_override and the like also default to NULL?
Comment #14
wayland76 commentedComment #15
darren ohComment #16
Frieder commentedOK, the patch from wayland worked fine for me, but to enable aliases for users and taxonomy I had to do the same to:
xmlsitemap/xmlsitemap_user/xmlsitemap_user.install
xmlsitemap/xmlsitemap_term/xmlsitemap_term.install
I changed the 'pid' field in mysql table like for xmlsitemap_node:
'pid' => array(
'description' => t('The id of the path.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => NULL,
),
Now my xmlsitemap is working with aliases, YEAH!
Please can someone make a proper patch, i don't know how to use CVS and do patches for Drupal, maybe someone can explain me or better, give me a link to the documentation where I can learn how to make patches for Drupal modules. (I am working under Linux, so this should be easy).
Next step should be to release a xmlsitemap without the bug from here: http://drupal.org/node/261511 and working aliases :)
Comment #17
wayland76 commented@Frieder:
The basic CVS intro: http://drupal.org/handbook/cvs/introduction
The intro for module maintainers: http://drupal.org/handbook/cvs/quickstart
You won't have a CVS login, so just check stuff out as anonymous; that won't let you commit your changes, but it will allow you to make patches.
If you're using a command line CVS, you probably want:
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout contributions/modules/xmlsitemap
Then, you make your changes. Then you go to the contributions/modules directory, and run "cvs diff xmlsitemap > xmlsitemap_patch.txt" or something like that.
Oh, and until the attached patch actually functions 100%, it should be marked "needs work" or "needs review".
HTH,
Comment #18
darren ohI'll finish this.
Comment #19
darren ohPatch needs testing. Uninstall XML Sitemap before testing.
Comment #20
goldentoque commentedI have tested this patch and can verify that installation of the modules occurred without a hitch, and full URL aliases are included in the sitemap.
Not sure if I should be the one changing the status (to reviewed and tested by the community) or not. But for me it all works as intended.
Comment #21
darren ohAnyone can change the status. Thank you.
Comment #22
darren ohFixed in CVS commit 120222.
Comment #23
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #24
sobkowiak commentedI'm using 9th Jul dev version but the problem still appears:
Comment #25
darren ohYou must uninstall the module before installing the update.