You are here

function media_wysiwyg_upgrade_content_tokens in D7 Media 7.3

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

Upgrade media tokens in content.

Over time the format of media tokens will change and this function will assert that existing tokens in content will remain up to date with todays standard.

It examines the {file_usage} table and searches all entities for filtered text fields with macros. All found media tokens will be upgraded to the latest token format version and the individual text fields will be updated in db directly, omitting all hooks otherwise run during entity update.

1 string reference to 'media_wysiwyg_upgrade_content_tokens'
media_wysiwyg_menu in modules/media_wysiwyg/media_wysiwyg.module
Implements hook_menu().

File

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

Code

function media_wysiwyg_upgrade_content_tokens() {
  $batch = array(
    'title' => t("Upgrading media tokens"),
    'operations' => array(
      array(
        'media_wysiwyg_upgrade_content_tokens_batch',
        array(),
      ),
    ),
    'finished' => 'media_wysiwyg_upgrade_content_tokens_finish',
    'file' => drupal_get_path('module', 'media_wysiwyg') . '/includes/media_wysiwyg.pages.inc',
  );
  batch_set($batch);
  batch_process('admin/reports/status');
}