You are here

function services_update_7400 in Services 7.3

Update 7400 reduces nesting in the way server settings are stored

File

./services.install, line 267
Install, uninstall and update the Services module.

Code

function services_update_7400() {
  module_load_include('module', 'services');
  $server_names = array_keys(services_get_servers());
  foreach (services_endpoint_load_all() as $endpoint) {
    $settings = $endpoint->server_settings;
    if (!empty($settings)) {
      if (in_array(key($settings), $server_names)) {
        $settings = current($settings);
      }
    }
    else {
      $settings = array();
    }
    $endpoint->server_settings = $settings;
    services_endpoint_save($endpoint);
  }
}