You are here

function advanced_help_search_status in Advanced Help 7

Implements hook_search_status().

File

./advanced_help.module, line 1044
Pluggable system to provide advanced help facilities for Drupal and modules.

Code

function advanced_help_search_status() {
  $topics = advanced_help_get_topics();
  $total = 0;
  foreach ($topics as $module => $module_topics) {
    foreach ($module_topics as $topic => $info) {
      $file = advanced_help_get_topic_filename($module, $topic);
      if ($file) {
        $total++;
      }
    }
  }
  $last_cron = variable_get('advanced_help_last_cron', array(
    'time' => 0,
  ));
  $indexed = 0;
  if ($last_cron['time'] != 0) {
    $indexed = db_query("SELECT COUNT(*) FROM {search_dataset} sd WHERE sd.type = 'help' AND sd.sid IS NOT NULL AND sd.reindex = 0")
      ->fetchField();
  }
  return array(
    'remaining' => $total - $indexed,
    'total' => $total,
  );
}