views:

40

answers:

1

hi,

I'm using a forum with several topics and node comments module to add comment nodes to the topics.

I'm importing an external database and adding the relationships directly in mysql to the node_comments table.

However before to see the comments of a quesition I need to add a random comment in drupal to this question. Which is probably triggering a function and getting new values from the table.

Is there a way to simulate this, I cannot add a comment and delete it for all thousands nodes in my Drupal ?

Thanks

A: 

Node Comments are not shown with Core Drupal, you need modifications in your theme, or use a view (watch your performance!)

Node Comments displays comments using "nodecomments" view. You can configure the view to tweak some options, but "Nodecomments" (second) display is always used, and you can switch display style (e.g. set it to "table") only when node comments are configured as flat in content type configuration. In threaded mode Node Comments module forces usage of own display style.

edit: After discussion below, Drush seems the answer: You can run any Drupal-code from the commandline using drush.

$ drush --uri=example.com php-eval "<?php module_invoke_all('comment', 'update', array('your'=>'dummy', 'comment'=>'here'); ?>"
berkes
Node Comments are working already if I create them in Drupal. I've already configured everything. However, I've a problem with the imported nodes. I'm updating the node_comments table to associate comments nodes to the forum posts nodes, but it doesn't work.. It worked before, when i added a line manually.. but now I have added few lines and I cannot see any change. Cleaned the cache. Run cron.
Patrick
I've actually found out when the issue is. I need to add a random comment in drupal (after updating the node_comment table) to see all comment lists updated for that node. Is there a way to simulate this for all thousands node in my Drupal ?
Patrick
I do not know the code and implementation of Nodecomments, but it sounds like you must actually insert the "comments" trough the API, instead of into the Database directly. It seems that several hooks *must* be called, which is not done if you poke in the Database directly.
berkes
exactly. These hooks are invoked when I save a new comment (and then delete it). I cannot insert the "comments" trough APIs because I'm actually importing all (thousands) nodes first and then adding the relationships in the comment_node table. It works great, as long as I invoke these hooks somehow. Do you have any tip... ?
Patrick
Are you familiar with Drush?
berkes
not really. I know it is useful to run drupal commands from terminal instead of browser. That's all I know...
Patrick
ok I saw your update. Well I also have a custom module so I can add the code there, but the point is.. should I add and delete a comment for each node in my Drupal installation (> 1000 nodes) ??? The code you passed me is to add a comment to all nodes right ? How can I successively delete the same comment ? thanks
Patrick
I've just found out that Unpublish and Publish back the nodes update the comments!! I'm not 100% sure yet, because I need more testing, but it seems to work
Patrick
about having to run trough all comments: I don't know, since I don't know the ins-and outs nor the hacks involved with node comment. -- My code simply updates *one* existing comment (possibly one that is invisble, even), which acc. to your post brought all comments "online"
berkes