You are here

function _termstatus_rebuild in Taxonomy Term Status 7

Create status records for every taxonomy term which does not have one yet.

FIXME: Do we need to batch here?

1 call to _termstatus_rebuild()
termstatus_rebuild_submit in ./termstatus.admin.inc
Submit callback.

File

./termstatus.admin.inc, line 59
Administrative interface for the taxonomy term status module.

Code

function _termstatus_rebuild() {
  $query = db_select('taxonomy_term_data', 'td');
  $query
    ->leftjoin('termstatus', 'ts', 'td.tid = ts.tid');
  $query
    ->fields('td', array(
    'tid',
  ));
  $query
    ->addExpression('1', 'status');
  $query
    ->condition('ts.status', NULL, 'IS NULL');
  db_insert('termstatus')
    ->from($query)
    ->execute();
}