If the node comments module is never installed (i.e. a special installation profile is used), the table "node_comment_statistics" is never created. Because of this, the node reindex process causes a sql error "Table 'drupal_usitech.node_comment_statistics' doesn't exist query: SELECT MAX(comment_count) FROM node_comment_statistics".
This is triggered by line 1781 of node.module:
variable_set('node_cron_comments_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'))));
You will also notice line 1169-1171 properly ignores this if the module is missing:
if (module_exists('comment')) {
$ranking['node_rank_comments'] = t('Number of comments');
}A simple workaround would be to replace:
variable_set('node_cron_comments_scale', 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'))));
with:
variable_set('node_cron_comments_scale', module_exists('comment') ? 1.0 / max(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'))) : 1);
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | comment_installed_check.patch | 1.83 KB | astoltz |
Comments
Comment #1
astoltz commentedLooks like this isn't the only change that's needed. It's also referenced around line 1229:
Comment #2
astoltz commentedPatch submitted
Comment #3
dpearcefl commentedIs this still an issue using current Drupal 6?