Drupal:没有为上传的图像创建节点。给出“用户警告:重复输入”错误

时间:2014-07-10 10:42:46

标签: mysql drupal

当我在Drupal CMS工具中上传一些图像时出现以下错误

Access denied

user warning: Duplicate entry '434062-434065' for key 1 query: INSERT INTO node (nid, vid, title, type, uid, status, created, changed, comment, promote, sticky) VALUES (434062, 434065, 'xxxxxxxxxxxxx', 'image', 167, 1, 1404885608, 1404885608, 2, 0, 0) in /var/www/html/cms/includes/database.mysql.inc on line 172.
user warning: Duplicate entry '434065' for key 1 query: INSERT INTO node_revisions (nid, vid, title, body, teaser, timestamp, uid, format, log) VALUES (434062, 434065, 'xxxxxxxxxxxxxxxxx', '', '', 1404885608, 167, 1, '') in /var/www/html/cms/includes/database.mysql.inc on line 172.
user warning: Duplicate entry '198423' for key 1 query: INSERT INTO files (fid, nid, filename, filepath, filemime, filesize) VALUES (198423, 434062, '_original', 'images/xxxxxxxxxxxxxxxxx.jpg', 'image/jpeg', '95858') in /var/www/html/cms/includes/database.mysql.inc on line 172.
user warning: Duplicate entry '198424' for key 1 query: INSERT INTO files (fid, nid, filename, filepath, filemime, filesize) VALUES (198424, 434062, 'thumbnail', 'images/xxxxxxxxxxxxxxxxxxxxxxx.jpg', 'image/jpeg', '2824') in /var/www/html/cms/includes/database.mysql.inc on line 172.
user warning: Duplicate entry '198425' for key 1 query: INSERT INTO files (fid, nid, filename, filepath, filemime, filesize) VALUES (198425, 434062, '70x70', 'images/xxxxxxxxxxxxxxxxxxx.jpg', 'image/jpeg', '1908') in /var/www/html/cms/includes/database.mysql.inc on line 172.
user warning: Duplicate entry '198426' for key 1 query: INSERT INTO files (fid, nid, filename, filepath, filemime, filesize) VALUES (198426, 434062, '50x50', 'images/xxxxxxxxxxxxxxxxxxxxxxx.jpg', 'image/jpeg', '1419') in /var/www/html/cms/includes/database.mysql.inc on line 172.
user warning: Duplicate entry '198427' for key 1 query: INSERT INTO files (fid, nid, filename, filepath, filemime, filesize) VALUES (198427, 434062, '90x90', 'images/xxxxxxxxxxxxxxxxxx.jpg', 'image/jpeg', '2486') in /var/www/html/cms/includes/database.mysql.inc on line 172.
user warning: Duplicate entry '434062' for key 1 query: INSERT INTO node_comment_statistics (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (434062, 1404885608, NULL, 167, 0) in /var/www/html/cms/includes/database.mysql.inc on line 172.

在深入挖掘时,我发现drupal上面用来保存db中的内容的nid / vid / fid值已经存在,所以我猜测它必须是在这些表中错误设置auto_increment值的问题。但是当我检查了相应表中的AUTO_INCREMENT时,只有node表在nid上有AUTO_INCREMENT,而且它也已经设置为434510.其他表在主键上没有auto_increment。

我想知道drupal从哪里选择这个nid / vid / fid值。它位于某些配置文件/代码中或来自db中的某个位置。我尝试更新cache_content表,但它没有用完。

1 个答案:

答案 0 :(得分:0)

通过在drupal DB中的sequences表中设置正确的值来解决此问题。 显然,Drupal并不依赖于各个表中字段的自动增量值,它会在sequences表中寻找下一个id。

更新了node_nid,node_revisions_vid&的值。 files_fid到相应的" max + 1" node节点,node_revisions和文件表中的值。