You are here

function media_wysiwyg_upgrade_content_tokens_finish in D7 Media 7.3

Same name and namespace in other branches
  1. 7.4 modules/media_wysiwyg/includes/media_wysiwyg.upgrade.inc \media_wysiwyg_upgrade_content_tokens_finish()

Batch API finish callback.

See also

media_wysiwyg_upgrade_content_tokens()

1 string reference to 'media_wysiwyg_upgrade_content_tokens_finish'
media_wysiwyg_upgrade_content_tokens in modules/media_wysiwyg/includes/media_wysiwyg.pages.inc
Upgrade media tokens in content.

File

modules/media_wysiwyg/includes/media_wysiwyg.pages.inc, line 431
Common pages for the Media WYSIWYG module.

Code

function media_wysiwyg_upgrade_content_tokens_finish($success, $results, $operations) {
  if ($success) {
    $results['!version'] = MEDIA_WYSIWYG_TOKEN_VERSION;
    drupal_set_message(t("Media token version !version upgrade summary: <ul><li>Entities inspected: !entities_total</li> <li>Media tokens found: !tokens_total.</li> <li>Tokens upgraded: !tokens_upgraded</li> <li>Entities affected: !entities_upgraded</li></ul>", $results));
    variable_set('media_wysiwyg_token_version', MEDIA_WYSIWYG_TOKEN_VERSION);

    // Instead of using the costly drupal_flush_all_caches() we flush relevant
    // core caches and invoke hook_flush_caches() to allow content cache modules
    // (entitycache) to flush whatever needed.
    $core = array(
      'cache',
      'cache_filter',
      'cache_page',
      'cache_block',
    );
    $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
    foreach ($cache_tables as $table) {
      cache_clear_all('*', $table, TRUE);
    }
  }
  else {
    drupal_set_message(t('Media token upgrade failed. See system log'), 'warning');
  }
}