You are here

function forum_access_update_6103 in Forum Access 6

Remove bogus rows from the {forum_access} table.

File

./forum_access.install, line 236
Install, update and uninstall functions for the forum_access module.

Code

function forum_access_update_6103() {
  $ret = array();
  if ($vid = variable_get('forum_nav_vocabulary', FALSE)) {
    $ret[] = update_sql("\n      DELETE FROM {forum_access}\n      WHERE tid NOT IN (\n        SELECT t.tid\n        FROM {term_data} t\n        WHERE t.vid = {$vid}\n      )\n    ");
    if ($ret[0]['success'] && ($affected_rows = db_affected_rows())) {
      $ret[0]['query'] = $ret[0]['query'] . '<br />' . $affected_rows . ' bogus rows purged.';
    }
  }
  return $ret;
}