You are here

fbconnect_stream_publish.install in Facebook Connect 6.2

@todo.

File

fbconnect_stream_publish/fbconnect_stream_publish.install
View source
<?php

/**
 * @file
 * @todo.
 */

/**
 * Implements hook_update_6201().
 *
 * Change content type activation variable
 */
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;
}

/**
 * Implements hook_uninstall().
 */
function fbconnect_stream_publish_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'fbconnect\\_stream\\_publish\\_onoff\\_%'");
}

Functions

Namesort descending Description
fbconnect_stream_publish_uninstall Implements hook_uninstall().
fbconnect_stream_publish_update_6201 Implements hook_update_6201().