I have one node which contains PHP code in the node body (not the teaser). This PHP code actually does a drupal_goto unless certain conditions are met. Never mind what they are, just suffice to say that pathauto somehow triggered the default instruction.

So, the effect was that pathauto bulk generate would redirect me (couldn't figure out why for a long time), then I would come back and see that six aliases had been created and the rest of them were skipped (many dozens of paths).

It seems that pathauto is somehow parsing node-body content, and not just parsing it but actually executing PHP. I can't imagine why pathauto would need to parse a nodebody at all, much less honor a PHP input-filter.

My solution: edit that node long enough to neuter the PHP instruction, run the bulk generate, then put the node back the way it was.

Here are a bunch of keyphrases to help searchers who also are experiencing pathauto bulk generation failures:
pathauto bulk generate didn't work, pathauto bulk problem, pathauto bulk generation stops early, why didn't pathauto bulk generation finish all my nodes, pathauto bulk generation doesn't finish

Comments

greggles’s picture

Pathauto has to build the node content to figure out the tokens. Especially if you have messaging or another module that provides a node-body token that will be the case.

So, I'm not sure there is much Pathauto can do.

I suggest not running php input format and writing a module instead.

beanluc’s picture

Thanks for responding, OK, I understand about the tokens. I still doubt that content-body is a necessary or desirable token for anybody to actually use, but, I can see why pathauto must support it. Can't rule out somebody who does want to use that token.

I personally might take the suggestion to avoid using the PHP input format, but I can say it was excruciating for me to figure out why pathauto bulk generation was failing. I predict that others are going to be really fixated on continuing to use the PHP input format, and I think that these persons deserve a safer pathauto, if possible, no matter what I or anyone else thinks about that pactice.

I do still believe that the execution by pathauto of PHP code in a node body is a real mistake - that is, if it can be helped at all.

I don't know if this will be easily patchable. Maybe I'll find that the PHP input filter runs the code before pathauto receives the $node, in which case I wouldn't want to consider adding a short-circuit to pathauto. Maybe in that case a little pathauto documentation update will do the trick: "If you have un-aliased nodes which use the PHP input format, you should disable the PHP input filter before running pathauto bulk generation, then re-enable it when bulk generation is over".

greggles’s picture

Title: "pathauto bulk generate" fails because it executes PHP in node bodies » "pathauto bulk generate" fails because it executes PHP in node bodies - does a redirect instead
Status: Active » Closed (works as designed)

For 7.x the token module only generates the tokens that are needed, so it is much less likely to run into the problem.

For 6.x, that is not likely to be backported.

I think documentation on this particular problem is unlikely to be read and unlikely for people to know until they run into the problem at which point googling for it should help them find this node and your explanation :)

So, I'm marking this by design for 6.x, though it's fixed in 7.x.