You are here

function search_files_directories_dashboard in Search Files 7.2

Same name and namespace in other branches
  1. 6.2 search_files_directories.module \search_files_directories_dashboard()

Page callback: dashboard managing index.

1 string reference to 'search_files_directories_dashboard'
search_files_directories_menu in ./search_files_directories.module
Implements hook_menu().

File

./search_files_directories.module, line 673
Used to index files in directories.

Code

function search_files_directories_dashboard() {
  $lastindex = variable_get('search_files_directories_last_index', 0);
  $items = array();
  if ($lastindex == 0) {
    $items[] = t('Last Index = %index', array(
      '%index' => t('never'),
    ));
  }
  else {
    $items[] = t('Last Index = %index', array(
      '%index' => format_date($lastindex, $type = 'medium'),
    ));
  }
  $count = db_query("SELECT COUNT(*) FROM {search_dataset} WHERE type = 'search_files_dir'")
    ->fetchField();
  $items[] = t("Files indexed = %count", array(
    '%count' => $count,
  ));
  $count = db_query("SELECT COUNT(*) FROM {search_dataset} WHERE (type = 'search_files_dir' AND reindex > 0)")
    ->fetchField();
  $items[] = t("Files indexed and scheduled for reindexing = %count", array(
    '%count' => $count,
  ));
  $directoryrescanage = search_files_variable_get_directoryrescanage();
  $items[] = t('Directory Rescan Age = %secs [sec]', array(
    '%secs' => $directoryrescanage,
  ));
  $nextdirectoryrescan = $lastindex + $directoryrescanage;
  $items[] = t('Next Directory (Re-)Scan at or after = %time', array(
    '%time' => format_date($nextdirectoryrescan, $type = 'medium'),
  ));
  $count = db_query("SELECT COUNT(*) FROM {search_files_directories_directories}")
    ->fetchField();
  $items[] = t("Number of Directories configured = %count", array(
    '%count' => $count,
  ));
  $count = db_query("SELECT COUNT(*) FROM {search_files_directories_files}")
    ->fetchField();
  $items[] = t('Files found in configured Directories and Subdirectories = %count', array(
    '%count' => $count,
  ));
  $count = db_query("SELECT COUNT(*) FROM {search_files_directories_files} WHERE index_attempts = 0")
    ->fetchField();
  $items[] = t("Files without index attempt = %count", array(
    '%count' => $count,
  ));
  $items = l(t('Update index'), 'admin/config/search/search_files/directories/update_index', array(
    'query' => drupal_get_destination(),
  ));
  return array(
    '#theme' => 'item_list',
    '#items' => $items,
  );
}