I know there is an issue in the features queue, but I'm not sure if my issue belongs in there since openlayers uses ctools to implement it's features support.
Is it possible to have the presets/maps "unlinked" (as they call it in the features issue queue) through a hook in the openlayers module so we can automate our D6 to D7 upgrade process?
The following code is actually doing just that:

  $presets = openlayers_presets();
  foreach ($presets as $preset) {
    if ($preset->type == 'Default') {
      openlayers_preset_save($preset);
    }
  }

Comments

Jan van Diepen’s picture

Actually we can add some similar code to also do the layers and the styles. A layer needs some extra check on the export_module field before saving it to the database.

  $layers = openlayers_layers_export_load();
  foreach ($layers as $layer) {
    if (($layer->type == 'Default') && ($layer->export_module != 'openlayers')){
      openlayers_layer_save($layer); 
    }
  }

  $presets = openlayers_presets();
  foreach ($presets as $preset) {
    if ($preset->type == 'Default') {
      openlayers_preset_save($preset);
    }
  }

  $styles = openlayers_styles();
  foreach ($styles as $style) {
    if ($style->type == 'Default') {
      openlayers_style_save($style);
    }
  }

zzolo’s picture

Hi @Jan van Diepen. I am not entirely sure what you are asking. Currently, for the upgrade the module "unlinks" presets/maps? We don't actually need to do this for layers or styles as there is nothing to upgrade (their name has not changed).

Jan van Diepen’s picture

Sorry for the confusion.

We're trying to "migrate" a website from D6 to D7. We have about 15 custom layers (views displays), about 10 custom maps and about 5 custom styles. We're keeping all of them in a number of features. Since there is no way of upgrading D6 features to D7 yet, we have to recreate the features in D7 and we can only do that if everything is in the database. So while still in D6, just before the upgrade to D7, we need to "unlink" them to save them to the database.

Hope this makes more sense to you.

zzolo’s picture

Status: Active » Closed (works as designed)

Hey @Jan van Diepen. This does make sense. But its not really in the scope of this module; sorry. You should be able to override your features which will put things into the database, but definitely test first.