You are here

function openlayers_update_7360 in Openlayers 7.3

Update factory_service property of each OL objects.

File

./openlayers.install, line 556
Openlayers module - installation procedure.

Code

function openlayers_update_7360() {
  $tables = openlayers_schema();
  foreach ($tables as $table => $table_data) {
    if (!isset($table_data['fields']['factory_service'])) {
      continue;
    }
    $plugin_type = array_pop(explode('_', $table_data['export']['identifier']));
    $fs_before = 'openlayers.' . $plugin_type . '.';
    $fs_after = 'openlayers.' . drupal_ucfirst($plugin_type) . '.';
    db_update($table)
      ->expression('factory_service', 'REPLACE(factory_service, :before, :after)', array(
      ':before' => $fs_before,
      ':after' => $fs_after,
    ))
      ->execute();
  }
}