You are here

pardot.install in Pardot Integration 7.2

Same filename and directory in other branches
  1. 6 pardot.install
  2. 7 pardot.install

Install/uninstall taks and updates.

File

pardot.install
View source
<?php

/**
 * @file
 * Install/uninstall taks and updates.
 */

/**
 * Implements hook_schema().
 */
function pardot_schema() {
  $schema = array();
  $schema['pardot_scoring'] = array(
    'description' => 'Scoring settings',
    'primary key' => array(
      'scoring_id',
    ),
    'indexes' => array(),
    'fields' => array(
      'scoring_id' => array(
        // Internal unique identifier.
        'type' => 'serial',
        'size' => 'normal',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'path' => array(
        'type' => 'varchar',
        'size' => 'normal',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'score' => array(
        'description' => 'Pardot score for a given page',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
        'unsigned' => FALSE,
      ),
    ),
  );
  $schema['pardot_campaign'] = array(
    'description' => 'Campaign settings',
    'indexes' => array(),
    'fields' => array(
      'campaign_id' => array(
        'description' => 'Pardot campaign identifier.',
        // Internal unique identifier.
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'name' => array(
        // Form Posted status.
        'description' => 'Human readable campaign name',
        'type' => 'varchar',
        'size' => 'normal',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'paths' => array(
        'description' => 'A list of paths associated with the campaign',
        'type' => 'text',
        'size' => 'normal',
        /* 16KB in mySql */
        'not null' => TRUE,
        'serialize' => FALSE,
      ),
    ),
  );
  return $schema;
}

/**
 * Update Pardot Campaign and Pardot Scoring tables.
 */
function pardot_update_7100(&$sandbox) {

  // Change old field (if necessary).
  if (!db_field_exists('pardot_submissions', 'form_nid')) {
    db_change_field('pardot_submissions', 'form_nid_field', 'form_nid', array(
      'description' => 'Webform nid that generated this post',
      'type' => 'int',
      'size' => 'normal',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
    ));
    return t('The Pardot tables were updated.');
  }
  else {
    return t('The pardot_submissions field "form_nid" already exists, no change needed.');
  }
}

/**
 * Enable the new automate API module.
 */
function pardot_update_7200() {
  module_enable(array(
    'automate',
  ));
  return t('Enabled the automate API module.');
}

/**
 * Enable the new pardot_webform module.
 */
function pardot_update_7201() {
  module_enable(array(
    'pardot_webform',
  ));
  return t('Enabled the pardot_webform module.');
}

Functions

Namesort descending Description
pardot_schema Implements hook_schema().
pardot_update_7100 Update Pardot Campaign and Pardot Scoring tables.
pardot_update_7200 Enable the new automate API module.
pardot_update_7201 Enable the new pardot_webform module.