You are here

function fbconnect_stream_publish_update_6201 in Facebook Connect 6.2

Same name and namespace in other branches
  1. 8.2 fbconnect_stream_publish/fbconnect_stream_publish.install \fbconnect_stream_publish_update_6201()
  2. 7.2 fbconnect_stream_publish/fbconnect_stream_publish.install \fbconnect_stream_publish_update_6201()

Implements hook_update_6201().

Change content type activation variable

File

fbconnect_stream_publish/fbconnect_stream_publish.install, line 13
@todo.

Code

function fbconnect_stream_publish_update_6201() {
  $ret = array();
  foreach (array_keys(node_get_types('names')) as $type_name) {

    // Old variable format:
    // variable_get('fbconnect_' . $form['#node_type']->type . '_onoff', 0).
    $old_format = 'fbconnect_' . $type_name . '_onoff';
    $new_format = 'fbconnect_stream_publish_onoff_' . $type_name;
    $value = variable_get($old_format, 'NULL');

    // If old variable is set, set new one and delete old one, if it wasn't set
    // then $old_value = 'NULL'.
    if ($value !== 'NULL') {
      variable_set($new_format, $value);
      variable_del($old_format);
    }
  }

  // Delete any old existing variable.
  db_query("DELETE FROM {variable} WHERE name LIKE 'fbconnect\\_%\\_onoff'");
  return $ret;
}