You are here

public function FeedImportSQLHashes::setOptions in Feed Import 7.3

Sets options for this instance

Parameters

array $options: An assoc array containig options

bool $overwrite: TRUE if the options should pe overwritten, FALSE to merge them

Overrides FeedImportConfigurable::setOptions

1 call to FeedImportSQLHashes::setOptions()
FeedImportSQLHashesv2Compatible::setOptions in feed_import_base/inc/feed_import.inc
Sets options for this instance
1 method overrides FeedImportSQLHashes::setOptions()
FeedImportSQLHashesv2Compatible::setOptions in feed_import_base/inc/feed_import.inc
Sets options for this instance

File

feed_import_base/inc/feed_import.inc, line 1795
This file contains Feed Import helpers.

Class

FeedImportSQLHashes
This class implements SQL hash storage

Code

public function setOptions(array $options, $overwrite = FALSE) {
  if (isset($options['ttl']) && $options['ttl'] >= 0) {
    $this->ttl = (int) $options['ttl'];
  }
  if (isset($options['update_chunk']) && $options['update_chunk'] > 0) {
    $this->updateChunkSize = (int) $options['update_chunk'];
  }
  if (isset($options['insert_chunk']) && $options['insert_chunk'] > 0) {
    $this->insertChunkSize = (int) $options['insert_chunk'];
  }
  if (isset($options['group'])) {
    $this->group = $options['group'];
  }

  // Create insert format.
  $this->insertFormat = array(
    $this->feedName,
    $this->group,
    $this->entity,
    0,
    // holds id
    NULL,
    // holds hash
    0,
  );

  // Create select object.
  $this->select = db_select('feed_import_hashes', 'f')
    ->fields('f', array(
    'hash',
    'id',
    'entity_id',
    'expire',
  ))
    ->condition('feed_group', $this->group)
    ->condition('entity', $this->entity)
    ->condition('hash', array(), 'IN');

  // Create update object.
  $this->update = db_update('feed_import_hashes')
    ->condition('feed_group', $this->group)
    ->condition('entity', $this->entity);

  // Create update format.
  $this->updateFormat = array(
    'expire' => 0,
  );

  // Create insert object.
  $this->insert = db_insert('feed_import_hashes')
    ->fields(array(
    'feed_machine_name',
    'feed_group',
    'entity',
    'entity_id',
    'hash',
    'expire',
  ));
}