HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux newsites.squeezer-software.com 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/sites/orpis/sites/all/modules/contrib/nodequeue/smartqueue.install
<?php

/**
 * @file
 * Install, update and uninstall functions for the smartqueue module.
 */

/**
 * Implements hook_schema().
 */
function smartqueue_schema() {
  $schema['smartqueue'] = array(
    'description' => 'Table for smartqueues, storing global information for each queue.',
    'fields' => array(
      'qid' => array(
        'description' => 'The primary identifier for a queue.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE
      ),
      'use_parents' => array(
        'description' => "Whether a queue is to use the terms' parents when displaying the queue selection.",
        'type' => 'int',
        'size' => 'tiny',
        'default' => 0,
      ),
      'use_parents_all' => array(
        'description' => 'Whether a queue is to use all the terms ancestors when displaying the queue selection.',
        'type' => 'int',
        'size' => 'tiny',
        'default' => 0,
      ),
    ),
    'primary key' => array('qid'),
  );

  return $schema;
}

/**
 * Implements hook_update_N().
 *
 * Adds the smartqueue table.
 */
function smartqueue_update_6003() {
  // Don't use hook_schema for database updates per http://drupal.org/node/150220.
  // It's possible that users who installed the 2.7 or 2.8 versions of
  // smartqueue will already have this table.
  if (!db_table_exists('smartqueue')) {
    $schema = array(
      'description' => 'Table for smartqueues, storing global information for each queue.',
      'fields' => array(
        'qid' => array(
          'description' => 'The primary identifier for a queue.',
          'type' => 'serial',
          'unsigned' => TRUE,
          'not null' => TRUE
        ),
        'use_parents' => array(
          'description' => "Whether a queue is to use the terms' parents when displaying the queue selection.",
          'type' => 'int',
          'size' => 'tiny',
          'default' => 0,
        ),
      ),
      'primary key' => array('qid'),
    );
    db_create_table('smartqueue', $schema);
  }
  $result = db_query('SELECT q.qid FROM {nodequeue_queue} q LEFT JOIN {smartqueue} s ON q.qid = s.qid WHERE s.qid IS NULL');
  foreach ($result as $queue) {
    db_insert('smartqueue')
      ->fields(array('qid' => $queue->qid))
      ->execute();
  }
}

/**
 * Change reference field to rely on field names intead of field-ids.
 */
function smartqueue_update_7001() {
  $results = db_select('nodequeue_queue', 'nq')
              ->fields('nq', array('qid','reference'))
              ->condition('owner', 'smartqueue_taxonomy', '=')
              ->execute();
  foreach ($results as $result) {
    $field_names = array();
    $field_ids = explode('-', $result->reference);
    foreach ($field_ids as $field_id) {
      $field = field_info_field_by_id($field_id);
      $field_names[] = $field['field_name'];
    }
    db_update('nodequeue_queue')
      ->fields(array('reference' => implode('-', $field_names)))
      ->condition('qid', $result->qid)
      ->execute();
  }
}

/**
 * Clean-up leftovers from the {smartqueue} table.
 */
function smartqueue_update_7002() {
  db_query('DELETE FROM {smartqueue} WHERE qid NOT IN (SELECT qid FROM {nodequeue_queue})');

  return t('The {smartqueue} table has been cleaned.');
}

/**
 * Add use_parents_all.
 */
function smartqueue_update_7003() {
  $spec = array(
    'description' => 'Whether a queue is to use all the terms ancestors when displaying the queue selection.',
    'type' => 'int',
    'size' => 'tiny',
    'default' => 0,
  );
  db_add_field('smartqueue', 'use_parents_all', $spec);
}