views:

153

answers:

2

Some nodes are showing a 404 status when they exist in the database. You also get a 404 if you type in the url to edit that node in the admin page.

These nodes are being created in an automated fashion in the database, from CSV files. What I'd like to ask is which db fields would trigger a 404 on a node?

I have checked the url_alias table, and the nodes have valid entries. ie: If I enter example.com/node/512682 in the URL, it will do a redirect to the SEF url, but that would show a 404

+2  A: 

It sounds like your import is flawed, but it's hard to know without more information. Did you use node_save()? If not, you should try that. If that still doesn't work, trying looking at the $node object immediately after node_save() and see if it has a new nid value. If not, you're not passing the right info to node_save(). If you do get a new nid value and the node still won't load, I'd start looking at modules that might be breaking Drupal. But I'd put my money on switching to node_save() solving the problem.

Scott Reynen
Thats a great suggestion. I may look into that eventually as I take it would trigger the hooks that may be needed by extensions...
bucabay
+2  A: 

Does your 'code creation from CSV' automation also creates entries in the 'node_revisions' table? If it doesn't, this would explain the 404s - even if you have disabled revisions for a node type, Drupal will still expect at least one entry per node there.

You can create those on your import as well, but I agree with Scott Reynen (+1) that you should probably use node_save() to ensure proper processing of newly created nodes (especially invocation of the related hooks) to prevent other surprises as well.

Henrik Opel
That was exactly the problem. Some of the entries were missing corresponding entries in node_revisions. Thanks.
bucabay