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
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.
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.
Check the query that is being run. We had the same problem and it turned out the importer was creating the entries with a uid that did not exist. When querying Drupal made a join with the user table and that came back empty.
SELECT n.nid, n.type, n.language, n.uid, n.status, n.created, n.changed, n.comment,
n.promote, n.moderate, n.sticky, n.tnid, n.translate, r.vid, r.uid AS revision_uid,
r.title, r.body, r.teaser, r.log, r.timestamp AS revision_timestamp, r.format, u.name,
u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN
node_revisions r ON r.vid = n.vid WHERE n.nid = <some-number>
You can find out for sure using the devel module. Point it to the URL you think should be showing a module and look at the queries it creates.
精彩评论