I may be mistaken, but I believe update 7201 for this module contains a severe logic error that means it will never actually run succesful. The update uses a helper function, _update_to_view_modes(), that overwrites the passed-in There is a big problem with the 7200 update of this module. For two variables, it calls the following helper function that is intended to convert an old variable to a new variable format. However, on the second line, the name for the new variable is overwritten by any value it might already have. If it isn't set yet, the $new_var variable will become NULL (the default value for the variable_get()) and later on, the function will try to set a variable with name NULL.

**
 * Update to view mode display.
 */
function service_links_update_7201(&$sandbox) {
  _update_to_view_modes('service_links_in_links', 'service_links_link_view_modes');
  _update_to_view_modes('service_links_in_node', 'service_links_node_view_modes');
}

/**
 * Switch the old variables to the news based on view modes.
 */
function _update_to_view_modes($old_var, $new_var) {
  $modes = array_filter(variable_get($old_var, 0));
  $new_var = variable_get($new_var, NULL);

  if (!isset($new_var)) {
    switch($modes) {
    case 0:
      $modes = array();
      break;
    case 1:
      $modes = array('teaser' => 'teaser');
      break;
    case 2:
      $modes = array('full' => 1);
      break;
    case 3:
      $modes = array('teaser' => 1, 'full' => 1);
      break;
    }

    variable_set($new_var, $modes);
  }

  variable_del($old_var);
}

I think the intended behaviour was to read and checn the value of the new variable, i.e.:

/**
 * Switch the old variables to the news based on view modes.
 */
function _update_to_view_modes($old_var, $new_var) {
  $modes = array_filter(variable_get($old_var, 0));
  $new_val = variable_get($new_var, NULL);

  if (!isset($new_val)) {
    switch($modes) {
    case 0:
      $modes = array();
      break;
    case 1:
      $modes = array('teaser' => 'teaser');
      break;
    case 2:
      $modes = array('full' => 1);
      break;
    case 3:
      $modes = array('teaser' => 1, 'full' => 1);
      break;
    }

    variable_set($new_var, $modes);
  }

  variable_del($old_var);
}

I think this warrants a warning in the 2.2 release notes and a quick 2.3 release.

Comments

eelkeblok’s picture

Title: Update 7200 broken » Update 7201 broken
Issue summary: View changes
Status: Active » Closed (duplicate)
Related issues: +#2015967: Error after upgrading to 7.x-2.2

This is a duplicate of #2015967: Error after upgrading to 7.x-2.2. I do think it's a good idea to have a quick look and see if a release 2.3 is in order, 2.3-beta1 has been in existence since june 2013 and there are several commits since then, the last of which is july 2014.