You are here

function search_api_update_7114 in Search API 7

Sanitize watchdog messages.

File

./search_api.install, line 913
Install, update and uninstall functions for the Search API module.

Code

function search_api_update_7114() {
  if (db_table_exists('watchdog')) {
    try {
      $entries = db_select('watchdog', 'w')
        ->fields('w', array(
        'wid',
        'message',
      ))
        ->condition('type', 'search_api')
        ->execute();
      foreach ($entries as $entry) {
        db_update('watchdog')
          ->fields(array(
          'message' => check_plain($entry->message),
        ))
          ->condition('wid', $entry->wid)
          ->execute();
      }
    } catch (Exception $e) {
      throw new DrupalUpdateException(t('An exception occurred during the update: @msg.', array(
        '@msg' => $e
          ->getMessage(),
      )));
    }
  }
}