Marking as critical because it may happen unnoticed that when you run a bulkupdate against nodes, the path for books are changed, removing the [book] or [bookpath], if you were using them. Which is something that fools visitors and worst, search engines.

[book] and [bookpath] placeholders are built using book_load(), which reads the {book} table based on the vid assigned to the node.

On top of the node_pathauto_bulkupdate() function there's the query used to walk all nodes. This query wasn't using the node vid. That lead to end up with no [book] and [bookpath] placeholders, silently breaking the paths that were using them.

Solution is to include 'vid' (appended at the end of the column list) to the main node_pathauto_bulkupdate() query:

  $query = 'SELECT nid,type,title,uid,created,src,dst,vid FROM {node} '.
    "LEFT JOIN {url_alias} ON CONCAT('node/', nid) = src";

I hope that helps. ;-)

Cheers

CommentFileSizeAuthor
#1 pathauto.module.fix_bookpath.patch531 bytesmarkus_petrux

Comments

markus_petrux’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new531 bytes

Here's the patch.

budda’s picture

Lifesaver! Patch worked as expected. Is anybody going to commit this now that mikeryan isn't looking after pathauto?

Stefan Nagtegaal’s picture

Status: Reviewed & tested by the community » Fixed

Fixed, thanks markus_petrux..

Anonymous’s picture

Status: Fixed » Closed (fixed)
Bodo Maass’s picture

Version: » 4.7.x-1.x-dev
Priority: Critical » Normal
Status: Closed (fixed) » Active

Somehow this patch didn't make it into the 4.7.2 distribution.

I had the same problem with 4.7.2 and found this page. Adding ",vid" to line 203 of pathauto_node.inc fixed it again, but by default it is missing.

lennart’s picture

this is still not working

lennart’s picture

thanks bodomaass, for the tip. It works now. Can we get this into the tarball?

greggles’s picture

Status: Active » Reviewed & tested by the community

lennart - if you want to see this in the tarball you can test the patch, provide a review, or make sure that the status value was set to the correct value.

Since steef seemed to want to commit it (but seemingly hasn't) I'm setting this to RTC.

lennart’s picture

Sorry I cannot patch from my laptop, and I am not going to see my desktop for a long time. I can confirm, though, that the change to line 203 works perfectly. I think this is equivalent to the patch.

lennart’s picture

The patch works. I can confirm this.

Stefan Nagtegaal’s picture

Indeed, not sure how but this did not got into the CVS-version of pathauto..

Feel free to commit this Greggels..

greggles’s picture

I'm actually thinking now that this should be a duplicate of http://drupal.org/node/69789

If we use node_load then this is irrelevant, right?

greggles’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

I believe that http://drupal.org/node/69789 fixes the problem for book and bookpath in bulkupdate. Please reopen the issue if the updated version of pathauto doesn't solve the problem.