You are here

function search_api_attachments_update_7102 in Search API attachments 7

Set excluded_private to FALSE for existing websites to preserve behavior.

File

./search_api_attachments.install, line 86
Module install file.

Code

function search_api_attachments_update_7102() {
  $search_api_indexes = db_select('search_api_index')
    ->fields('search_api_index', array(
    'machine_name',
  ))
    ->execute()
    ->fetchCol();
  $indexes = search_api_index_load_multiple($search_api_indexes);
  if (!empty($indexes)) {
    foreach ($indexes as $index) {
      if (isset($index->options['data_alter_callbacks']['search_api_attachments_alter_settings']) && isset($index->options['data_alter_callbacks']['search_api_attachments_alter_settings']['settings'])) {
        $index->options['data_alter_callbacks']['search_api_attachments_alter_settings']['settings']['excluded_private'] = 0;
        entity_save('search_api_index', $index);
      }
    }
  }
}