You are here

function apachesolr_attachments_confirm_submit in Apache Solr Attachments 6.2

Same name and namespace in other branches
  1. 6.3 apachesolr_attachments.admin.inc \apachesolr_attachments_confirm_submit()
  2. 6 apachesolr_attachments.admin.inc \apachesolr_attachments_confirm_submit()
  3. 7 apachesolr_attachments.admin.inc \apachesolr_attachments_confirm_submit()

Form submit handler for the index confirmation form

See also

apachesolr_attachments_confirm()

File

./apachesolr_attachments.admin.inc, line 193
Provides a file attachment search implementation for use with the Apache Solr module

Code

function apachesolr_attachments_confirm_submit($form, &$form_state) {
  switch ($form_state['values']['operation']) {
    case 'delete':
      if (apachesolr_attachments_delete_index()) {
        drupal_set_message(t('File text has been deleted from the Apache Solr index. You must now <a href="!url">run cron</a> until all files have been re-indexed.', array(
          '!url' => url('admin/reports/status/run-cron', array(
            'query' => array(
              'destination' => 'admin/settings/apachesolr/index',
            ),
          )),
        )));
      }
      else {
        if (module_exists('dblog')) {
          drupal_set_message(t('Could not delete file text from the Apache Solr index. Check <a href="!url">recent log messages</a>.', array(
            '!url' => url('admin/reports/dblog'),
          )));
        }
        else {
          drupal_set_message(t('Could not delete file text from the Apache Solr index.'));
        }
      }
      break;
    case 'reindex':
      apachesolr_clear_last_index('apachesolr_attachments');
      drupal_set_message(t('All file attachments will be re-indexed.'));
      break;
    case 'clear-cache':
      db_query("DELETE FROM {apachesolr_attachments_files} WHERE removed = 0");
      drupal_set_message(t('The local cache of extracted text has been deleted.'));
      break;
  }
  $form_state['redirect'] = 'admin/settings/apachesolr/attachments';
}