I'm not using the comment module on my site, but I am using the subscription module so that people can get updates when their favorite bloggers post new content.
Unfortunately I've been getting fatal errors during cron about the comments table being missing:
WD cron: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dogs7.comment' doesn't [error]
exist: SELECT nid FROM {comment} WHERE cid = :cid; Array
(
[:cid] => 8670
)
in subscriptions_content_load_comment() (line 712 of
drupal-7/sites/all/modules/contrib/subscriptions/subscriptions_content.module).
By adding a check for the comment module before the offending code, everything seems to be working smoothly again:
function subscriptions_content_load_comment(array &$subs) {
if (module_exists('comment')) {
$cid = $subs['load_args'];
$sqid = $subs['sqid'];
/** @var $nid int */
if ($nid = db_query('SELECT nid FROM {comment} WHERE cid = :cid', array(':cid' => $cid))->fetchField()) {
if ($subs['module'] != 'node' || $subs['field'] != 'nid') {
// Only if we're processing a node/nid queue item should we cut off
// the comments at an update item, otherwise not.
$sqid = NULL;
}
_subscriptions_module_load_include('subscriptions_content', 'notify.inc');
if (($node = _subscriptions_content_load($nid, $sqid)) && !empty($node->_subscriptions_comments)) {
$subs['object'] = $node;
return TRUE;
}
}
}
return FALSE;
}
patch provided for review.
Comment | File | Size | Author |
---|---|---|---|
subscriptions-cron-fatal.patch | 1.74 KB | jenlampton | |
Comments
Comment #3
salvisCorrected weird file names and re-rolled.
Thank you, jenlampton, and sorry about the extreme delay.
Comment #5
salvis(Fixed CHANGELOG.txt.)