You are here

function subscriptions_content_cron in Subscriptions 2.0.x

Same name and namespace in other branches
  1. 5.2 subscriptions_content.module \subscriptions_content_cron()
  2. 6 subscriptions_content.module \subscriptions_content_cron()
  3. 7 subscriptions_content.module \subscriptions_content_cron()

Implements hook_cron().

Ensure that we're heavier than the taxonomy.module.

File

subscriptions_content/subscriptions_content.module, line 822
Subscriptions to content events.

Code

function subscriptions_content_cron() {
  $result = db_query("SELECT name, weight FROM {system} WHERE name IN ('taxonomy', 'subscriptions_content') AND type = 'module'");
  $weights = [];
  foreach ($result as $module) {
    $weights[$module->name] = $module->weight;
  }
  if ($weights['subscriptions_content'] <= $weights['taxonomy']) {
    db_update('system')
      ->fields([
      'weight' => $weights['taxonomy'] + 1,
    ])
      ->condition('name', 'subscriptions_content')
      ->condition('type', 'module')
      ->execute();
  }
}