You are here

function media_wysiwyg_upgrade_content_tokens_submit in D7 Media 7.4

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.

File

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

Code

function media_wysiwyg_upgrade_content_tokens_submit($form, &$form_state) {
  $form_state['redirect'] = 'admin/reports/status';
  $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.upgrade.inc',
  );
  batch_set($batch);
}