You are here

function entityqueue_update_7001 in Entityqueue 7

Sets variables for keeping track of field names and queue names.

1 call to entityqueue_update_7001()
entityqueue_update_7002 in ./entityqueue.install
Re-runs the fixed version of entityqueue_update_7001().

File

./entityqueue.install, line 235
Install, update and uninstall functions for the Entityqueue module.

Code

function entityqueue_update_7001() {
  module_load_include('module', 'entityqueue');
  ctools_include('export');
  ctools_include('entityqueue_queue.class', 'entityqueue');

  // Retrieve all queues (from database + default queues).
  $db_queues = db_query("SELECT name, target_type FROM {entityqueue_queue}")
    ->fetchAllKeyed();
  $entityqueue_schema = entityqueue_schema();
  $default_queues = _ctools_export_get_defaults('entityqueue_queue', $entityqueue_schema['entityqueue_queue']['export']);
  $queue_names = array_merge(array_keys($db_queues), array_keys($default_queues));
  variable_set('entityqueue_queue_names', $queue_names);
  $target_types = array_unique(array_values($db_queues));
  foreach ($default_queues as $queue) {
    if (!in_array($queue->target_type, $target_types)) {
      $target_types[] = $queue->target_type;
    }
  }
  $field_names = array();
  foreach ($target_types as $target_type) {
    $field_names[] = _entityqueue_get_target_field_name($target_type);
  }
  variable_set('entityqueue_field_names', $field_names);

  // Mark the update as no longer broken.
  variable_set('entityqueue_broken_update_7001', FALSE);
}