You are here

function mediafront_update_7003 in MediaFront 7

Same name and namespace in other branches
  1. 7.2 mediafront.install \mediafront_update_7003()

Migrate the Preset module presets to the MediaFront module.

File

./mediafront.install, line 118

Code

function mediafront_update_7003() {
  $ret = array();
  require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'mediafront') . '/includes/mediafront.preset.inc';
  $presets = mediafront_preset_get_presets();
  foreach ($presets as $preset) {
    $mpreset = array();
    $mpreset['name'] = $preset['name'];
    $mpreset['description'] = $preset['description'];
    if ($preset['settings']['player']) {
      $mpreset['player'] = $preset['settings']['player'];
      unset($preset['settings']['player']);
    }
    else {
      $mpreset['player'] = 'osmplayer';
    }
    if ($preset['settings']['connect']) {
      $mpreset['connect'] = $preset['settings']['connect'];
      unset($preset['settings']['connect']);
    }
    $mpreset['settings'] = $preset['settings'];
    mediafront_preset_save($mpreset);
  }

  // Clear the menu cache.
  menu_cache_clear();
  return $ret;
}