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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jenlampton created an issue. See original summary.

  • salvis committed 34b4b9b on 7.x-1.x
    Issue #2907201 by jenlampton, salvis: Fatal error during cron: comment...
salvis’s picture

Status: Needs review » Fixed

Corrected weird file names and re-rolled.

Thank you, jenlampton, and sorry about the extreme delay.

  • salvis committed a8cd287 on 7.x-1.x
    Issue #2907201 by jenlampton, salvis: Fatal error during cron: comment...
salvis’s picture

(Fixed CHANGELOG.txt.)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.