You are here

function xmlsitemap_get_link_type_indexed_status in XML sitemap 6.2

Same name and namespace in other branches
  1. 8 xmlsitemap.module \xmlsitemap_get_link_type_indexed_status()
  2. 7.2 xmlsitemap.module \xmlsitemap_get_link_type_indexed_status()
  3. 2.x xmlsitemap.module \xmlsitemap_get_link_type_indexed_status()
1 call to xmlsitemap_get_link_type_indexed_status()
xmlsitemap_add_form_entity_summary in ./xmlsitemap.admin.inc
Add a table summary for an entity and its bundles.

File

./xmlsitemap.module, line 955
Main file for the xmlsitemap module.

Code

function xmlsitemap_get_link_type_indexed_status($entity_type, $bundle = '') {
  $info = xmlsitemap_get_link_info($entity_type);
  $status['indexed'] = db_result(db_query("SELECT COUNT(id) FROM {xmlsitemap} WHERE type = '%s' AND subtype = '%s'", $entity_type, $bundle));
  $status['visible'] = db_result(db_query("SELECT COUNT(id) FROM {xmlsitemap} WHERE type = '%s' AND subtype = '%s' AND status = 1 AND access = 1", $entity_type, $bundle));
  $base_table = db_escape_table($info['base table']);
  $id_key = db_escape_string($info['entity keys']['id']);
  if (!empty($info['entity keys']['bundle'])) {
    $bundle_key = db_escape_string($info['entity keys']['bundle']);
    $bundle_placeholder = db_type_placeholder(_xmlsitemap_get_field_type($info['base table'], $info['entity keys']['bundle']));
    $status['total'] = db_result(db_query("SELECT COUNT({$id_key}) FROM {{$base_table}} WHERE {$id_key} > 0 AND {$bundle_key} = {$bundle_placeholder}", $bundle));
  }
  else {
    $status['total'] = db_result(db_query("SELECT COUNT({$id_key}) FROM {{$base_table}} WHERE {$id_key} > 0"));
  }
  return $status;
}